Image

- Main Page
- Related Pages
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Functions
Image

## Data Structures
struct | _Elm_Image_Progress
| Structure associated with smart callback 'download,progress'. More...
struct | _Elm_Image_Error
| Structure associated with smart callback 'download,progress'. More...

## Typedefs
typedef Evas_Image_Orient | Elm_Image_Orient
| Using Evas_Image_Orient enums. More...
typedef struct _Elm_Image_Progress | Elm_Image_Progress
| Structure associated with smart callback 'download,progress'. More...
typedef struct _Elm_Image_Error | Elm_Image_Error
| Structre associated with smart callback 'download,error'. More...

## Functions
Evas_Object * | elm_image_add (Evas_Object *parent)
| Add a new image to the parent. More...
Eina_Bool | elm_image_file_set (Evas_Object *obj, const char *file, const char *group)
| Set the file that will be used as the image's source. More...
void | elm_image_file_get (const Eo *obj, const char **file, const char **group)
| Get the file that will be used as image. More...
void | elm_image_prescale_set (Evas_Object *obj, int size)
| Set the prescale size for the image. More...
int | elm_image_prescale_get (const Evas_Object *obj)
| Get the prescale size for the image. More...
Eina_Bool | elm_image_mmap_set (Evas_Object *obj, const Eina_File *file, const char *group)
| Set the file that will be used as the image's source. More...
void | elm_image_animated_play_set (Evas_Object *obj, Eina_Bool play)
| Start or stop an image object's animation. More...
Eina_Bool | elm_image_animated_play_get (const Evas_Object *obj)
| Get whether an image object is under animation or not. More...
void | elm_image_animated_set (Evas_Object *obj, Eina_Bool anim)
| Set whether an image object (which supports animation) is to animate itself or not. More...
Eina_Bool | elm_image_animated_get (const Evas_Object *obj)
| Get whether an image object has animation enabled or not. More...
Eina_Bool | elm_image_animated_available_get (const Evas_Object *obj)
| Get whether an image object supports animation or not. More...

## Detailed Description

An Elementary image object is a direct realization of The Elementary Image Class, and it allows one to load and display an image file on it, be it from a disk file or from a memory region. Exceptionally, one may also load an Edje group as the contents of the image. In this case, though, most of the functions of the image API will act as a no-op.

One can tune various properties of the image, like:

- pre-scaling,
- smooth scaling,
- orientation,
- aspect ratio during resizes, etc.

An image object may also be made valid source and destination for drag and drop actions, through the elm_image_editable_set() call.

Signals that you can add callbacks for are:

- `"drop"` - This is called when a user has dropped an image typed object onto the object in question – the event info argument is the path to that image file
- `"clicked"` - This is called when a user has clicked the image

An example of usage for this API follows:

- Image example

## Typedef Documentation

typedef struct _Elm_Image_Error Elm_Image_Error

Structre associated with smart callback 'download,error'.

Since
  1.8

typedef Evas_Image_Orient Elm_Image_Orient

Using Evas_Image_Orient enums.

Since
  1.14

typedef struct _Elm_Image_Progress Elm_Image_Progress

Structure associated with smart callback 'download,progress'.

Since
  1.8

## Function Documentation

Evas_Object* elm_image_add | ( | Evas_Object * | parent | ) |

Add a new image to the parent.

Parameters

  parent | The parent object

Returns
  The new object or NULL if it cannot be created

See also
  elm_image_file_set()

Eina_Bool elm_image_animated_available_get | ( | const Evas_Object * | obj | ) |

Get whether an image object supports animation or not.

Returns
  `EINA_TRUE` if the image supports animation, `EINA_FALSE` otherwise.

This function returns if this Elementary image object's internal image can be animated. Currently Evas only supports GIF animation. If the return value is EINA_FALSE, other `elm_image_animated_xxx` API calls won't work.

See also
  elm_image_animated_set()

Since
  1.7

Referenced by elm_icon_animated_available_get().

Eina_Bool elm_image_animated_get | ( | const Evas_Object * | obj | ) |

Get whether an image object has animation enabled or not.

Returns
  `EINA_TRUE` if the image has animation enabled, `EINA_FALSE` otherwise.

See also
  elm_image_animated_set()

Since
  1.7

Referenced by elm_icon_animated_get().

Eina_Bool elm_image_animated_play_get | ( | const Evas_Object * | obj | ) |

Get whether an image object is under animation or not.

Returns
  `EINA_TRUE`, if the image is being animated, `EINA_FALSE` otherwise.

See also
  elm_image_animated_play_get()

Since
  1.7

Referenced by elm_icon_animated_play_get().

void elm_image_animated_play_set | ( | Evas_Object * | obj,
|  | Eina_Bool | play
| ) |  |

Start or stop an image object's animation.

To actually start playing any image object's animation, if it supports it, one must do something like:

1 if (elm_image_animated_available_get(img))
2 {
3 elm_image_animated_set(img, EINA_TRUE);
4 elm_image_animated_play_set(img, EINA_TRUE);
5 }

elm_image_animated_set() will enable animation on the image, but not start it yet. This is the function one uses to start and stop animations on image objects.

See also
  elm_image_animated_available_get()
  elm_image_animated_set()
  elm_image_animated_play_get()

Since
  1.7

Parameters

  [in] | play | `EINA_TRUE` to start the animation, `EINA_FALSE` otherwise. Default is `EINA_FALSE`.

Referenced by elm_icon_animated_play_set().

void elm_image_animated_set | ( | Evas_Object * | obj,
|  | Eina_Bool | anim
| ) |  |

Set whether an image object (which supports animation) is to animate itself or not.

An image object, even if it supports animation, will be displayed by default without animation. Call this function with animated set to `EINA_TRUE` to enable its animation. To start or stop the animation, actually, use elm_image_animated_play_set().

See also
  elm_image_animated_get()
  elm_image_animated_available_get()
  elm_image_animated_play_set()

Since
  1.7

Parameters

  [in] | anim | `EINA_TRUE` if the object is to animate itself, `EINA_FALSE` otherwise. Default is `EINA_FALSE`.

Referenced by elm_icon_animated_set().

void elm_image_file_get | ( | const Eo * | obj,
|  | const char ** | file,
|  | const char ** | group
| ) |  |

Get the file that will be used as image.

See also
  elm_image_file_set()

Parameters

  [out] | file | The path to file that will be used as image source
  [out] | group | The group that the image belongs to, in case it's an EET (including Edje case) file. This can be used as a key inside evas image cache if this is a normal image file not eet file.

Referenced by elm_icon_file_get().

Eina_Bool elm_image_file_set | ( | Evas_Object * | obj,
|  | const char * | file,
|  | const char * | group
| ) |  |

Set the file that will be used as the image's source.

Parameters

  obj | The image object
  file | The path to file that will be used as image source
  group | The group that the image belongs to, in case it's an EET (including Edje case) file. This can be used as a key inside evas image cache if this is a normal image file not eet file.

Returns
  (`EINA_TRUE` = success, `EINA_FALSE` = error)

See also
  elm_image_file_get()

Note
  This function will trigger the Edje file case based on the extension of the file string (expects `".edj"`, for this case).
  If you use animated gif image and create multiple image objects with one gif image file, you should set the `group` differently for each object. Or image objects will share one evas image cache entry and you will get unwanted frames.

Eina_Bool elm_image_mmap_set | ( | Evas_Object * | obj,
|  | const Eina_File * | file,
|  | const char * | group
| ) |  |

Set the file that will be used as the image's source.

Parameters

  obj | The image object
  file | The handler to an Eina_File that will be used as image source
  group | The group that the image belongs to, in case it's an EET (including Edje case) file. This can be used as a key inside evas image cache if this is a normal image file not eet file.

Returns
  (`EINA_TRUE` = success, `EINA_FALSE` = error)

See also
  elm_image_file_set()

Note
  This function will trigger the Edje file case based on the extension of the file string use to create the Eina_File (expects `".edj"`, for this case).
  If you use animated gif image and create multiple image objects with one gif image file, you should set the `group` differently for each object. Or image objects will share one evas image cache entry and you will get unwanted frames.

int elm_image_prescale_get | ( | const Evas_Object * | obj | ) |

Get the prescale size for the image.

Parameters

  obj | The image object

Returns
  The prescale size

See also
  elm_image_prescale_set()

Referenced by elm_icon_prescale_get().

void elm_image_prescale_set | ( | Evas_Object * | obj,
|  | int | size
| ) |  |

Set the prescale size for the image.

Parameters

  obj | The image object
  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 also
  elm_image_prescale_get()
  elm_bg_load_size_set()

Referenced by elm_icon_prescale_set().