aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2018-01-16 14:16:23 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2018-01-16 18:03:23 +0900
commit62b3813ae4ef0531cc47507c2a32a502f021340f (patch)
treeb925914f29b0a7a66197812141fceb8c67d2577a
parentEfl.Gfx.color: move the common code to util file. (diff)
downloadefl-devs/ami/color.tar.gz
Efl.Gfx.Color_Class: move color_class_code{} to color_class intf.devs/ami/color
Ideally it should have belong to color_class interface from beginning.
-rw-r--r--src/lib/edje/edje_util.c25
-rw-r--r--src/lib/edje/efl_canvas_layout.eo1
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color.c43
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color.eo19
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color_class.eo19
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color_internal.c20
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color_internal.h3
7 files changed, 67 insertions, 63 deletions
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 258a7499b0..01f6f678a4 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -4,6 +4,8 @@
#include "../evas/canvas/evas_line.eo.h"
#include "../evas/canvas/evas_text.eo.h"
+#include "../efl/interfaces/efl_gfx_color_internal.h"
+
typedef struct _Edje_Box_Layout Edje_Box_Layout;
struct _Edje_Box_Layout
{
@@ -998,6 +1000,29 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_clear(Eo *obj EINA_UNUSED, Ed
}
}
+EOLIAN void
+_efl_canvas_layout_efl_gfx_color_class_color_class_code_set(Eo *obj, Edje *pd EINA_UNUSED, const char *color_class,
+ Efl_Gfx_Color_Class_Layer layer, const char *colorcode)
+{
+ int len;
+ unsigned char r, g, b, a;
+
+ len = _gfx_color_format_clean_param(colorcode);
+
+ _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
+ efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
+}
+
+EOLIAN const char *
+_efl_canvas_layout_efl_gfx_color_class_color_class_code_get(Eo *obj, Edje *pd EINA_UNUSED, const char *color_class,
+ Efl_Gfx_Color_Class_Layer layer)
+{
+ int r, g, b, a;
+
+ efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a);
+ return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
+}
+
typedef struct _Edje_File_Color_Class_Iterator Edje_File_Color_Class_Iterator;
struct _Edje_File_Color_Class_Iterator
{
diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo
index d50960a350..59002bdd9a 100644
--- a/src/lib/edje/efl_canvas_layout.eo
+++ b/src/lib/edje/efl_canvas_layout.eo
@@ -102,6 +102,7 @@ class Efl.Canvas.Layout (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part,
Efl.Gfx.Color_Class.color_class_description { get; }
Efl.Gfx.Color_Class.color_class_del;
Efl.Gfx.Color_Class.color_class_clear;
+ Efl.Gfx.Color_Class.color_class_code { get; set; }
Efl.Gfx.Text_Class.text_class { get; set; }
Efl.Gfx.Text_Class.text_class_del;
Efl.Gfx.Size_Class.size_class { get; set; }
diff --git a/src/lib/efl/interfaces/efl_gfx_color.c b/src/lib/efl/interfaces/efl_gfx_color.c
index ab679cdf41..f55309fae4 100644
--- a/src/lib/efl/interfaces/efl_gfx_color.c
+++ b/src/lib/efl/interfaces/efl_gfx_color.c
@@ -2,31 +2,13 @@
#include "Efl.h"
#include "efl_gfx_color_internal.h"
-static int
-_format_clean_param(Eina_Tmpstr *s)
-{
- Eina_Tmpstr *ss;
- char *ds;
- int len = 0;
-
- ds = (char*) s;
- for (ss = s; *ss; ss++, ds++, len++)
- {
- if ((*ss == '\\') && *(ss + 1)) ss++;
- if (ds != ss) *ds = *ss;
- }
- *ds = 0;
-
- return len;
-}
-
EOLIAN static void
_efl_gfx_color_color_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *colorcode)
{
int len;
unsigned char r, g, b, a;
- len = _format_clean_param(colorcode);
+ len = _gfx_color_format_clean_param(colorcode);
_gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
efl_gfx_color_set(obj, r, g, b, a);
@@ -41,27 +23,4 @@ _efl_gfx_color_color_code_get(Eo *obj, void *_pd EINA_UNUSED)
return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
}
-EOLIAN static void
-_efl_gfx_color_color_class_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *color_class,
- Efl_Gfx_Color_Class_Layer layer, const char *colorcode)
-{
- int len;
- unsigned char r, g, b, a;
-
- len = _format_clean_param(colorcode);
-
- _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
- efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
-}
-
-EOLIAN static const char *
-_efl_gfx_color_color_class_code_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
- const char *color_class, Efl_Gfx_Color_Class_Layer layer)
-{
- int r, g, b, a;
-
- efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a);
- return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
-}
-
#include "interfaces/efl_gfx_color.eo.c"
diff --git a/src/lib/efl/interfaces/efl_gfx_color.eo b/src/lib/efl/interfaces/efl_gfx_color.eo
index 61f5e76f1e..53206a8be1 100644
--- a/src/lib/efl/interfaces/efl_gfx_color.eo
+++ b/src/lib/efl/interfaces/efl_gfx_color.eo
@@ -60,24 +60,5 @@ mixin Efl.Gfx.Color
colorcode: string; [[the hex color code.]]
}
}
- @property color_class_code {
- set {
- [[Set the color class color of given Evas Object to the given hex color code(#RRGGBBAA).
- e.g. efl_gfx_color_class_code_set(obj, "color_class_name", layer, "#FFCCAACC");
- ]]
- }
- get {
- [[Get hex color class code of given Evas Object.
- This returns a short lived hex color class code string.
- ]]
- }
- keys {
- color_class: string; [[The name of color class]]
- layer: Efl.Gfx.Color_Class.Layer @optional; [[The layer to set the color]]
- }
- values {
- colorcode: string; [[the hex color code.]]
- }
- }
}
}
diff --git a/src/lib/efl/interfaces/efl_gfx_color_class.eo b/src/lib/efl/interfaces/efl_gfx_color_class.eo
index 23df735233..dee7e18989 100644
--- a/src/lib/efl/interfaces/efl_gfx_color_class.eo
+++ b/src/lib/efl/interfaces/efl_gfx_color_class.eo
@@ -82,5 +82,24 @@ interface Efl.Gfx.Color_Class
@since 1.17.0]]
}
+ @property color_class_code {
+ set {
+ [[Set the color class color of given Evas Object to the given hex color code(#RRGGBBAA).
+ e.g. efl_gfx_color_class_code_set(obj, "color_class_name", layer, "#FFCCAACC");
+ ]]
+ }
+ get {
+ [[Get hex color class code of given Evas Object.
+ This returns a short lived hex color class code string.
+ ]]
+ }
+ keys {
+ color_class: string; [[The name of color class]]
+ layer: Efl.Gfx.Color_Class.Layer @optional; [[The layer to set the color]]
+ }
+ values {
+ colorcode: string; [[the hex color code.]]
+ }
+ }
}
}
diff --git a/src/lib/efl/interfaces/efl_gfx_color_internal.c b/src/lib/efl/interfaces/efl_gfx_color_internal.c
index c877a95e63..4dc2b1abd3 100644
--- a/src/lib/efl/interfaces/efl_gfx_color_internal.c
+++ b/src/lib/efl/interfaces/efl_gfx_color_internal.c
@@ -1,5 +1,23 @@
#include "efl_gfx_color_internal.h"
+EAPI int
+_gfx_color_format_clean_param(Eina_Tmpstr *s)
+{
+ Eina_Tmpstr *ss;
+ char *ds;
+ int len = 0;
+
+ ds = (char*) s;
+ for (ss = s; *ss; ss++, ds++, len++)
+ {
+ if ((*ss == '\\') && *(ss + 1)) ss++;
+ if (ds != ss) *ds = *ss;
+ }
+ *ds = 0;
+
+ return len;
+}
+
static int
_hex_string_get(char ch, Eina_Bool *ok)
{
@@ -25,7 +43,7 @@ _hex_string_get(char ch, Eina_Bool *ok)
* @param[out] b The Blue value - NOT NULL.
* @param[out] a The Alpha value - NOT NULL.
*/
-Eina_Bool
+EAPI Eina_Bool
_gfx_color_format_color_parse(const char *str, int slen,
unsigned char *r, unsigned char *g,
unsigned char *b, unsigned char *a)
diff --git a/src/lib/efl/interfaces/efl_gfx_color_internal.h b/src/lib/efl/interfaces/efl_gfx_color_internal.h
index 076413cc5b..b1c077c7ed 100644
--- a/src/lib/efl/interfaces/efl_gfx_color_internal.h
+++ b/src/lib/efl/interfaces/efl_gfx_color_internal.h
@@ -3,6 +3,7 @@
#include <Eina.h>
-Eina_Bool _gfx_color_format_color_parse(const char *str, int slen, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a);
+EAPI int _gfx_color_format_clean_param(Eina_Tmpstr *s);
+EAPI Eina_Bool _gfx_color_format_color_parse(const char *str, int slen, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a);
#endif \ No newline at end of file