forked from enlightenment/efl
edje_edit: Add edje_edit_state_map_point_color functions.
Summary: Add two main functions for working with map colors of part vertexes/points: - edje_edit_state_map_point_color_get - edje_edit_state_map_point_color_set @feature Reviewers: seoz, raster, cedric, Hermet CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1086
This commit is contained in:
parent
8b66dc0e7c
commit
2447bc3556
|
@ -3690,6 +3690,54 @@ edje_edit_state_map_rotation_center_get(Evas_Object *obj, const char *part, cons
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part);
|
edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part);
|
||||||
|
|
||||||
|
/** This sets the color for vertex/point of the current part.
|
||||||
|
* For more detailed information please @see evas_map_point_color_set().
|
||||||
|
*
|
||||||
|
* In edje there is (currently) only 4 main point:
|
||||||
|
* - Top-Left (0), Top-Right (1), Bottom-Right (2), Bottom-Left (3).
|
||||||
|
*
|
||||||
|
* Default value is 255 255 255 255 for every point.
|
||||||
|
*
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part The name of the part.
|
||||||
|
* @param state The name of the state (not including the state value).
|
||||||
|
* @param value The state value.
|
||||||
|
* @param idx The index of point.
|
||||||
|
* @param r The red value to set.
|
||||||
|
* @param g The green color value to set.
|
||||||
|
* @param b The blue color value to set.
|
||||||
|
* @param a The alpha color value to set.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE in case of success, EINA_FALSE otherwise.
|
||||||
|
* @since 1.11
|
||||||
|
**/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_map_point_color_set(Evas_Object *obj, const char *part, const char *state, double value, int idx, int r, int g, int b, int a);
|
||||||
|
|
||||||
|
/** This gets the color of given vertex/point of the current part.
|
||||||
|
* For more detailed information please @see evas_map_point_color_set().
|
||||||
|
*
|
||||||
|
* In edje there is (currently) only 4 main point:
|
||||||
|
* - Top-Left (0), Top-Right (1), Bottom-Right (2), Bottom-Left (3).
|
||||||
|
*
|
||||||
|
* Default value is 255 255 255 255 for every point.
|
||||||
|
*
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part The name of the part.
|
||||||
|
* @param state The name of the state (not including the state value).
|
||||||
|
* @param value The state value.
|
||||||
|
* @param idx The index of point.
|
||||||
|
* @param r The red value to get.
|
||||||
|
* @param g The green color value to get.
|
||||||
|
* @param b The blue color value to get.
|
||||||
|
* @param a The alpha color value to get.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE in case of success, EINA_FALSE otherwise.
|
||||||
|
* @since 1.11
|
||||||
|
**/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_map_point_color_get(Evas_Object *obj, const char *part, const char *state, double value, int idx, int *r, int *g, int *b, int *a);
|
||||||
|
|
||||||
/** Set the source part for given part state.
|
/** Set the source part for given part state.
|
||||||
*
|
*
|
||||||
* Set source causes the part to use another part content as the content
|
* Set source causes the part to use another part content as the content
|
||||||
|
|
|
@ -6203,6 +6203,88 @@ edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, cons
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_map_point_color_get(Evas_Object *obj, const char *part, const char *state, double value, int idx, int *r, int *g, int *b, int *a)
|
||||||
|
{
|
||||||
|
Edje_Map_Color *color = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if ((!obj) || (!part) || (!state))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
GET_PD_OR_RETURN(EINA_FALSE);
|
||||||
|
|
||||||
|
/* check if current color is exists and get it. */
|
||||||
|
for (i = 0; i < pd->map.colors_count; ++i)
|
||||||
|
{
|
||||||
|
if (pd->map.colors[i]->idx == idx)
|
||||||
|
{
|
||||||
|
color = pd->map.colors[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!color)
|
||||||
|
{
|
||||||
|
if (r) *r = 255;
|
||||||
|
if (g) *g = 255;
|
||||||
|
if (b) *b = 255;
|
||||||
|
if (a) *a = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (r) *r = color->r;
|
||||||
|
if (g) *g = color->g;
|
||||||
|
if (b) *b = color->b;
|
||||||
|
if (a) *a = color->a;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_map_point_color_set(Evas_Object *obj, const char *part, const char *state, double value, int idx, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
Edje_Map_Color *color = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if ((!obj) || (!part) || (!state))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
GET_PD_OR_RETURN(EINA_FALSE);
|
||||||
|
|
||||||
|
/* check if current color is exists and get it. */
|
||||||
|
for (i = 0; i < pd->map.colors_count; ++i)
|
||||||
|
{
|
||||||
|
if (pd->map.colors[i]->idx == idx)
|
||||||
|
{
|
||||||
|
color = pd->map.colors[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!color)
|
||||||
|
{
|
||||||
|
color = _alloc(sizeof(Edje_Map_Color));
|
||||||
|
pd->map.colors_count++;
|
||||||
|
pd->map.colors =
|
||||||
|
realloc(pd->map.colors,
|
||||||
|
sizeof(Edje_Map_Color*) * pd->map.colors_count);
|
||||||
|
pd->map.colors[pd->map.colors_count - 1] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
color->idx = idx;
|
||||||
|
if ((r > -1) && (r < 256)) color->r = r;
|
||||||
|
else return EINA_FALSE;
|
||||||
|
if ((g > -1) && (g < 256)) color->g = g;
|
||||||
|
else return EINA_FALSE;
|
||||||
|
if ((b > -1) && (b < 256)) color->b = b;
|
||||||
|
else return EINA_FALSE;
|
||||||
|
if ((a > -1) && (a < 256)) color->a = a;
|
||||||
|
else return EINA_FALSE;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* MAP API */
|
/* MAP API */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
Loading…
Reference in New Issue