raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2447bc35566d48d8a6c959ab065ea5f567fa4cee

commit 2447bc35566d48d8a6c959ab065ea5f567fa4cee
Author: Vorobiov Vitalii <vi.vorob...@samsung.com>
Date:   Thu Jul 3 17:27:52 2014 +0900

    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
---
 src/lib/edje/Edje_Edit.h | 48 ++++++++++++++++++++++++++++
 src/lib/edje/edje_edit.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+)

diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 39058d6..0214b3a 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -3690,6 +3690,54 @@ edje_edit_state_map_rotation_center_get(Evas_Object 
*obj, const char *part, cons
 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);
 
+/** 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 source causes the part to use another part content as the content
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 8f4e526..a701749 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -6203,6 +6203,88 @@ edje_edit_state_map_rotation_center_set(Evas_Object 
*obj, const char *part, cons
    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 */
 /**************/

-- 


Reply via email to