summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-03-25 11:54:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-03-25 11:56:29 +0900
commit26ba629f0028dbde90bdbb9dc581aa0005a90bd5 (patch)
tree27890c9d8212d96e17066b3b8f356049b861b32d
parentc3890ffeb1073af40a066975563bc26e2dd58866 (diff)
Fix previous commit's API usage and improve layout
Font effects now have "padding_set" which will fix the geometry of the text object. Thanks to Jaeun for preparing this work :)
-rw-r--r--src/bin/font_effect_blur_alpha.c23
-rw-r--r--src/bin/font_effect_blur_color.c15
2 files changed, 20 insertions, 18 deletions
diff --git a/src/bin/font_effect_blur_alpha.c b/src/bin/font_effect_blur_alpha.c
index 4b5f49d..8f812c9 100644
--- a/src/bin/font_effect_blur_alpha.c
+++ b/src/bin/font_effect_blur_alpha.c
@@ -16,29 +16,25 @@
16 16
17/* standard var */ 17/* standard var */
18static int done = 0; 18static int done = 0;
19extern int win_w, win_h;
19/* private data */ 20/* private data */
20static Evas_Object *bg;
21static Evas_Object *text; 21static Evas_Object *text;
22 22static const int MAX_BLUR = 100;
23extern int win_w, win_h;
24
25 23
26/* setup */ 24/* setup */
27static void _setup(void) 25static void _setup(void)
28{ 26{
29 27
30 Evas_Object *o; 28 Evas_Object *o;
31 o = evas_object_rectangle_add(evas); 29 int w,h;
32 evas_object_color_set(o, 0, 0, 0, 255);
33 evas_object_resize(o, win_w, win_h);
34 evas_object_show(o);
35 bg = o;
36 30
37 o = evas_object_text_add(evas); 31 o = evas_object_text_add(evas);
38 evas_object_color_set(o, 0, 0, 0, 255); 32 evas_object_color_set(o, 0, 0, 0, 255);
39 evas_object_text_font_set(o, "Vera-Bold", 80); 33 evas_object_text_font_set(o, "Vera-Bold", 80);
40 evas_object_text_text_set(o, "Font Effect"); 34 evas_object_text_text_set(o, "Font Effect");
41 evas_object_show(o); 35 evas_object_show(o);
36 evas_object_geometry_get(o, NULL, NULL, &w, &h);
37 evas_object_move(o, (win_w / 2) - (w / 2) - MAX_BLUR, (win_h / 2) - (h / 2) - MAX_BLUR);
42 text = o; 38 text = o;
43 39
44 done = 0; 40 done = 0;
@@ -47,17 +43,16 @@ static void _setup(void)
47/* cleanup */ 43/* cleanup */
48static void _cleanup(void) 44static void _cleanup(void)
49{ 45{
50 evas_object_del(bg);
51 evas_object_del(text); 46 evas_object_del(text);
52} 47}
53 48
54/* loop - do things */ 49/* loop - do things */
55static void _loop(double t, int f) 50static void _loop(double t, int f)
56{ 51{
57 char buf[128]; 52 char buf[256];
58 char *str = "blur(%d);"; 53 char *str = "padding_set(%d);blur(%d,color=black);";
59 sprintf(buf, str, ((f % 50) + 1)); 54 sprintf(buf, str, MAX_BLUR, ((f % MAX_BLUR) + 1));
60 evas_object_text_filter_program_set(text, buf); 55 eo_do(text, evas_obj_text_filter_program_set(buf));
61 56
62 FPS_STD(NAME); 57 FPS_STD(NAME);
63} 58}
diff --git a/src/bin/font_effect_blur_color.c b/src/bin/font_effect_blur_color.c
index d3c5cca..875f440 100644
--- a/src/bin/font_effect_blur_color.c
+++ b/src/bin/font_effect_blur_color.c
@@ -19,17 +19,24 @@ static int done = 0;
19/* private data */ 19/* private data */
20static Evas_Object *text; 20static Evas_Object *text;
21 21
22extern int win_w, win_h;
23static const int MAX_BLUR = 100;
24
22 25
23/* setup */ 26/* setup */
24static void _setup(void) 27static void _setup(void)
25{ 28{
26 29
27 Evas_Object *o; 30 Evas_Object *o;
31 int w, h;
32
28 o = evas_object_text_add(evas); 33 o = evas_object_text_add(evas);
29 evas_object_color_set(o, 0, 0, 0, 255); 34 evas_object_color_set(o, 0, 0, 0, 255);
30 evas_object_text_font_set(o, "Vera-Bold", 80); 35 evas_object_text_font_set(o, "Vera-Bold", 80);
31 evas_object_text_text_set(o, "Font Effect"); 36 evas_object_text_text_set(o, "Font Effect");
32 evas_object_show(o); 37 evas_object_show(o);
38 evas_object_geometry_get(o, NULL, NULL, &w, &h);
39 evas_object_move(o, (win_w / 2) - (w / 2) - MAX_BLUR, (win_h / 2) - (h / 2) - MAX_BLUR);
33 text = o; 40 text = o;
34 41
35 done = 0; 42 done = 0;
@@ -44,10 +51,10 @@ static void _cleanup(void)
44/* loop - do things */ 51/* loop - do things */
45static void _loop(double t, int f) 52static void _loop(double t, int f)
46{ 53{
47 char buf[128]; 54 char buf[256];
48 char *str = "buffer:a(rgba);blend(dst=a, color=blue);blur(%d, src=a);"; 55 char *str = "buffer:a(rgba);padding_set(%d);blend(dst=a,color=darkblue);blur(%d,src=a);";
49 sprintf(buf, str, ((f % 50) + 1)); 56 sprintf(buf, str, MAX_BLUR, ((f % MAX_BLUR) + 1));
50 evas_object_text_filter_program_set(text, buf); 57 eo_do(text, evas_obj_text_filter_program_set(buf));
51 58
52 FPS_STD(NAME); 59 FPS_STD(NAME);
53} 60}