Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

etk_image.h File Reference


Detailed Description


Data Structures

struct  Etk_Image
 [Widget] A widget that can load and display an image More...

Defines

#define ETK_IMAGE_TYPE   (etk_image_type_get())
#define ETK_IMAGE(obj)   (ETK_OBJECT_CAST((obj), ETK_IMAGE_TYPE, Etk_Image))
#define ETK_IS_IMAGE(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_IMAGE_TYPE))

Enumerations

enum  Etk_Image_Source {
  ETK_IMAGE_FILE,
  ETK_IMAGE_EDJE,
  ETK_IMAGE_STOCK,
  ETK_IMAGE_EVAS_OBJECT,
  ETK_IMAGE_DATA
}
 The different sources that an Etk_Image can use. More...

Functions

Etk_Widget * etk_image_new (void)
 Creates a new empty image.
Etk_Widget * etk_image_new_from_file (const char *filename, const char *key)
 Creates a new image and loads the image from an image file.
Etk_Widget * etk_image_new_from_edje (const char *filename, const char *group)
 Creates a new image and loads the image from an edje-file.
Etk_Widget * etk_image_new_from_stock (Etk_Stock_Id stock_id, Etk_Stock_Size stock_size)
 Creates a new image and loads the image corresponding to the stock id.
Etk_Widget * etk_image_new_from_evas_object (Evas_Object *evas_object)
 Creates a new image from the given evas object.
Etk_Widget * etk_image_new_from_data (int width, int height, void *data, Etk_Bool copy)
 Creates a new image from the given pixel data.
void etk_image_set_from_file (Etk_Image *image, const char *filename, const char *key)
 Loads the image from a file.
void etk_image_file_get (Etk_Image *image, char **filename, char **key)
 Gets the path to the file used by the image.
void etk_image_set_from_edje (Etk_Image *image, const char *filename, const char *group)
 Loads the image from an edje file.
void etk_image_edje_get (Etk_Image *image, char **filename, char **group)
 Gets the filename and the group of the edje-object used for the image.
void etk_image_set_from_stock (Etk_Image *image, Etk_Stock_Id stock_id, Etk_Stock_Size stock_size)
 Loads the image corresponding to the given stock-id.
void etk_image_stock_get (Etk_Image *image, Etk_Stock_Id *stock_id, Etk_Stock_Size *stock_size)
 Gets the stock-id and the stock-size used by the image.
void etk_image_set_from_evas_object (Etk_Image *image, Evas_Object *evas_object)
 Loads the image from an Evas object.
Evas_Object * etk_image_evas_object_get (Etk_Image *image)
 Gets the Evas object used by the image. You can call this function even if you have not explicitly set the Evas object used by this image. For example, if you have loaded the image from a file, this function will return the corresponding Evas image object. You should just be careful by manipulating it (don't use Edje functions on an image object for example).
void etk_image_set_from_data (Etk_Image *image, int width, int height, void *data, Etk_Bool copy)
 Sets the pixels of the image.
void * etk_image_data_get (Etk_Image *image, Etk_Bool for_writing)
 Gets a pointer to the image pixels. This function only works if the image has been loaded from a file or if you have explicitely set its pixels with etk_image_set_from_data().
Etk_Image_Source etk_image_source_get (Etk_Image *image)
 Gets the source of the image (file, edje-file, stock, Evas object or pixel data).
void etk_image_update (Etk_Image *image)
 Updates all the pixels of the image (to be called after you have modified the pixel buffer for example). Same as etk_image_update_rect(image, 0, 0, image_width, image_height).
void etk_image_update_rect (Etk_Image *image, int x, int y, int w, int h)
 Updates a rectangle of the pixels of the image (to be called after you have modified the pixel buffer for example). It only has effect on image loaded from a pixel buffer.
void etk_image_copy (Etk_Image *dest_image, Etk_Image *src_image)
 Copies the image src_image to dest_image.
void etk_image_size_get (Etk_Image *image, int *width, int *height)
 Gets the native size of the image. If the image is loaded from a file or from given pixels, it returns the native size of the image. If the image is loaded from an Edje file or a stock-id, it returns the minimum size of the Edje object (a stock image is an Edje object). Otherwise, the returned size is 0x0.
void etk_image_keep_aspect_set (Etk_Image *image, Etk_Bool keep_aspect)
 Sets if the image should keep its aspect ratio when it is resized.
Etk_Bool etk_image_keep_aspect_get (Etk_Image *image)
 Gets whether the image keeps its aspect ratio when it is resized.
void etk_image_aspect_ratio_set (Etk_Image *image, double aspect_ratio)
 Sets (forces) the aspect ratio of the image. You can use this function for example to set the aspect-ratio when you set the image from an Evas object with etk_image_set_from_evas_object().
double etk_image_aspect_ratio_get (Etk_Image *image)
 Gets the aspect ratio you set to the image. If no aspect ratio has been set, it will return 0.0. To know the native aspect ratio, call etk_image_size_get() to get the native size of the image and calculate the aspect ratio from these values.