Tizen Native API
3.0
|
Some functions that are handy but are not specific of canvas or objects.
Functions | |
const char * | evas_load_error_str (Evas_Load_Error error) |
void | evas_color_hsv_to_rgb (float h, float s, float v, int *r, int *g, int *b) |
void | evas_color_rgb_to_hsv (int r, int g, int b, float *h, float *s, float *v) |
void | evas_color_argb_premul (int a, int *r, int *g, int *b) |
void | evas_color_argb_unpremul (int a, int *r, int *g, int *b) |
void | evas_data_argb_premul (unsigned int *data, unsigned int len) |
void | evas_data_argb_unpremul (unsigned int *data, unsigned int len) |
int | evas_string_char_next_get (const char *str, int pos, int *decoded) |
int | evas_string_char_prev_get (const char *str, int pos, int *decoded) |
int | evas_string_char_len_get (const char *str) |
Evas_BiDi_Direction | evas_language_direction_get (void) |
void | evas_language_reinit (void) |
Function Documentation
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 rgb triplet by an alpha factor. Alpha factor is used to define transparency.
2.3
- Examples:
- evas-object-manipulation.c.
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().
2.3
- Examples:
- evas-object-manipulation.c.
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.
2.3
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.
2.3
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.
2.3
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.
2.3
Get language direction.
- Since:
- 1.18
void evas_language_reinit | ( | void | ) |
Reinitialize language from the environment.
The locale can change while a process is running. This call tells evas to reload the locale from the environment like it does on start.
- Since:
- 1.18
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.
- Parameters:
-
error the error code, a value in ::Evas_Load_Error.
- Returns:
- Always returns a valid string. If the given
error
is not supported,"Unknown error"
is returned.
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:
Example code:
d.img1 = evas_object_image_add(d.evas); evas_object_image_file_set(d.img1, valid_path, NULL); err = evas_object_image_load_error_get(d.img1); if (err != EVAS_LOAD_ERROR_NONE) { fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n", valid_path, evas_load_error_str(err)); } else { fprintf(stdout, "loaded image '%s' with succes! error string is \"%s\"\n", valid_path, evas_load_error_str(err)); evas_object_move(d.img1, 3, 3); evas_object_image_fill_set(d.img1, 0, 0, WIDTH / 2, HEIGHT / 2); evas_object_resize(d.img1, WIDTH / 2, HEIGHT / 2); evas_object_show(d.img1); evas_object_focus_set(d.bg, EINA_TRUE); evas_object_event_callback_add( d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); } /* this is a border around the image above, here just to emphasize * its geometry */ d.border = evas_object_image_filled_add(d.evas); evas_object_image_file_set(d.border, border_img_path, NULL); evas_object_image_border_set(d.border, 3, 3, 3, 3); evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); evas_object_move(d.border, 0, 0); evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); evas_object_show(d.border); /* image loading will fail for this one -- unless one cheats and * puts a valid image on that path */ d.img2 = evas_object_image_add(d.evas); evas_object_image_file_set(d.img2, bogus_path, NULL); err = evas_object_image_load_error_get(d.img2); if (err != EVAS_LOAD_ERROR_NONE) { fprintf(stderr, "could not load image '%s': error string is \"%s\"\n", bogus_path, evas_load_error_str(err)); } else { evas_object_move(d.img2, WIDTH / 2, HEIGHT / 2); evas_object_image_fill_set(d.img2, 0, 0, WIDTH / 2, HEIGHT / 2); evas_object_resize(d.img2, WIDTH / 2, HEIGHT / 2); evas_object_show(d.img2); } puts(commands); ecore_main_loop_begin();
Here, being valid_path
the path to a valid image and bogus_path
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. See the full example.
2.3
- Examples:
- evas-images.c.
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)
2.3
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
2.3
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
2.3