Tizen Native API
General Utilities

This group provides general utilities functions.

Remarks:
Some functions that are handy but are not specific to canvas or objects.

Functions

const char * evas_load_error_str (Evas_Load_Error error)
 Converts the given Evas image load error code into a string describing it in English.
void evas_color_hsv_to_rgb (float h, float s, float v, int *r, int *g, int *b)
 Converts a given color from HSV to RGB format.
void evas_color_rgb_to_hsv (int r, int g, int b, float *h, float *s, float *v)
 Converts a given color from RGB to HSV format.
void evas_color_argb_premul (int a, int *r, int *g, int *b)
 Pre-multiplies a rgb triplet by an alpha factor.
void evas_color_argb_unpremul (int a, int *r, int *g, int *b)
 Undoes pre-multiplication of a rgb triplet by an alpha factor.
void evas_data_argb_premul (unsigned int *data, unsigned int len)
 Pre-multiplies data by an alpha factor.
void evas_data_argb_unpremul (unsigned int *data, unsigned int len)
 Undoes pre-multiplication data by an alpha factor.
int evas_string_char_next_get (const char *str, int pos, int *decoded)
 Gets the next character in the string.
int evas_string_char_prev_get (const char *str, int pos, int *decoded)
 Gets the previous character in the string.
int evas_string_char_len_get (const char *str)
 Gets the length in characters of the string.

Function Documentation

void evas_color_argb_premul ( int  a,
int *  r,
int *  g,
int *  b 
)

Pre-multiplies a rgb triplet by an alpha factor.

This function pre-multiplies a given rgb triplet by an alpha factor. Alpha factor is used to define transparency.

Since :
2.3.1
Parameters:
[in]aThe alpha factor
[out]rThe Red component of the color
[out]gThe Green component of the color
[out]bThe Blue component of the color
void evas_color_argb_unpremul ( int  a,
int *  r,
int *  g,
int *  b 
)

Undoes pre-multiplication of a rgb triplet by an alpha factor.

This function undoes pre-multiplication a given rbg triplet by an alpha factor. Alpha factor is used to define transparency.

Since :
2.3.1
Parameters:
[in]aThe alpha factor
[out]rThe Red component of the color
[out]gThe Green component of the color
[out]bThe Blue component of the color
See also:
evas_color_argb_premul().
void evas_color_hsv_to_rgb ( float  h,
float  s,
float  v,
int *  r,
int *  g,
int *  b 
)

Converts a given color from HSV to RGB format.

This function converts a given color in HSV color format to RGB color format.

Since :
2.3.1
Parameters:
[in]hThe Hue component of the color
[in]sThe Saturation component of the color
[in]vThe Value component of the color
[out]rThe Red component of the color
[out]gThe Green component of the color
[out]bThe Blue component of the color
void evas_color_rgb_to_hsv ( int  r,
int  g,
int  b,
float *  h,
float *  s,
float *  v 
)

Converts a given color from RGB to HSV format.

This function converts a given color in RGB color format to HSV color format.

Since :
2.3.1
Parameters:
[in]rThe Red component of the color
[in]gThe Green component of the color
[in]bThe Blue component of the color
[out]hThe Hue component of the color
[out]sThe Saturation component of the color
[out]vThe Value component of the color
void evas_data_argb_premul ( unsigned int *  data,
unsigned int  len 
)

Pre-multiplies data by an alpha factor.

This function pre-multiplies a given data by an alpha factor. Alpha factor is used to define transparency.

Since :
2.3.1
Parameters:
[in]dataThe data value
[in]lenThe length value
void evas_data_argb_unpremul ( unsigned int *  data,
unsigned int  len 
)

Undoes pre-multiplication data by an alpha factor.

This function undoes the pre-multiplication of a given data by an alpha factor. Alpha factor is used to define transparency.

Since :
2.3.1
Parameters:
[in]dataThe data value
[in]lenThe length value
const char* evas_load_error_str ( Evas_Load_Error  error)

Converts the given Evas image load error code into a string describing it in English.

Since :
2.3.1
Remarks:
Mostly evas_object_image_file_set() would be the function setting that error value afterwards, but also evas_object_image_load(), evas_object_image_save(), evas_object_image_data_get(), evas_object_image_data_convert(), evas_object_image_pixels_import() and evas_object_image_is_inside(). This function is meant to be used in conjunction with evas_object_image_load_error_get(), as in:
The following is an example code:
Here, valid_path is the path to a valid image and bogus_path is a path to a file which does not exist. The two outputs of evas_load_error_str() would be (if no other errors occur): "No error on load" and "File (or file path) does not exist", respectively.
Parameters:
[in]errorThe error code
A value in Evas_Load_Error.
Returns:
A valid string
If the given error is not supported, "Unknown error" is returned.
int evas_string_char_len_get ( const char *  str)

Gets the length in characters of the string.

Since :
2.3.1
Parameters:
[in]strThe string to get the length of
Returns:
The length in characters (not bytes)
int evas_string_char_next_get ( const char *  str,
int  pos,
int *  decoded 
)

Gets the next character in the string.

Remarks:
Given the UTF-8 string in str, and starting byte position in pos, this function places in decoded the decoded code point at pos and return the byte index for the next character in the string. The only boundary check done is that pos must be >= 0. Other than that, no checks are performed, so passing an index value that is not within the length of the string results in undefined behavior.
Since :
2.3.1
Parameters:
[in]strThe UTF-8 string
[in]posThe byte index where to start
[out]decodedThe address to store the decoded code point
This is optional.
Returns:
The byte index of the next character
int evas_string_char_prev_get ( const char *  str,
int  pos,
int *  decoded 
)

Gets the previous character in the string.

Since :
2.3.1
Remarks:
Given the UTF-8 string in str, and starting byte position in pos, this function places in decoded the decoded code point at pos and return the byte index for the previous character in the string.
The only boundary check done is that pos must be >= 1. Other than that, no checks are performed, so passing an index value that is not within the length of the string results in undefined behavior.
Parameters:
[in]strThe UTF-8 string
[in]posThe byte index where to start
[out]decodedThe address where to store the decoded code point
This is optional.
Returns:
The byte index of the previous character