Image Functions

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

Data Structures | Macros | Typedefs | Enumerations | Functions
Image Functions
Evas » Canvas Functions

Functions that deal with images at canvas level. More...

## Data Structures
struct | _Evas_Image_Load_Opts
struct | _Evas_Image_Property
struct | _Evas_Image_Load_Func

## Macros
#define | EVAS_IMAGE_CLASS evas_image_class_get()
| Internal class for legacy support of Evas Image.
#define | EVAS_IMAGE_ANIMATED_HINT_NONE EMILE_IMAGE_ANIMATED_HINT_NONE
#define | EVAS_IMAGE_ANIMATED_HINT_LOOP EMILE_IMAGE_ANIMATED_HINT_LOOP
#define | EVAS_IMAGE_ANIMATED_HINT_PINGPONG EMILE_IMAGE_ANIMATED_HINT_PINGPONG
#define | EVAS_IMAGE_SCALE_HINT_NONE EMILE_IMAGE_SCALE_HINT_NONE
#define | EVAS_IMAGE_SCALE_HINT_DYNAMIC EMILE_IMAGE_SCALE_HINT_DYNAMIC
#define | EVAS_IMAGE_SCALE_HINT_STATIC EMILE_IMAGE_SCALE_HINT_STATIC
#define | EVAS_COLORSPACE_ARGB8888 EMILE_COLORSPACE_ARGB8888
#define | EVAS_COLORSPACE_YCBCR422P601_PL EMILE_COLORSPACE_YCBCR422P601_PL
#define | EVAS_COLORSPACE_YCBCR422P709_PL EMILE_COLORSPACE_YCBCR422P709_PL
#define | EVAS_COLORSPACE_RGB565_A5P EMILE_COLORSPACE_RGB565_A5P
#define | EVAS_COLORSPACE_GRY8 EMILE_COLORSPACE_GRY8
#define | EVAS_COLORSPACE_YCBCR422601_PL EMILE_COLORSPACE_YCBCR422601_PL
#define | EVAS_COLORSPACE_YCBCR420NV12601_PL EMILE_COLORSPACE_YCBCR420NV12601_PL
#define | EVAS_COLORSPACE_YCBCR420TM12601_PL EMILE_COLORSPACE_YCBCR420TM12601_PL
#define | EVAS_COLORSPACE_AGRY88 EMILE_COLORSPACE_AGRY88
#define | EVAS_COLORSPACE_ETC1 EMILE_COLORSPACE_ETC1
#define | EVAS_COLORSPACE_RGB8_ETC2 EMILE_COLORSPACE_RGB8_ETC2
#define | EVAS_COLORSPACE_RGBA8_ETC2_EAC EMILE_COLORSPACE_RGBA8_ETC2_EAC
#define | EVAS_COLORSPACE_ETC1_ALPHA EMILE_COLORSPACE_ETC1_ALPHA
#define | EVAS_COLORSPACE_RGB_S3TC_DXT1 EMILE_COLORSPACE_RGB_S3TC_DXT1
#define | EVAS_COLORSPACE_RGBA_S3TC_DXT1 EMILE_COLORSPACE_RGBA_S3TC_DXT1
#define | EVAS_COLORSPACE_RGBA_S3TC_DXT2 EMILE_COLORSPACE_RGBA_S3TC_DXT2
#define | EVAS_COLORSPACE_RGBA_S3TC_DXT3 EMILE_COLORSPACE_RGBA_S3TC_DXT3
#define | EVAS_COLORSPACE_RGBA_S3TC_DXT4 EMILE_COLORSPACE_RGBA_S3TC_DXT4
#define | EVAS_COLORSPACE_RGBA_S3TC_DXT5 EMILE_COLORSPACE_RGBA_S3TC_DXT5
#define | EVAS_IMAGE_LOAD_VERSION 2
#define | EVAS_MODULE_TASK_CHECK(Count, Mask, Error, Error_Handler)
#define | EVAS_MODULE_DEFINE(Type, Tn, Name)
#define | EVAS_EINA_MODULE_DEFINE(Tn, Name)

## Typedefs
typedef struct _Evas_Image_Load_Opts | Evas_Image_Load_Opts
typedef Emile_Image_Animated | Evas_Image_Animated
typedef struct _Evas_Image_Property | Evas_Image_Property
typedef struct _Evas_Image_Load_Func | Evas_Image_Load_Func
typedef Emile_Image_Animated_Loop_Hint | Evas_Image_Animated_Loop_Hint
typedef Emile_Image_Scale_Hint | Evas_Image_Scale_Hint
| How an image's data is to be treated by Evas, with regard to scaling cache.

## Enumerations
enum | Evas_Load_Error { EVAS_LOAD_ERROR_NONE = 0 , EVAS_LOAD_ERROR_GENERIC , EVAS_LOAD_ERROR_DOES_NOT_EXIST , EVAS_LOAD_ERROR_PERMISSION_DENIED , EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED , EVAS_LOAD_ERROR_CORRUPT_FILE , EVAS_LOAD_ERROR_UNKNOWN_FORMAT , EVAS_LOAD_ERROR_CANCELLED }
| Possible outcomes of a load operation. More...

## Functions
EVAS_API Eina_Bool | evas_object_image_region_support_get (const Evas_Object *obj)
| Get the support state of a given image.
EVAS_API Eina_Bool | evas_object_image_alpha_get (const Evas_Object *obj)
| Retrieve whether alpha channel data is being used on the given image object.
EVAS_API void | evas_object_image_orient_set (Evas_Object *obj, Evas_Image_Orient orient)
| Set the image orientation.
EVAS_API Evas_Image_Orient | evas_object_image_orient_get (const Evas_Object *obj)
| Get the image orientation.
EVAS_API void | evas_object_image_scale_hint_set (Evas_Object *obj, Evas_Image_Scale_Hint hint)
| Set the scale hint of a given image of the canvas.
EVAS_API Evas_Image_Scale_Hint | evas_object_image_scale_hint_get (const Evas_Object *obj)
| Get the scale hint of a given image of the canvas.
EVAS_API void | evas_object_image_colorspace_set (Evas_Object *obj, Evas_Colorspace cspace)
| Set the colorspace of a given image of the canvas.
EVAS_API Evas_Colorspace | evas_object_image_colorspace_get (const Evas_Object *obj)
| Get the colorspace of a given image of the canvas.
EVAS_API int | evas_object_image_stride_get (const Evas_Object *obj)
| Retrieves the row stride of the given image object.
EVAS_API void | evas_object_image_data_copy_set (Evas_Object *obj, void *data)
| Replaces the raw image data of the given image object.
EVAS_API void | evas_object_image_data_set (Evas_Object *obj, void *data)
| Sets the raw image data of the given image object.
EVAS_API void * | evas_object_image_data_get (const Evas_Object *obj, Eina_Bool for_writing)
| Get a pointer to the raw image data of the given image object.
EVAS_API Eina_Bool | evas_module_register (const Evas_Module_Api *module, Evas_Module_Type type)
EVAS_API Eina_Bool | evas_module_unregister (const Evas_Module_Api *module, Evas_Module_Type type)
EVAS_API Eina_Bool | evas_module_task_cancelled (void)
static Eina_Bool | evas_loader_helper_stretch_region_push (uint8_t **region, uint8_t *offset, Eina_Bool stretchable)

## Detailed Description

Functions that deal with images at canvas level.

Compare with Image Object Functions functions which deal with images at the object level.

## Macro Definition Documentation

## ◆ EVAS_MODULE_TASK_CHECK

#define EVAS_MODULE_TASK_CHECK | ( |  | Count,
|  |  | Mask,
|  |  | Error,
|  |  | Error_Handler
| ) |  |

Value:
do { \
Count++; \
if ((Count & Mask) == Mask) \
{ \
Count = 0; \
if (evas_module_task_cancelled()) \
{ \
*Error = EVAS_LOAD_ERROR_CANCELLED; \
goto Error_Handler; \
} \
} \
} while (0)
evas_module_task_cancelled
EVAS_API Eina_Bool evas_module_task_cancelled(void)
Definition: evas_module.c:42
EVAS_LOAD_ERROR_CANCELLED
@ EVAS_LOAD_ERROR_CANCELLED
File loading has been cancelled.
Definition: Evas_Loader.h:148

## ◆ EVAS_MODULE_DEFINE

#define EVAS_MODULE_DEFINE | ( |  | Type,
|  |  | Tn,
|  |  | Name
| ) |  |

Value:
Eina_Bool evas_##Tn##_##Name##_init(void) \
{ \
return evas_module_register(&evas_modapi, Type); \
} \
void evas_##Tn##_##Name##_shutdown(void) \
{ \
evas_module_unregister(&evas_modapi, Type); \
}
Eina_Bool
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527

## ◆ EVAS_EINA_MODULE_DEFINE

#define EVAS_EINA_MODULE_DEFINE | ( |  | Tn,
|  |  | Name
| ) |  |

Value:
EINA_MODULE_INIT(evas_##Tn##_##Name##_init); \
EINA_MODULE_SHUTDOWN(evas_##Tn##_##Name##_shutdown);
EINA_MODULE_INIT
#define EINA_MODULE_INIT(f)
declares the given function as the module initializer (__eina_module_init).
Definition: eina_module.h:100

## Enumeration Type Documentation

## ◆ Evas_Load_Error

enum Evas_Load_Error

Possible outcomes of a load operation.

Enumerator
EVAS_LOAD_ERROR_NONE | No error on load.
EVAS_LOAD_ERROR_GENERIC | A non-specific error occurred.
EVAS_LOAD_ERROR_DOES_NOT_EXIST | File (or file path) does not exist.
EVAS_LOAD_ERROR_PERMISSION_DENIED | Permission denied to an existing file (or path)
EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED | Allocation of resources failure prevented load.
EVAS_LOAD_ERROR_CORRUPT_FILE | File corrupt (but was detected as a known format)
EVAS_LOAD_ERROR_UNKNOWN_FORMAT | File is not a known format.
EVAS_LOAD_ERROR_CANCELLED | File loading has been cancelled.

## Function Documentation

## ◆ evas_object_image_region_support_get()

EVAS_API Eina_Bool evas_object_image_region_support_get | ( | const Evas_Object * | obj | ) |

Get the support state of a given image.

Parameters

  [in] | obj | The object

Returns
  The region support state.

Since
  1.2

References EINA_FALSE.

## ◆ evas_object_image_alpha_get()

EVAS_API Eina_Bool evas_object_image_alpha_get | ( | const Evas_Object * | obj | ) |

Retrieve whether alpha channel data is being used on the given image object.

This function returns `true` if the image object's alpha channel is being used, or `false` otherwise.

Parameters

  [in] | obj | The object

Returns
  Whether to use alpha channel ($true) data or not ($false).

References EINA_FALSE.

## ◆ evas_object_image_orient_set()

EVAS_API void evas_object_image_orient_set | ( | Evas_Object * | obj,
|  | Evas_Image_Orient | orient
| ) |  |

Set the image orientation.

This function allows to rotate or flip the image.

Parameters

  [in] | obj | The object
  [in] | orient | The image orientation Evas_Image_Orient. Default is EVAS_IMAGE_ORIENT_NONE.

Since
  1.14

## ◆ evas_object_image_orient_get()

EVAS_API Evas_Image_Orient evas_object_image_orient_get | ( | const Evas_Object * | obj | ) |

Get the image orientation.

Parameters

  [in] | obj | The object

Returns
  The image orientation Evas_Image_Orient. Default is EVAS_IMAGE_ORIENT_NONE.

Since
  1.14

References EVAS_IMAGE_ORIENT_NONE.

## ◆ evas_object_image_scale_hint_set()

EVAS_API void evas_object_image_scale_hint_set | ( | Evas_Object * | obj,
|  | Evas_Image_Scale_Hint | hint
| ) |  |

Set the scale hint of a given image of the canvas.

This function sets the scale hint value of the given image object in the canvas, which will affect how Evas is to cache scaled versions of its original source image.

Parameters

  [in] | obj | The object
  [in] | hint | The scale hint, a value in Evas_Image_Scale_Hint.

## ◆ evas_object_image_scale_hint_get()

EVAS_API Evas_Image_Scale_Hint evas_object_image_scale_hint_get | ( | const Evas_Object * | obj | ) |

Get the scale hint of a given image of the canvas.

This function returns the scale hint value of the given image object of the canvas.

Parameters

  [in] | obj | The object

Returns
  The scale hint, a value in Evas_Image_Scale_Hint.

## ◆ evas_object_image_colorspace_set()

EVAS_API void evas_object_image_colorspace_set | ( | Evas_Object * | obj,
|  | Evas_Colorspace | cspace
| ) |  |

Set the colorspace of a given image of the canvas.

This function sets the colorspace of given canvas image.

Parameters

  [in] | obj | The object
  [in] | cspace | The new color space.

Referenced by ecore_evas_object_image_new().

## ◆ evas_object_image_colorspace_get()

EVAS_API Evas_Colorspace evas_object_image_colorspace_get | ( | const Evas_Object * | obj | ) |

Get the colorspace of a given image of the canvas.

This function returns the colorspace of given canvas image.

Parameters

  [in] | obj | The object

Returns
  The new color space.

## ◆ evas_object_image_stride_get()

EVAS_API int evas_object_image_stride_get | ( | const Evas_Object * | obj | ) |

Retrieves the row stride of the given image object.

The row stride is the number of bytes between the start of a row and the start of the next row for image data.

Parameters

  [in] | obj | The object

Returns
  The stride of the image (in bytes).

Referenced by ecore_evas_object_image_new().

## ◆ evas_object_image_data_copy_set()

EVAS_API void evas_object_image_data_copy_set | ( | Evas_Object * | obj,
|  | void * | data
| ) |  |

Replaces the raw image data of the given image object.

This function lets the application replace an image object's internal pixel buffer with a user-allocated one. For best results, you should generally first call evas_object_image_size_set with the width and height for the new buffer.

This call is best suited for when you will be using image data with different dimensions than the existing image data, if any. If you only need to modify the existing image in some fashion, then using evas_object_image_data_get is probably what you are after.

Note that the caller is responsible for freeing the buffer when finished with it, as user-set image data will not be automatically freed when the image object is deleted.

Parameters

  [in] | obj | The object
  [in] | data | The raw data to replace.

References EINA_TRUE.

## ◆ evas_object_image_data_set()

EVAS_API void evas_object_image_data_set | ( | Evas_Object * | obj,
|  | void * | data
| ) |  |

Sets the raw image data of the given image object.

Note that the raw data must be of the same size (see evas_object_image_size_set, which has to be called before this one) and colorspace (see evas_object_image_colorspace_set) of the image. If data is `null`, the current image data will be freed. Naturally, if one does not set an image object's data manually, it will still have one, allocated by Evas.

Parameters

  [in] | obj | The object
  [in] | data | The raw data, or `null`.

References EINA_FALSE, eina_hash_del(), eina_hash_find(), and EINA_TRUE.

Referenced by ecore_evas_object_image_new().

## ◆ evas_object_image_data_get()

EVAS_API void * evas_object_image_data_get | ( | const Evas_Object * | obj,
|  | Eina_Bool | for_writing
| ) |  |

Get a pointer to the raw image data of the given image object.

This function returns a pointer to an image object's internal pixel buffer, for reading only or read/write. If you request it for writing, the image will be marked dirty so that it gets redrawn at the next update.

Each time you call this function on an image object, its data buffer will have an internal reference counter incremented. Decrement it back by using evas_object_image_data_set.

This is best suited for when you want to modify an existing image, without changing its dimensions.

Note
  The contents' format returned by it depend on the color space of the given image object.
  You may want to use evas_object_image_data_update_add to inform data changes, if you did any.

Parameters

  [in] | obj | The object
  [in] | for_writing | Whether the data being retrieved will be modified ($true) or not ($false).

Returns
  The raw image data.

References eina_hash_add(), eina_hash_pointer_new(), and EINA_TRUE.

Referenced by ecore_evas_object_image_new().

## ◆ evas_module_task_cancelled()

EVAS_API Eina_Bool evas_module_task_cancelled | ( | void |  | ) |

Since
  1.19

References EINA_FALSE.