summaryrefslogtreecommitdiff
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
parentd18de6b1b8c3b5832024278df4ad3c594ad2f6af (diff)
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 @@
4#include "../evas/canvas/evas_line.eo.h" 4#include "../evas/canvas/evas_line.eo.h"
5#include "../evas/canvas/evas_text.eo.h" 5#include "../evas/canvas/evas_text.eo.h"
6 6
7#include "../efl/interfaces/efl_gfx_color_internal.h"
8
7typedef struct _Edje_Box_Layout Edje_Box_Layout; 9typedef struct _Edje_Box_Layout Edje_Box_Layout;
8struct _Edje_Box_Layout 10struct _Edje_Box_Layout
9{ 11{
@@ -998,6 +1000,29 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_clear(Eo *obj EINA_UNUSED, Ed
998 } 1000 }
999} 1001}
1000 1002
1003EOLIAN void
1004_efl_canvas_layout_efl_gfx_color_class_color_class_code_set(Eo *obj, Edje *pd EINA_UNUSED, const char *color_class,
1005 Efl_Gfx_Color_Class_Layer layer, const char *colorcode)
1006{
1007 int len;
1008 unsigned char r, g, b, a;
1009
1010 len = _gfx_color_format_clean_param(colorcode);
1011
1012 _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
1013 efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
1014}
1015
1016EOLIAN const char *
1017_efl_canvas_layout_efl_gfx_color_class_color_class_code_get(Eo *obj, Edje *pd EINA_UNUSED, const char *color_class,
1018 Efl_Gfx_Color_Class_Layer layer)
1019{
1020 int r, g, b, a;
1021
1022 efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a);
1023 return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
1024}
1025
1001typedef struct _Edje_File_Color_Class_Iterator Edje_File_Color_Class_Iterator; 1026typedef struct _Edje_File_Color_Class_Iterator Edje_File_Color_Class_Iterator;
1002struct _Edje_File_Color_Class_Iterator 1027struct _Edje_File_Color_Class_Iterator
1003{ 1028{
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,
102 Efl.Gfx.Color_Class.color_class_description { get; } 102 Efl.Gfx.Color_Class.color_class_description { get; }
103 Efl.Gfx.Color_Class.color_class_del; 103 Efl.Gfx.Color_Class.color_class_del;
104 Efl.Gfx.Color_Class.color_class_clear; 104 Efl.Gfx.Color_Class.color_class_clear;
105 Efl.Gfx.Color_Class.color_class_code { get; set; }
105 Efl.Gfx.Text_Class.text_class { get; set; } 106 Efl.Gfx.Text_Class.text_class { get; set; }
106 Efl.Gfx.Text_Class.text_class_del; 107 Efl.Gfx.Text_Class.text_class_del;
107 Efl.Gfx.Size_Class.size_class { get; set; } 108 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 @@
2#include "Efl.h" 2#include "Efl.h"
3#include "efl_gfx_color_internal.h" 3#include "efl_gfx_color_internal.h"
4 4
5static int
6_format_clean_param(Eina_Tmpstr *s)
7{
8 Eina_Tmpstr *ss;
9 char *ds;
10 int len = 0;
11
12 ds = (char*) s;
13 for (ss = s; *ss; ss++, ds++, len++)
14 {
15 if ((*ss == '\\') && *(ss + 1)) ss++;
16 if (ds != ss) *ds = *ss;
17 }
18 *ds = 0;
19
20 return len;
21}
22
23EOLIAN static void 5EOLIAN static void
24_efl_gfx_color_color_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *colorcode) 6_efl_gfx_color_color_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *colorcode)
25{ 7{
26 int len; 8 int len;
27 unsigned char r, g, b, a; 9 unsigned char r, g, b, a;
28 10
29 len = _format_clean_param(colorcode); 11 len = _gfx_color_format_clean_param(colorcode);
30 12
31 _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a); 13 _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
32 efl_gfx_color_set(obj, r, g, b, a); 14 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)
41 return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a); 23 return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
42} 24}
43 25
44EOLIAN static void
45_efl_gfx_color_color_class_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *color_class,
46 Efl_Gfx_Color_Class_Layer layer, const char *colorcode)
47{
48 int len;
49 unsigned char r, g, b, a;
50
51 len = _format_clean_param(colorcode);
52
53 _gfx_color_format_color_parse(colorcode, len, &r, &g, &b, &a);
54 efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
55}
56
57EOLIAN static const char *
58_efl_gfx_color_color_class_code_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
59 const char *color_class, Efl_Gfx_Color_Class_Layer layer)
60{
61 int r, g, b, a;
62
63 efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a);
64 return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
65}
66
67#include "interfaces/efl_gfx_color.eo.c" 26#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
60 colorcode: string; [[the hex color code.]] 60 colorcode: string; [[the hex color code.]]
61 } 61 }
62 } 62 }
63 @property color_class_code {
64 set {
65 [[Set the color class color of given Evas Object to the given hex color code(#RRGGBBAA).
66 e.g. efl_gfx_color_class_code_set(obj, "color_class_name", layer, "#FFCCAACC");
67 ]]
68 }
69 get {
70 [[Get hex color class code of given Evas Object.
71 This returns a short lived hex color class code string.
72 ]]
73 }
74 keys {
75 color_class: string; [[The name of color class]]
76 layer: Efl.Gfx.Color_Class.Layer @optional; [[The layer to set the color]]
77 }
78 values {
79 colorcode: string; [[the hex color code.]]
80 }
81 }
82 } 63 }
83} 64}
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
82 82
83 @since 1.17.0]] 83 @since 1.17.0]]
84 } 84 }
85 @property color_class_code {
86 set {
87 [[Set the color class color of given Evas Object to the given hex color code(#RRGGBBAA).
88 e.g. efl_gfx_color_class_code_set(obj, "color_class_name", layer, "#FFCCAACC");
89 ]]
90 }
91 get {
92 [[Get hex color class code of given Evas Object.
93 This returns a short lived hex color class code string.
94 ]]
95 }
96 keys {
97 color_class: string; [[The name of color class]]
98 layer: Efl.Gfx.Color_Class.Layer @optional; [[The layer to set the color]]
99 }
100 values {
101 colorcode: string; [[the hex color code.]]
102 }
103 }
85 } 104 }
86} 105}
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 @@
1#include "efl_gfx_color_internal.h" 1#include "efl_gfx_color_internal.h"
2 2
3EAPI int
4_gfx_color_format_clean_param(Eina_Tmpstr *s)
5{
6 Eina_Tmpstr *ss;
7 char *ds;
8 int len = 0;
9
10 ds = (char*) s;
11 for (ss = s; *ss; ss++, ds++, len++)
12 {
13 if ((*ss == '\\') && *(ss + 1)) ss++;
14 if (ds != ss) *ds = *ss;
15 }
16 *ds = 0;
17
18 return len;
19}
20
3static int 21static int
4_hex_string_get(char ch, Eina_Bool *ok) 22_hex_string_get(char ch, Eina_Bool *ok)
5{ 23{
@@ -25,7 +43,7 @@ _hex_string_get(char ch, Eina_Bool *ok)
25 * @param[out] b The Blue value - NOT NULL. 43 * @param[out] b The Blue value - NOT NULL.
26 * @param[out] a The Alpha value - NOT NULL. 44 * @param[out] a The Alpha value - NOT NULL.
27 */ 45 */
28Eina_Bool 46EAPI Eina_Bool
29_gfx_color_format_color_parse(const char *str, int slen, 47_gfx_color_format_color_parse(const char *str, int slen,
30 unsigned char *r, unsigned char *g, 48 unsigned char *r, unsigned char *g,
31 unsigned char *b, unsigned char *a) 49 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 @@
3 3
4#include <Eina.h> 4#include <Eina.h>
5 5
6Eina_Bool _gfx_color_format_color_parse(const char *str, int slen, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a); 6EAPI int _gfx_color_format_clean_param(Eina_Tmpstr *s);
7EAPI Eina_Bool _gfx_color_format_color_parse(const char *str, int slen, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a);
7 8
8#endif \ No newline at end of file 9#endif \ No newline at end of file