6 #define FNAME proxy_textblock_start
7 #define NAME "Proxy Textblock"
8 #define ICON "text.png"
21 static Evas_Object *o_texts[OBNUM];
23 //uncomment to test vs plain textblock render perf
27 static void _setup(void)
30 Evas_Object *o, *clip, *proxy;
32 for (i = 0; i < OBNUM; i++)
35 o = efl_add(EFL_CANVAS_TEXTBLOCK_CLASS, evas);
38 o = evas_object_textblock_add(evas);
43 efl_text_font_family_set(o, "Vera-Bold");
44 efl_text_font_size_set(o, 12);
46 efl_text_wrap_set(o, EFL_TEXT_FORMAT_WRAP_WORD);
47 efl_text_multiline_set(o, 1);
50 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do "
51 "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut "
52 "enim ad minim veniam, quis nostrud exercitation ullamco laboris "
53 "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "
54 "reprehenderit in voluptate velit esse cillum dolore eu fugiat "
55 "nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
56 "culpa qui officia deserunt mollit anim id est laborum."
58 efl_text_color_set(o, 0, 0, 0, 255);
60 Evas_Textblock_Style *style = evas_textblock_style_new();
61 evas_textblock_style_set(style, "DEFAULT='font_size=12 font=Vera-Bold color=#000'");
62 evas_object_textblock_style_set(o, style);
63 evas_object_textblock_text_markup_set(o,
64 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do "
65 "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut "
66 "enim ad minim veniam, quis nostrud exercitation ullamco laboris "
67 "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "
68 "reprehenderit in voluptate velit esse cillum dolore eu fugiat "
69 "nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
70 "culpa qui officia deserunt mollit anim id est laborum."
72 evas_textblock_style_free(style);
73 evas_object_color_set(o, 0, 0, 0, 255);
75 efl_gfx_entity_size_set(o, EINA_SIZE2D(480, 160));
76 efl_gfx_entity_visible_set(o, EINA_TRUE);
79 clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
81 efl_canvas_object_clipper_set(o, clip);
83 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 160));
85 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80));
87 efl_gfx_entity_visible_set(clip, EINA_TRUE);
88 efl_canvas_object_has_fixed_size_set(o, 1);
91 proxy = efl_add(EFL_CANVAS_PROXY_CLASS, evas);
93 efl_canvas_proxy_source_set(proxy, o);
94 efl_canvas_proxy_source_clip_set(proxy, EINA_FALSE);
95 /* only draw the lower half of the proxy object */
96 efl_gfx_fill_set(proxy, EINA_RECT(0, 80, 480, 80));
97 efl_gfx_entity_size_set(proxy, EINA_SIZE2D(480, 160));
99 efl_gfx_entity_visible_set(proxy, EINA_FALSE);
101 efl_gfx_entity_visible_set(proxy, EINA_TRUE);
105 /* restrict the sampling of the source text to the lower half */
106 clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
108 efl_canvas_object_clipper_set(proxy, clip);
109 efl_gfx_entity_size_set(clip, EINA_SIZE2D(480, 80));
111 efl_gfx_entity_visible_set(clip, EINA_FALSE);
113 efl_gfx_entity_visible_set(clip, EINA_TRUE);
114 efl_canvas_object_has_fixed_size_set(proxy, 1);
121 static void _cleanup(void)
124 for (i = 0; i < OBNUM; i++) efl_del(o_texts[i]);
127 /* loop - do things */
128 static void _loop(double t, int f)
132 Evas_Coord x, y, w, h;
133 for (i = 0; i < OBNUM; i++)
137 x = (win_w / 2) - (w / 2);
138 x += sin((double)(f + ((i + k) * 13)) / (36.7 * SLOW)) * (w / 2);
139 y = (win_h / 2) - (h / 2);
140 y += cos((double)(f + ((i + k) * 28)) / (43.8 * SLOW)) * (h / 2);
141 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
143 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
145 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y));
147 efl_gfx_entity_position_set(o_texts[i], EINA_POSITION2D(x, y + (h / 2)));
153 /* prepend special key handlers if interactive (before STD) */
154 static void _key(const char *key)
170 /* template stuff - ignore */
175 _ui_menu_item_add(ICON, NAME, FNAME);
187 ui_func_set(_key, _loop);