summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2015-02-07 00:22:05 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-02-07 00:22:05 +0900
commit1d4e86af0c5e080027308ef02dc801f08d60f3ec (patch)
treec664fe512ee688a1409b4beb05bfb1acd3974d1b
parente02c0a6fd0bd9ced52b2af6948887d6f86dad267 (diff)
devs/hermet: remove unnecessary file
-rw-r--r--test.c686
1 files changed, 0 insertions, 686 deletions
diff --git a/test.c b/test.c
deleted file mode 100644
index e25cf82..0000000
--- a/test.c
+++ /dev/null
@@ -1,686 +0,0 @@
1#define EFL_BETA_API_SUPPORT 1
2#define EFL_EO_API_SUPPORT 1
3
4#include <Eo.h>
5#include <Efl.h>
6#include <Elementary.h>
7
8
9#include <math.h>
10#include <Eina.h>
11
12#define PATH_KAPPA 0.5522847498
13#define PI 3.1415926535
14
15typedef struct _Bezier
16{
17float x1, y1, x2, y2, x3, y3, x4, y4;
18}Bezier;
19
20typedef struct _Point
21{
22 int x;
23 int y;
24}Point;
25
26static
27Bezier bezierFromPoints(Point p1, Point p2,
28 Point p3, Point p4)
29{
30 Bezier b;
31 b.x1 = p1.x;
32 b.y1 = p1.y;
33 b.x2 = p2.x;
34 b.y2 = p2.y;
35 b.x3 = p3.x;
36 b.y3 = p3.y;
37 b.x4 = p4.x;
38 b.y4 = p4.y;
39 return b;
40}
41
42inline void
43parameterSplitLeft(Bezier *b, float t, Bezier *left)
44{
45 left->x1 = b->x1;
46 left->y1 = b->y1;
47
48 left->x2 = b->x1 + t * ( b->x2 - b->x1 );
49 left->y2 = b->y1 + t * ( b->y2 - b->y1 );
50
51 left->x3 = b->x2 + t * ( b->x3 - b->x2 ); // temporary holding spot
52 left->y3 = b->y2 + t * ( b->y3 - b->y2 ); // temporary holding spot
53
54 b->x3 = b->x3 + t * ( b->x4 - b->x3 );
55 b->y3 = b->y3 + t * ( b->y4 - b->y3 );
56
57 b->x2 = left->x3 + t * ( b->x3 - left->x3);
58 b->y2 = left->y3 + t * ( b->y3 - left->y3);
59
60 left->x3 = left->x2 + t * ( left->x3 - left->x2 );
61 left->y3 = left->y2 + t * ( left->y3 - left->y2 );
62
63 left->x4 = b->x1 = left->x3 + t * (b->x2 - left->x3);
64 left->y4 = b->y1 = left->y3 + t * (b->y2 - left->y3);
65}
66static
67Bezier bezierOnInterval(Bezier *b, float t0, float t1)
68{
69 if (t0 == 0 && t1 == 1)
70 return *b;
71
72 Bezier result;
73 parameterSplitLeft(b, t0, &result);
74 float trueT = (t1-t0)/(1-t0);
75 parameterSplitLeft(b, trueT, &result);
76
77 return result;
78}
79
80inline void
81_bezier_coefficients(float t, float *ap, float *bp, float *cp, float *dp)
82{
83 float a,b,c,d;
84 float m_t = 1. - t;
85 b = m_t * m_t;
86 c = t * t;
87 d = c * t;
88 a = b * m_t;
89 b *= 3. * t;
90 c *= 3. * m_t;
91 *ap = a;
92 *bp = b;
93 *cp = c;
94 *dp = d;
95}
96
97static
98float _t_for_arc_angle(float angle)
99{
100 if (angle < 0.00001)
101 return 0;
102
103 if (angle == 90.0)
104 return 1;
105
106 float radians = PI * angle / 180;
107 float cosAngle = cos(radians);
108 float sinAngle = sin(radians);
109
110 // initial guess
111 float tc = angle / 90;
112 // do some iterations of newton's method to approximate cosAngle
113 // finds the zero of the function b.pointAt(tc).x() - cosAngle
114 tc -= ((((2-3*PATH_KAPPA) * tc + 3*(PATH_KAPPA-1)) * tc) * tc + 1 - cosAngle) // value
115 / (((6-9*PATH_KAPPA) * tc + 6*(PATH_KAPPA-1)) * tc); // derivative
116 tc -= ((((2-3*PATH_KAPPA) * tc + 3*(PATH_KAPPA-1)) * tc) * tc + 1 - cosAngle) // value
117 / (((6-9*PATH_KAPPA) * tc + 6*(PATH_KAPPA-1)) * tc); // derivative
118
119 // initial guess
120 float ts = tc;
121 // do some iterations of newton's method to approximate sinAngle
122 // finds the zero of the function b.pointAt(tc).y() - sinAngle
123 ts -= ((((3*PATH_KAPPA-2) * ts - 6*PATH_KAPPA + 3) * ts + 3*PATH_KAPPA) * ts - sinAngle)
124 / (((9*PATH_KAPPA-6) * ts + 12*PATH_KAPPA - 6) * ts + 3*PATH_KAPPA);
125 ts -= ((((3*PATH_KAPPA-2) * ts - 6*PATH_KAPPA + 3) * ts + 3*PATH_KAPPA) * ts - sinAngle)
126 / (((9*PATH_KAPPA-6) * ts + 12*PATH_KAPPA - 6) * ts + 3*PATH_KAPPA);
127
128 // use the average of the t that best approximates cosAngle
129 // and the t that best approximates sinAngle
130 float t = 0.5 * (tc + ts);
131 return t;
132}
133
134static void
135_find_ellipse_coords(int x, int y, int w, int h, float angle, float length,
136 Point* startPoint, Point *endPoint)
137{
138 if (!w || !h ) {
139 if (startPoint)
140 startPoint->x = 0 , startPoint->y = 0;
141 if (endPoint)
142 endPoint->x = 0 , endPoint->y = 0;
143 return;
144 }
145
146 int w2 = w / 2;
147 int h2 = h / 2;
148
149 float angles[2] = { angle, angle + length };
150 Point *points[2] = { startPoint, endPoint };
151 int i =0;
152 for (i = 0; i < 2; ++i) {
153 if (!points[i])
154 continue;
155
156 float theta = angles[i] - 360 * floor(angles[i] / 360);
157 float t = theta / 90;
158 // truncate
159 int quadrant = (int)t;
160 t -= quadrant;
161
162 t = _t_for_arc_angle(90 * t);
163
164 // swap x and y?
165 if (quadrant & 1)
166 t = 1 - t;
167
168 float a, b, c, d;
169 _bezier_coefficients(t, &a, &b, &c, &d);
170 float px = a + b + c*PATH_KAPPA;
171 float py = d + c + b*PATH_KAPPA;
172
173 // left quadrants
174 if (quadrant == 1 || quadrant == 2)
175 px = -px;
176
177 // top quadrants
178 if (quadrant == 0 || quadrant == 1)
179 py = -py;
180 int cx = x+w/2;
181 int cy = y+h/2;
182 points[i]->x = cx + w2 * px;
183 points[i]->y = cy + h2 * py;
184 }
185}
186
187
188//// The return value is the starting point of the arc
189static
190Point _curves_for_arc(int x, int y, int w, int h,
191 float startAngle, float sweepLength,
192 Point *curves, int *point_count)
193{
194 *point_count = 0;
195 int w2 = w / 2;
196 int w2k = w2 * PATH_KAPPA;
197
198 int h2 = h / 2;
199 int h2k = h2 * PATH_KAPPA;
200
201 Point points[16] =
202 {
203 // start point
204 x + w, y + h2,
205
206 // 0 -> 270 degrees
207 x + w, y + h2 + h2k,
208 x + w2 + w2k, y + h,
209 x + w2, y + h,
210
211 // 270 -> 180 degrees
212 x + w2 - w2k, y + h,
213 x, y + h2 + h2k,
214 x, y + h2,
215
216 // 180 -> 90 degrees
217 x, y + h2 - h2k,
218 x + w2 - w2k, y,
219 x + w2, y,
220
221 // 90 -> 0 degrees
222 x + w2 + w2k, y,
223 x + w, y + h2 - h2k,
224 x + w, y + h2
225 };
226
227 if (sweepLength > 360) sweepLength = 360;
228 else if (sweepLength < -360) sweepLength = -360;
229
230 int i;
231 // Special case fast paths
232 if (startAngle == 0) {
233 if (sweepLength == 360) {
234 for (i = 11; i >= 0; --i)
235 curves[(*point_count)++] = points[i];
236 return points[12];
237 } else if (sweepLength == -360) {
238 for (i = 1; i <= 12; ++i)
239 curves[(*point_count)++] = points[i];
240 return points[0];
241 }
242 }
243
244 int startSegment = (int)(floor(startAngle / 90));
245 int endSegment = (int)(floor((startAngle + sweepLength) / 90));
246
247 float startT = (startAngle - startSegment * 90) / 90;
248 float endT = (startAngle + sweepLength - endSegment * 90) / 90;
249
250 int delta = sweepLength > 0 ? 1 : -1;
251 if (delta < 0) {
252 startT = 1 - startT;
253 endT = 1 - endT;
254 }
255
256 // avoid empty start segment
257 if (startT == 1.0) {
258 startT = 0;
259 startSegment += delta;
260 }
261
262 // avoid empty end segment
263 if (endT == 0) {
264 endT = 1;
265 endSegment -= delta;
266 }
267
268 startT = _t_for_arc_angle(startT * 90);
269 endT = _t_for_arc_angle(endT * 90);
270
271 Eina_Bool splitAtStart = !(fabs(startT) <= 0.00001f);
272 Eina_Bool splitAtEnd = !(fabs(endT - 1.0) <= 0.00001f);
273
274 const int end = endSegment + delta;
275
276 // empty arc?
277 if (startSegment == end) {
278 const int quadrant = 3 - ((startSegment % 4) + 4) % 4;
279 const int j = 3 * quadrant;
280 return delta > 0 ? points[j + 3] : points[j];
281 }
282
283
284 Point startPoint, endPoint;
285 _find_ellipse_coords(x, y, w, h, startAngle, sweepLength, &startPoint, &endPoint);
286
287 for (i = startSegment; i != end; i += delta) {
288 const int quadrant = 3 - ((i % 4) + 4) % 4;
289 const int j = 3 * quadrant;
290
291 Bezier b;
292 if (delta > 0)
293 b = bezierFromPoints(points[j + 3], points[j + 2], points[j + 1], points[j]);
294 else
295 b = bezierFromPoints(points[j], points[j + 1], points[j + 2], points[j + 3]);
296
297 // empty arc?
298 if (startSegment == endSegment && (startT == endT))
299 return startPoint;
300
301 if (i == startSegment) {
302 if (i == endSegment && splitAtEnd)
303 b = bezierOnInterval(&b, startT, endT);
304 else if (splitAtStart)
305 b = bezierOnInterval(&b, startT, 1);
306 } else if (i == endSegment && splitAtEnd) {
307 b = bezierOnInterval(&b, 0, endT);
308 }
309
310 // push control points
311 curves[(*point_count)].x = b.x2;
312 curves[(*point_count)++].y = b.y2;
313 curves[(*point_count)].x = b.x3;
314 curves[(*point_count)++].y = b.y3;
315 curves[(*point_count)].x = b.x4;
316 curves[(*point_count)++].y = b.y4;
317 }
318
319 curves[*(point_count)-1] = endPoint;
320
321 return startPoint;
322}
323
324void _arcto(Efl_Graphics_Path_Command **path_cmd, double **points,int x, int y, int width, int height, int startAngle, int sweepLength)
325{
326 int point_count;
327
328 Point pts[15];
329 Point curve_start = _curves_for_arc(x,y,width,height, startAngle, sweepLength, pts, &point_count);
330 int cx = x + (width)/2;
331 int cy = y + (height)/2;
332
333 efl_graphics_path_append_move_to(path_cmd, points, cx, cy);
334
335 efl_graphics_path_append_line_to(path_cmd, points, curve_start.x, curve_start.y);
336 int i;
337 for (i=0; i<point_count; i+=3) {
338 efl_graphics_path_append_cubic_to(path_cmd, points,
339 pts[i+2].x, pts[i+2].y,
340 pts[i].x, pts[i].y,
341 pts[i+1].x, pts[i+1].y);
342 }
343 efl_graphics_path_append_line_to(path_cmd, points, cx, cy);
344}
345
346
347static void
348third_effect_custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
349{
350 Efl_Graphics_Path_Command *path_cmd = NULL;
351 double *points = NULL;
352 _arcto(&path_cmd, &points, 0, 100, 480, 650, 0, 270 * progress);
353
354 Evas_VG_Shape *shape = effect;
355
356 eo_do(shape,
357 efl_graphics_shape_stroke_width_set(1.0),
358 efl_graphics_shape_path_set(path_cmd, points));
359}
360
361static void
362btn_clicked_cb2(void *data, Evas_Object *obj, void *event_info)
363{
364 Evas_Object *nf = data;
365 Evas_Object *vg = elm_object_content_get(nf);
366 evas_object_hide(vg);
367
368 Efl_Graphics_Path_Command *path_cmd = NULL;
369 double *points = NULL;
370 _arcto(&path_cmd, &points, 0, 100, 480, 650, 0, 270);
371
372 //Second Vector Test
373 vg = evas_object_vg_add(evas_object_evas_get(nf));
374 evas_object_resize(vg, 480, 800);
375 evas_object_show(vg);
376
377 Evas_VG_Root_Node *root = evas_object_vg_root_node_get(vg);
378 Evas_VG_Shape *shape = eo_add(EVAS_VG_SHAPE_CLASS, root);
379 Evas_VG_Gradient_Linear *gradient = eo_add(EVAS_VG_GRADIENT_CLASS, root);
380
381Efl_Graphics_Gradient_Stop stops[3];
382 stops[0].r = 255;
383 stops[0].g = 0;
384 stops[0].b = 0;
385 stops[0].a = 255;
386 stops[0].offset = 0;
387 stops[1].r = 0;
388 stops[1].g = 255;
389 stops[1].b = 0;
390 stops[1].a = 255;
391 stops[1].offset = 0.5;
392 stops[2].r = 0;
393 stops[2].g = 0;
394 stops[2].b = 255;
395 stops[2].a = 255;
396 stops[2].offset = 1;
397
398 eo_do(gradient, efl_graphics_gradient_stop_set(stops, 3));
399 eo_do(gradient, efl_graphics_gradient_spread_set(EFL_GRAPHICS_GRADIENT_SPREAD_REFLECT));
400 eo_do(gradient, efl_graphics_gradient_stop_set(stops, 3));
401 eo_do(gradient, efl_graphics_gradient_radial_center_set(100, 100));
402 eo_do(gradient, efl_graphics_gradient_radial_radius_set(100));
403
404 eo_do(shape,
405 evas_vg_shape_fill_set(gradient),
406// evas_vg_node_color_set(255, 0, 255, 255),
407 efl_graphics_shape_stroke_join_set(EFL_GRAPHICS_JOIN_ROUND),
408 efl_graphics_shape_stroke_width_set(1.0),
409 efl_graphics_shape_stroke_color_set(255, 255, 0, 255));
410
411 Elm_Transit *transit = elm_transit_add();
412 elm_transit_effect_add(transit, third_effect_custom_op, shape, NULL);
413 elm_transit_auto_reverse_set(transit, EINA_TRUE);
414 elm_transit_repeat_times_set(transit, -1);
415 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
416 elm_transit_duration_set(transit, 1.0);
417 elm_transit_go(transit);
418}
419
420static void
421second_effect_custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
422{
423 Evas_VG_Shape *shape = effect;
424 Efl_Graphics_Path_Command *path_cmd = NULL;
425 double *points = NULL;
426
427 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
428 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) * progress, (800/2));
429
430 eo_do(shape,
431 evas_vg_node_color_set(255, 255, 255, 255);
432 efl_graphics_shape_stroke_width_set(15.0),
433 efl_graphics_shape_stroke_color_set(255, 255, 0, 255),
434 efl_graphics_shape_path_set(path_cmd, points));
435}
436
437static void
438second_effect_custom_op2(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
439{
440 Evas_VG_Shape *shape = effect;
441 Efl_Graphics_Path_Command *path_cmd = NULL;
442 double *points = NULL;
443
444 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
445 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2));
446 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2) - (100) * progress);
447
448 eo_do(shape,
449 evas_vg_node_color_set(0,0, 0, 0);
450 efl_graphics_shape_stroke_width_set(15.0 + 5 * progress),
451 efl_graphics_shape_stroke_color_set(255 - 255 * progress, 255, 0, 255),
452 efl_graphics_shape_path_set(path_cmd, points));
453}
454
455static void
456second_effect_custom_op3(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
457{
458 Evas_VG_Shape *shape = effect;
459 Efl_Graphics_Path_Command *path_cmd = NULL;
460 double *points = NULL;
461
462 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
463 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2));
464 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2) - 100);
465
466 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 * progress, (800/2) - 100 + (150) * progress);
467
468 eo_do(shape,
469 evas_vg_node_color_set(0,0, 0, 0);
470 efl_graphics_shape_stroke_width_set(20.0),
471 efl_graphics_shape_stroke_color_set(0, 255, 255 * progress, 255),
472 efl_graphics_shape_path_set(path_cmd, points));
473}
474
475static void
476second_effect_custom_op4(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
477{
478 Evas_VG_Shape *shape = effect;
479 Efl_Graphics_Path_Command *path_cmd = NULL;
480 double *points = NULL;
481
482 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
483 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2));
484 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2) - 100);
485 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200, (800/2) - 100 + (150));
486
487 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200 * progress), (800/2) - 100 + 150 + 150 * progress);
488
489 eo_do(shape,
490 evas_vg_node_color_set(0,0, 0, 0);
491 efl_graphics_shape_stroke_width_set(20.0),
492 efl_graphics_shape_stroke_color_set(0, 255, 255, 255),
493 efl_graphics_shape_path_set(path_cmd, points));
494}
495
496static void
497second_effect_custom_op5(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
498{
499 Evas_VG_Shape *shape = effect;
500 Efl_Graphics_Path_Command *path_cmd = NULL;
501 double *points = NULL;
502
503 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
504 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2));
505 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2) - 100);
506 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200, (800/2) - 100 + (150));
507 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200), (800/2) - 100 + 150 + 150);
508
509 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200), (800/2) - 100 + 150 + 150 - (100 * progress));
510
511 eo_do(shape,
512 evas_vg_node_color_set(0,0, 0, 0);
513 efl_graphics_shape_stroke_width_set(20.0),
514 efl_graphics_shape_stroke_color_set(255 * progress, 255 - 255 * progress, 255 - 255 * progress, 255),
515 efl_graphics_shape_path_set(path_cmd, points));
516}
517
518static void
519second_effect_custom_op6(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
520{
521 Evas_VG_Shape *shape = effect;
522 Efl_Graphics_Path_Command *path_cmd = NULL;
523 double *points = NULL;
524
525 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
526 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2));
527 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2), (800/2) - 100);
528 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200, (800/2) - 100 + (150));
529 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200), (800/2) - 100 + 150 + 150);
530 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200), (800/2) - 100 + 150 + 150 - (100));
531
532 efl_graphics_path_append_line_to(&path_cmd, &points, (480/2) + 200 - (200) - ((480/2) * progress), (800/2) - 100 + 150 + 150 - (100));
533
534 eo_do(shape,
535 evas_vg_node_color_set(0, 255 * progress, 0, progress * 255);
536 efl_graphics_shape_stroke_width_set(20.0 - 10 * progress),
537 efl_graphics_shape_stroke_color_set(255 * progress, 255 * progress, 255 * progress, 255),
538 efl_graphics_shape_path_set(path_cmd, points));
539}
540
541static void
542btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
543{
544 Evas_Object *nf = data;
545 Evas_Object *vg = elm_object_content_get(nf);
546 evas_object_hide(vg);
547
548 Evas_Object *btn = elm_button_add(nf);
549 elm_object_text_set(btn, "Next Test");
550
551 //Second Vector Test
552 vg = evas_object_vg_add(evas_object_evas_get(nf));
553 evas_object_resize(vg, 480, 800);
554 evas_object_show(vg);
555
556 Evas_VG_Root_Node *root = evas_object_vg_root_node_get(vg);
557 Evas_VG_Shape *shape = eo_add(EVAS_VG_SHAPE_CLASS, root);
558 Efl_Graphics_Path_Command *path_cmd = NULL;
559 double *points = NULL;
560 efl_graphics_path_append_move_to(&path_cmd, &points, 0, (800/2));
561
562 eo_do(shape,
563 evas_vg_node_color_set(255, 255, 255, 0),
564 efl_graphics_shape_stroke_join_set(EFL_GRAPHICS_JOIN_ROUND),
565 efl_graphics_shape_stroke_width_set(10.0),
566 efl_graphics_shape_stroke_color_set(255, 255, 0, 255),
567 efl_graphics_shape_path_set(path_cmd, points));
568
569 elm_naviframe_item_push(nf, "Vector Test", NULL, btn, vg, NULL);
570
571 Elm_Transit *transit = elm_transit_add();
572 elm_transit_effect_add(transit, second_effect_custom_op, shape, NULL);
573 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
574 elm_transit_duration_set(transit, 1.0);
575
576 Elm_Transit *transit2 = elm_transit_add();
577 elm_transit_tween_mode_set(transit2, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
578 elm_transit_effect_add(transit2, second_effect_custom_op2, shape, NULL);
579 elm_transit_duration_set(transit2, 1.0);
580
581 Elm_Transit *transit3 = elm_transit_add();
582 elm_transit_tween_mode_set(transit3, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
583 elm_transit_effect_add(transit3, second_effect_custom_op3, shape, NULL);
584 elm_transit_duration_set(transit3, 1.0);
585
586 Elm_Transit *transit4 = elm_transit_add();
587 elm_transit_tween_mode_set(transit4, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
588 elm_transit_effect_add(transit4, second_effect_custom_op4, shape, NULL);
589 elm_transit_duration_set(transit4, 1.0);
590
591 Elm_Transit *transit5 = elm_transit_add();
592 elm_transit_tween_mode_set(transit5, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
593 elm_transit_effect_add(transit5, second_effect_custom_op5, shape, NULL);
594 elm_transit_duration_set(transit5, 1.0);
595
596 Elm_Transit *transit6 = elm_transit_add();
597 elm_transit_tween_mode_set(transit6, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
598 elm_transit_effect_add(transit6, second_effect_custom_op6, shape, NULL);
599 elm_transit_duration_set(transit6, 1.0);
600
601 elm_transit_chain_transit_add(transit, transit2);
602 elm_transit_chain_transit_add(transit2, transit3);
603 elm_transit_chain_transit_add(transit3, transit4);
604 elm_transit_chain_transit_add(transit4, transit5);
605 elm_transit_chain_transit_add(transit5, transit6);
606
607 elm_transit_go(transit);
608
609
610 evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb2, nf);
611
612}
613
614static void
615first_effect_custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
616{
617 Evas_VG_Shape *shape = effect;
618 Efl_Graphics_Path_Command *path_cmd = NULL;
619 double *points = NULL;
620
621 efl_graphics_path_append_circle(&path_cmd, &points, (480/2), (800/2), (300/2) * progress);
622
623 eo_do(shape,
624 evas_vg_node_color_set(0, 255 * progress, 255 * progress, 255 * progress),
625 efl_graphics_shape_stroke_width_set(progress * 25),
626 efl_graphics_shape_stroke_color_set(255 * progress, 255 * progress, 0, 127),
627 efl_graphics_shape_path_set(path_cmd, points));
628}
629
630int
631elm_main(int argc, char **argv)
632{
633 Evas_Object *win, *image;
634 char *img_path = NULL;
635
636 elm_app_info_set(elm_main, "elementary",NULL);
637 win = elm_win_util_standard_add("test", "test");
638 elm_win_title_set(win, "Image");
639 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
640 elm_win_autodel_set(win, EINA_TRUE);
641
642 Evas_Object *btn = elm_button_add(win);
643 elm_object_text_set(btn, "Next Test");
644
645 Evas_Object *nf = elm_naviframe_add(win);
646 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
647 elm_win_resize_object_add(win, nf);
648 evas_object_show(nf);
649
650 //First Vector Test
651 Evas_Object *vg = evas_object_vg_add(evas_object_evas_get(win));
652 evas_object_resize(vg, 480, 800);
653 evas_object_show(vg);
654
655 Evas_VG_Root_Node *root = evas_object_vg_root_node_get(vg);
656 Evas_VG_Shape *shape = eo_add(EVAS_VG_SHAPE_CLASS, root);
657 //Evas_VG_Shape *shape = evas_vg_shape_add(root);
658 Efl_Graphics_Path_Command *path_cmd = NULL;
659 double *points = NULL;
660 efl_graphics_path_append_circle(&path_cmd, &points, (480/2), (800/2), (300/2));
661 eo_do(shape,
662 evas_vg_node_color_set(255, 255, 255, 255);
663 efl_graphics_shape_stroke_width_set(0.0),
664 efl_graphics_shape_stroke_color_set(255, 255, 0, 255),
665 efl_graphics_shape_path_set(path_cmd, points));
666
667 elm_naviframe_item_push(nf, "Vector Test", NULL, btn, vg, NULL);
668
669 evas_object_resize(win, 480, 800);
670 evas_object_show(win);
671
672 Elm_Transit *transit = elm_transit_add();
673 elm_transit_effect_add(transit, first_effect_custom_op, shape, NULL);
674 elm_transit_auto_reverse_set(transit, EINA_TRUE);
675 elm_transit_repeat_times_set(transit, -1);
676 elm_transit_duration_set(transit, 1.0);
677 elm_transit_go(transit);
678
679 evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, nf);
680
681 elm_run();
682 elm_shutdown();
683
684 return 0;
685}
686ELM_MAIN()