General Utilities

Some functions that are handy but are not specific of canvas or objects. More...

Functions

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

Detailed Description

Some functions that are handy but are not specific of canvas or objects.


Function Documentation

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

Pre-multiplies a rgb triplet by an alpha factor.

Parameters:
a The alpha factor.
r The Red component of the color.
g The Green component of the color.
b The Blue component of the color.

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

EAPI void evas_color_argb_unpremul ( int  a,
int *  r,
int *  g,
int *  b 
)

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

Parameters:
a The alpha factor.
r The Red component of the color.
g The Green component of the color.
b The Blue component of the color.

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

See also:
evas_color_argb_premul().
EAPI void evas_color_hsv_to_rgb ( float  h,
float  s,
float  v,
int *  r,
int *  g,
int *  b 
)

Convert a given color from HSV to RGB format.

Parameters:
h The Hue component of the color.
s The Saturation component of the color.
v The Value component of the color.
r The Red component of the color.
g The Green component of the color.
b The Blue component of the color.

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

EAPI void evas_color_rgb_to_hsv ( int  r,
int  g,
int  b,
float *  h,
float *  s,
float *  v 
)

Convert a given color from RGB to HSV format.

Parameters:
r The Red component of the color.
g The Green component of the color.
b The Blue component of the color.
h The Hue component of the color.
s The Saturation component of the color.
v The Value component of the color.

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

EAPI void evas_data_argb_premul ( unsigned int *  data,
unsigned int  len 
)

Pre-multiplies data by an alpha factor.

Parameters:
data The data value.
len The length value.

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

EAPI void evas_data_argb_unpremul ( unsigned int *  data,
unsigned int  len 
)

Undo pre-multiplication data by an alpha factor.

Parameters:
data The data value.
len The length value.

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

EAPI const char* evas_load_error_str ( Evas_Load_Error  error  ) 

Converts the given error code into a string describing it in english.

Parameters:
error the error code.
Returns:
Always return a valid string. If given error is not supported "Unknown error" is returned.

References EVAS_LOAD_ERROR_CORRUPT_FILE, EVAS_LOAD_ERROR_DOES_NOT_EXIST, EVAS_LOAD_ERROR_GENERIC, EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_PERMISSION_DENIED, EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED, and EVAS_LOAD_ERROR_UNKNOWN_FORMAT.

EAPI int evas_string_char_len_get ( const char *  str  ) 

Get the length in characters of the string.

Parameters:
str The string to get the length of.
Returns:
The length in characters (not bytes)
EAPI int evas_string_char_next_get ( const char *  str,
int  pos,
int *  decoded 
)

Gets the next character in the string.

Given the UTF-8 string in str, and starting byte position in pos, this function will place 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's not within the length of the string will result in undefined behavior.

Parameters:
str The UTF-8 string
pos The byte index where to start
decoded Address where to store the decoded code point. Optional.
Returns:
The byte index of the next character
EAPI int evas_string_char_prev_get ( const char *  str,
int  pos,
int *  decoded 
)

Gets the previous character in the string.

Given the UTF-8 string in str, and starting byte position in pos, this function will place 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's not within the length of the string will result in undefined behavior.

Parameters:
str The UTF-8 string
pos The byte index where to start
decoded Address where to store the decoded code point. Optional.
Returns:
The byte index of the previous character