2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* @defgroup Image Image
|
|
|
|
*
|
|
|
|
* @image html img/widget/image/preview-00.png
|
|
|
|
* @image latex img/widget/image/preview-00.eps
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* An object that allows one to load an image file to it. It can be used
|
|
|
|
* anywhere like any other elementary widget.
|
|
|
|
*
|
|
|
|
* This widget provides most of the functionality provided from @ref Bg or @ref
|
|
|
|
* Icon, but with a slightly different API (use the one that fits better your
|
|
|
|
* needs).
|
|
|
|
*
|
|
|
|
* The features not provided by those two other image widgets are:
|
|
|
|
* @li allowing to get the basic @c Evas_Object with elm_image_object_get();
|
|
|
|
* @li change the object orientation with elm_image_orient_set();
|
|
|
|
* @li and turning the image editable with elm_image_editable_set().
|
|
|
|
*
|
|
|
|
* Signals that you can add callbacks for are:
|
|
|
|
*
|
|
|
|
* @li @c "clicked" - This is called when a user has clicked the image
|
|
|
|
*
|
|
|
|
* An example of usage for this API follows:
|
|
|
|
* @li @ref tutorial_image
|
|
|
|
*/
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* @addtogroup Image
|
|
|
|
* @{
|
|
|
|
*/
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Possible orientation options for elm_image_orient_set().
|
|
|
|
*
|
|
|
|
* @image html elm_image_orient_set.png
|
|
|
|
* @image latex elm_image_orient_set.eps width=\textwidth
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:41:11 -08:00
|
|
|
typedef enum
|
2011-12-29 23:20:48 -08:00
|
|
|
{
|
|
|
|
ELM_IMAGE_ORIENT_NONE = 0, /**< no orientation change */
|
|
|
|
ELM_IMAGE_ORIENT_0 = 0, /**< no orientation change */
|
|
|
|
ELM_IMAGE_ROTATE_90 = 1, /**< rotate 90 degrees clockwise */
|
|
|
|
ELM_IMAGE_ROTATE_180 = 2, /**< rotate 180 degrees clockwise */
|
|
|
|
ELM_IMAGE_ROTATE_270 = 3, /**< rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) */
|
|
|
|
ELM_IMAGE_FLIP_HORIZONTAL = 4, /**< flip image horizontally */
|
|
|
|
ELM_IMAGE_FLIP_VERTICAL = 5, /**< flip image vertically */
|
|
|
|
ELM_IMAGE_FLIP_TRANSPOSE = 6, /**< flip the image along the y = (width - x) line (bottom-left to top-right) */
|
|
|
|
ELM_IMAGE_FLIP_TRANSVERSE = 7 /**< flip the image along the y = x line (top-left to bottom-right) */
|
|
|
|
} Elm_Image_Orient;
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Add a new image to the parent.
|
|
|
|
*
|
|
|
|
* @param parent The parent object
|
|
|
|
* @return The new object or NULL if it cannot be created
|
|
|
|
*
|
|
|
|
* @see elm_image_file_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Evas_Object *elm_image_add(Evas_Object *parent);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set the file that will be used as image.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param file The path to file that will be used as image
|
|
|
|
* @param group The group that the image belongs in edje file (if it's an
|
|
|
|
* edje image)
|
|
|
|
*
|
|
|
|
* @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
|
|
|
|
*
|
|
|
|
* @see elm_image_file_get()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Eina_Bool elm_image_file_set(Evas_Object *obj, const char *file, const char *group);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get the file that will be used as image.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param file The path to file
|
|
|
|
* @param group The group that the image belongs in edje file
|
|
|
|
*
|
|
|
|
* @see elm_image_file_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_file_get(const Evas_Object *obj, const char **file, const char **group);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set the smooth effect for an image.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE
|
|
|
|
* otherwise. Default is @c EINA_TRUE.
|
|
|
|
*
|
|
|
|
* Set the scaling algorithm to be used when scaling the image. Smooth
|
|
|
|
* scaling provides a better resulting image, but is slower.
|
|
|
|
*
|
|
|
|
* The smooth scaling should be disabled when making animations that change
|
|
|
|
* the image size, since it will be faster. Animations that don't require
|
|
|
|
* resizing of the image can keep the smooth scaling enabled (even if the
|
|
|
|
* image is already scaled, since the scaled image will be cached).
|
|
|
|
*
|
|
|
|
* @see elm_image_smooth_get()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_smooth_set(Evas_Object *obj, Eina_Bool smooth);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get the smooth effect for an image.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise.
|
|
|
|
*
|
|
|
|
* @see elm_image_smooth_get()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Eina_Bool elm_image_smooth_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Gets the current size of the image.
|
|
|
|
*
|
|
|
|
* @param obj The image object.
|
|
|
|
* @param w Pointer to store width, or NULL.
|
|
|
|
* @param h Pointer to store height, or NULL.
|
|
|
|
*
|
|
|
|
* This is the real size of the image, not the size of the object.
|
|
|
|
*
|
2012-02-14 00:50:37 -08:00
|
|
|
* On error, neither w and h will be filled with 0.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_object_size_get(const Evas_Object *obj, int *w, int *h);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Disable scaling of this object.
|
|
|
|
*
|
|
|
|
* @param obj The image object.
|
|
|
|
* @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE
|
|
|
|
* otherwise. Default is @c EINA_FALSE.
|
|
|
|
*
|
|
|
|
* This function disables scaling of the elm_image widget through the
|
|
|
|
* function elm_object_scale_set(). However, this does not affect the widget
|
|
|
|
* size/resize in any way. For that effect, take a look at
|
|
|
|
* elm_image_scale_set().
|
|
|
|
*
|
|
|
|
* @see elm_image_no_scale_get()
|
|
|
|
* @see elm_image_scale_set()
|
|
|
|
* @see elm_object_scale_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get whether scaling is disabled on the object.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise
|
|
|
|
*
|
|
|
|
* @see elm_image_no_scale_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Eina_Bool elm_image_no_scale_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-14 00:50:37 -08:00
|
|
|
* Set if the object is (up/down) resizeable.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @param obj The image object
|
2012-02-14 00:50:37 -08:00
|
|
|
* @param scale_up A bool to set if the object is resizeable up. Default is
|
2011-12-29 23:20:48 -08:00
|
|
|
* @c EINA_TRUE.
|
2012-02-14 00:50:37 -08:00
|
|
|
* @param scale_down A bool to set if the object is resizeable down. Default
|
2011-12-29 23:20:48 -08:00
|
|
|
* is @c EINA_TRUE.
|
|
|
|
*
|
|
|
|
* This function limits the image resize ability. If @p scale_up is set to
|
|
|
|
* @c EINA_FALSE, the object can't have its height or width resized to a value
|
|
|
|
* higher than the original image size. Same is valid for @p scale_down.
|
|
|
|
*
|
|
|
|
* @see elm_image_scale_get()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_scale_set(Evas_Object *obj, Eina_Bool scale_up, Eina_Bool scale_down);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-14 00:50:37 -08:00
|
|
|
* Get if the object is (up/down) resizeable.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @param obj The image object
|
2012-02-14 00:50:37 -08:00
|
|
|
* @param scale_up A bool to set if the object is resizeable up
|
|
|
|
* @param scale_down A bool to set if the object is resizeable down
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @see elm_image_scale_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_scale_get(const Evas_Object *obj, Eina_Bool *scale_up, Eina_Bool *scale_down);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set if the image fills the entire object area, when keeping the aspect ratio.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param fill_outside @c EINA_TRUE if the object is filled outside,
|
|
|
|
* @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
|
|
|
|
*
|
|
|
|
* When the image should keep its aspect ratio even if resized to another
|
|
|
|
* aspect ratio, there are two possibilities to resize it: keep the entire
|
|
|
|
* image inside the limits of height and width of the object (@p fill_outside
|
|
|
|
* is @c EINA_FALSE) or let the extra width or height go outside of the object,
|
|
|
|
* and the image will fill the entire object (@p fill_outside is @c EINA_TRUE).
|
|
|
|
*
|
|
|
|
* @note This option will have no effect if
|
2012-01-05 21:55:51 -08:00
|
|
|
* elm_image_aspect_fixed_set() is set to @c EINA_FALSE.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @see elm_image_fill_outside_get()
|
2012-01-05 21:55:51 -08:00
|
|
|
* @see elm_image_aspect_fixed_set()
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get if the object is filled outside
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise.
|
|
|
|
*
|
|
|
|
* @see elm_image_fill_outside_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Eina_Bool elm_image_fill_outside_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set the prescale size for the image
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param size The prescale size. This value is used for both width and
|
|
|
|
* height.
|
|
|
|
*
|
|
|
|
* This function sets a new size for pixmap representation of the given
|
|
|
|
* image. It allows the image to be loaded already in the specified size,
|
|
|
|
* reducing the memory usage and load time when loading a big image with load
|
|
|
|
* size set to a smaller size.
|
|
|
|
*
|
|
|
|
* It's equivalent to the elm_bg_load_size_set() function for bg.
|
|
|
|
*
|
|
|
|
* @note this is just a hint, the real size of the pixmap may differ
|
|
|
|
* depending on the type of image being loaded, being bigger than requested.
|
|
|
|
*
|
|
|
|
* @see elm_image_prescale_get()
|
|
|
|
* @see elm_bg_load_size_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_prescale_set(Evas_Object *obj, int size);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get the prescale size for the image
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @return The prescale size
|
|
|
|
*
|
|
|
|
* @see elm_image_prescale_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI int elm_image_prescale_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set the image orientation.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @param orient The image orientation @ref Elm_Image_Orient
|
|
|
|
* Default is #ELM_IMAGE_ORIENT_NONE.
|
|
|
|
*
|
|
|
|
* This function allows to rotate or flip the given image.
|
|
|
|
*
|
|
|
|
* @see elm_image_orient_get()
|
|
|
|
* @see @ref Elm_Image_Orient
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get the image orientation.
|
|
|
|
*
|
|
|
|
* @param obj The image object
|
|
|
|
* @return The image orientation @ref Elm_Image_Orient
|
|
|
|
*
|
|
|
|
* @see elm_image_orient_set()
|
|
|
|
* @see @ref Elm_Image_Orient
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Elm_Image_Orient elm_image_orient_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Make the image 'editable'.
|
|
|
|
*
|
|
|
|
* @param obj Image object.
|
|
|
|
* @param set Turn on or off editability. Default is @c EINA_FALSE.
|
|
|
|
*
|
|
|
|
* This means the image is a valid drag target for drag and drop, and can be
|
|
|
|
* cut or pasted too.
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Check if the image 'editable'.
|
|
|
|
*
|
|
|
|
* @param obj Image object.
|
|
|
|
* @return Editability.
|
|
|
|
*
|
|
|
|
* A return value of EINA_TRUE means the image is a valid drag target
|
|
|
|
* for drag and drop, and can be cut or pasted too.
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get the basic Evas_Image object from this object (widget).
|
|
|
|
*
|
|
|
|
* @param obj The image object to get the inlined image from
|
|
|
|
* @return The inlined image object, or NULL if none exists
|
|
|
|
*
|
|
|
|
* This function allows one to get the underlying @c Evas_Object of type
|
|
|
|
* Image from this elementary widget. It can be useful to do things like get
|
|
|
|
* the pixel data, save the image to a file, etc.
|
|
|
|
*
|
|
|
|
* @note Be careful to not manipulate it, as it is under control of
|
|
|
|
* elementary.
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2011-12-30 01:48:46 -08:00
|
|
|
EAPI Evas_Object *elm_image_object_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Set whether the original aspect ratio of the image should be kept on resize.
|
|
|
|
*
|
|
|
|
* @param obj The image object.
|
2012-01-05 21:55:51 -08:00
|
|
|
* @param fixed @c EINA_TRUE if the image should retain the aspect,
|
2011-12-29 23:20:48 -08:00
|
|
|
* @c EINA_FALSE otherwise.
|
|
|
|
*
|
|
|
|
* The original aspect ratio (width / height) of the image is usually
|
|
|
|
* distorted to match the object's size. Enabling this option will retain
|
|
|
|
* this original aspect, and the way that the image is fit into the object's
|
|
|
|
* area depends on the option set by elm_image_fill_outside_set().
|
|
|
|
*
|
2012-01-05 21:55:51 -08:00
|
|
|
* @see elm_image_aspect_fixed_get()
|
2011-12-29 23:20:48 -08:00
|
|
|
* @see elm_image_fill_outside_set()
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2012-01-05 21:55:51 -08:00
|
|
|
EAPI void elm_image_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* Get if the object retains the original aspect ratio.
|
|
|
|
*
|
|
|
|
* @param obj The image object.
|
|
|
|
* @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* @ingroup Image
|
|
|
|
*/
|
2012-01-05 21:55:51 -08:00
|
|
|
EAPI Eina_Bool elm_image_aspect_fixed_get(const Evas_Object *obj);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|