2 * @defgroup Image Image
4 * @image html img/widget/image/preview-00.png
5 * @image latex img/widget/image/preview-00.eps
8 * An object that allows one to load an image file to it. It can be used
9 * anywhere like any other elementary widget.
11 * This widget provides most of the functionality provided from @ref Bg or @ref
12 * Icon, but with a slightly different API (use the one that fits better your
15 * The features not provided by those two other image widgets are:
16 * @li allowing to get the basic @c Evas_Object with elm_image_object_get();
17 * @li change the object orientation with elm_image_orient_set();
18 * @li and turning the image editable with elm_image_editable_set().
20 * Signals that you can add callbacks for are:
22 * @li @c "clicked" - This is called when a user has clicked the image
24 * An example of usage for this API follows:
25 * @li @ref tutorial_image
34 * Possible orientation options for elm_image_orient_set().
36 * @image html elm_image_orient_set.png
37 * @image latex elm_image_orient_set.eps width=\textwidth
43 ELM_IMAGE_ORIENT_NONE = 0, /**< no orientation change */
44 ELM_IMAGE_ORIENT_0 = 0, /**< no orientation change */
45 ELM_IMAGE_ROTATE_90 = 1, /**< rotate 90 degrees clockwise */
46 ELM_IMAGE_ROTATE_180 = 2, /**< rotate 180 degrees clockwise */
47 ELM_IMAGE_ROTATE_270 = 3, /**< rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) */
48 ELM_IMAGE_FLIP_HORIZONTAL = 4, /**< flip image horizontally */
49 ELM_IMAGE_FLIP_VERTICAL = 5, /**< flip image vertically */
50 ELM_IMAGE_FLIP_TRANSPOSE = 6, /**< flip the image along the y = (width - x) line (bottom-left to top-right) */
51 ELM_IMAGE_FLIP_TRANSVERSE = 7 /**< flip the image along the y = x line (top-left to bottom-right) */
55 * Add a new image to the parent.
57 * @param parent The parent object
58 * @return The new object or NULL if it cannot be created
60 * @see elm_image_file_set()
64 EAPI Evas_Object *elm_image_add(Evas_Object *parent);
67 * Set the file that will be used as image.
69 * @param obj The image object
70 * @param file The path to file that will be used as image
71 * @param group The group that the image belongs in edje file (if it's an
74 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
76 * @see elm_image_file_get()
80 EAPI Eina_Bool elm_image_file_set(Evas_Object *obj, const char *file, const char *group);
83 * Get the file that will be used as image.
85 * @param obj The image object
86 * @param file The path to file
87 * @param group The group that the image belongs in edje file
89 * @see elm_image_file_set()
93 EAPI void elm_image_file_get(const Evas_Object *obj, const char **file, const char **group);
96 * Set the smooth effect for an image.
98 * @param obj The image object
99 * @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE
100 * otherwise. Default is @c EINA_TRUE.
102 * Set the scaling algorithm to be used when scaling the image. Smooth
103 * scaling provides a better resulting image, but is slower.
105 * The smooth scaling should be disabled when making animations that change
106 * the image size, since it will be faster. Animations that don't require
107 * resizing of the image can keep the smooth scaling enabled (even if the
108 * image is already scaled, since the scaled image will be cached).
110 * @see elm_image_smooth_get()
114 EAPI void elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth);
117 * Get the smooth effect for an image.
119 * @param obj The image object
120 * @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise.
122 * @see elm_image_smooth_get()
126 EAPI Eina_Bool elm_image_smooth_get(const Evas_Object *obj);
129 * Gets the current size of the image.
131 * @param obj The image object.
132 * @param w Pointer to store width, or NULL.
133 * @param h Pointer to store height, or NULL.
135 * This is the real size of the image, not the size of the object.
139 EAPI void elm_image_object_size_get(const Evas_Object *obj, int *w, int *h);
142 * Disable scaling of this object.
144 * @param obj The image object.
145 * @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE
146 * otherwise. Default is @c EINA_FALSE.
148 * This function disables scaling of the elm_image widget through the
149 * function elm_object_scale_set(). However, this does not affect the widget
150 * size/resize in any way. For that effect, take a look at
151 * elm_image_resizable_set().
153 * @see elm_image_no_scale_get()
154 * @see elm_image_resizable_set()
155 * @see elm_object_scale_set()
159 EAPI void elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
162 * Get whether scaling is disabled on the object.
164 * @param obj The image object
165 * @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise
167 * @see elm_image_no_scale_set()
171 EAPI Eina_Bool elm_image_no_scale_get(const Evas_Object *obj);
174 * Set if the object is (up/down) resizable.
176 * @param obj The image object
177 * @param size_up A bool to set if the object is resizable up. Default is
179 * @param size_down A bool to set if the object is resizable down. Default
182 * This function limits the image resize ability. If @p size_up is set to
183 * @c EINA_FALSE, the object can't have its height or width resized to a value
184 * higher than the original image size. Same is valid for @p size_down.
186 * @see elm_image_resizable_get()
190 EAPI void elm_image_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down);
193 * Get if the object is (up/down) resizable.
195 * @param obj The image object
196 * @param size_up A bool to set if the object is resizable up
197 * @param size_down A bool to set if the object is resizable down
199 * @see elm_image_resizable_set()
203 EAPI void elm_image_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down);
206 * Set if the image fills the entire object area, when keeping the aspect ratio.
208 * @param obj The image object
209 * @param fill_outside @c EINA_TRUE if the object is filled outside,
210 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
212 * When the image should keep its aspect ratio even if resized to another
213 * aspect ratio, there are two possibilities to resize it: keep the entire
214 * image inside the limits of height and width of the object (@p fill_outside
215 * is @c EINA_FALSE) or let the extra width or height go outside of the object,
216 * and the image will fill the entire object (@p fill_outside is @c EINA_TRUE).
218 * @note This option will have no effect if
219 * elm_image_aspect_fixed_set() is set to @c EINA_FALSE.
221 * @see elm_image_fill_outside_get()
222 * @see elm_image_aspect_fixed_set()
226 EAPI void elm_image_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside);
229 * Get if the object is filled outside
231 * @param obj The image object
232 * @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise.
234 * @see elm_image_fill_outside_set()
238 EAPI Eina_Bool elm_image_fill_outside_get(const Evas_Object *obj);
241 * Enable or disable preloading of the image
243 * @param obj The image object
244 * @param disabled If EINA_TRUE, preloading will be disabled
247 EAPI void elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled);
250 * Set the prescale size for the image
252 * @param obj The image object
253 * @param size The prescale size. This value is used for both width and
256 * This function sets a new size for pixmap representation of the given
257 * image. It allows the image to be loaded already in the specified size,
258 * reducing the memory usage and load time when loading a big image with load
259 * size set to a smaller size.
261 * It's equivalent to the elm_bg_load_size_set() function for bg.
263 * @note this is just a hint, the real size of the pixmap may differ
264 * depending on the type of image being loaded, being bigger than requested.
266 * @see elm_image_prescale_get()
267 * @see elm_bg_load_size_set()
271 EAPI void elm_image_prescale_set(Evas_Object *obj, int size);
274 * Get the prescale size for the image
276 * @param obj The image object
277 * @return The prescale size
279 * @see elm_image_prescale_set()
283 EAPI int elm_image_prescale_get(const Evas_Object *obj);
286 * Set the image orientation.
288 * @param obj The image object
289 * @param orient The image orientation @ref Elm_Image_Orient
290 * Default is #ELM_IMAGE_ORIENT_NONE.
292 * This function allows to rotate or flip the given image.
294 * @see elm_image_orient_get()
295 * @see @ref Elm_Image_Orient
299 EAPI void elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient);
302 * Get the image orientation.
304 * @param obj The image object
305 * @return The image orientation @ref Elm_Image_Orient
307 * @see elm_image_orient_set()
308 * @see @ref Elm_Image_Orient
312 EAPI Elm_Image_Orient elm_image_orient_get(const Evas_Object *obj);
315 * Make the image 'editable'.
317 * @param obj Image object.
318 * @param set Turn on or off editability. Default is @c EINA_FALSE.
320 * This means the image is a valid drag target for drag and drop, and can be
325 EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set);
328 * Check if the image is 'editable'.
330 * @param obj Image object.
331 * @return Editability.
333 * A return value of EINA_TRUE means the image is a valid drag target
334 * for drag and drop, and can be cut or pasted too.
338 EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
341 * Get the inlined image object of the image widget.
343 * @param obj The image object to get the inlined image from
344 * @return The inlined image object, or NULL if none exists
346 * This function allows one to get the underlying @c Evas_Object of type
347 * Image from this elementary widget. It can be useful to do things like get
348 * the pixel data, save the image to a file, etc.
350 * @note Be careful to not manipulate it, as it is under control of
355 EAPI Evas_Object *elm_image_object_get(const Evas_Object *obj);
358 * Set whether the original aspect ratio of the image should be kept on resize.
360 * @param obj The image object.
361 * @param fixed @c EINA_TRUE if the image should retain the aspect,
362 * @c EINA_FALSE otherwise.
364 * The original aspect ratio (width / height) of the image is usually
365 * distorted to match the object's size. Enabling this option will retain
366 * this original aspect, and the way that the image is fit into the object's
367 * area depends on the option set by elm_image_fill_outside_set().
369 * @see elm_image_aspect_fixed_get()
370 * @see elm_image_fill_outside_set()
374 EAPI void elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
377 * Get if the object retains the original aspect ratio.
379 * @param obj The image object.
380 * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
385 EAPI Eina_Bool elm_image_aspect_fixed_get(const Evas_Object *obj);