2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
7 typedef struct _State State;
8 typedef struct _Slice Slice;
10 typedef struct _Vertex2 Vertex2;
11 typedef struct _Vertex3 Vertex3;
15 Evas_Object *front, *back;
16 Evas_Coord down_x, down_y, x, y;
18 Eina_Bool backflip : 1;
22 Evas_Coord ox, oy, w, h;
23 int slices_w, slices_h;
24 Slice **slices, **slices2;
25 int dir; // 0 == left, 1 == right, 2 == up, 3 == down
36 double u[4], v[4], x[4], y[4], z[4];
66 _slice_new(State *st __UNUSED__, Evas_Object *obj)
70 sl = calloc(1, sizeof(Slice));
72 sl->obj = evas_object_image_add(evas_object_evas_get(obj));
73 evas_object_image_smooth_scale_set(sl->obj, 0);
74 evas_object_pass_events_set(sl->obj, 1);
75 evas_object_image_source_set(sl->obj, obj);
80 _slice_free(Slice *sl)
82 evas_object_del(sl->obj);
87 _slice_apply(State *st, Slice *sl,
88 Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__,
89 Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
96 evas_map_smooth_set(m, 0);
97 for (i = 0; i < 4; i++)
99 evas_map_point_color_set(m, i, 255, 255, 255, 255);
102 int p[4] = { 0, 1, 2, 3 };
103 evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]], sl->z[p[i]]);
104 evas_map_point_image_uv_set(m, i, sl->u[p[i]] , sl->v[p[i]]);
106 else if (st->dir == 1)
108 int p[4] = { 1, 0, 3, 2 };
109 evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]), oy + sl->y[p[i]], sl->z[p[i]]);
110 evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]] , sl->v[p[i]]);
112 else if (st->dir == 2)
114 int p[4] = { 1, 0, 3, 2 };
115 evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]], sl->z[p[i]]);
116 evas_map_point_image_uv_set(m, i, sl->v[p[i]] , sl->u[p[i]]);
118 else if (st->dir == 3)
120 int p[4] = { 0, 1, 2, 3 };
121 evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + (w - sl->x[p[i]]), sl->z[p[i]]);
122 evas_map_point_image_uv_set(m, i, sl->v[p[i]] , oh - sl->u[p[i]]);
125 evas_object_map_enable_set(sl->obj, EINA_TRUE);
126 evas_object_image_fill_set(sl->obj, 0, 0, ow, oh);
127 evas_object_map_set(sl->obj, m);
132 _slice_3d(State *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
134 Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
138 // vanishing point is center of page, and focal dist is 1024
139 evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 1024);
140 for (i = 0; i < 4; i++)
142 Evas_Coord xx, yy, zz;
143 evas_map_point_coord_get(m, i, &xx, &yy, &zz);
144 evas_map_point_coord_set(m, i, xx, yy, 0);
146 if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj);
147 else evas_object_hide(sl->obj);
148 evas_object_map_set(sl->obj, m);
152 _slice_light(State *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
154 Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
158 evas_map_util_3d_lighting(m,
160 // (centered over page 10 * h toward camera)
161 x + (w / 2) , y + (h / 2) , -10000,
162 255, 255, 255, // light color
163 0 , 0 , 0); // ambient minimum
164 // multiply brightness by 1.2 to make lightish bits all white so we dont
165 // add shading where we could otherwise be pure white
166 for (i = 0; i < 4; i++)
170 evas_map_point_color_get(m, i, &r, &g, &b, &a);
171 r = (double)r * 1.2; if (r > 255) r = 255;
172 g = (double)g * 1.2; if (g > 255) g = 255;
173 b = (double)b * 1.2; if (b > 255) b = 255;
174 evas_map_point_color_set(m, i, r, g, b, a);
176 evas_object_map_set(sl->obj, m);
180 _slice_xyz(State *st __UNUSED__, Slice *sl,
181 double xx1, double yy1, double zz1,
182 double xx2, double yy2, double zz2,
183 double xx3, double yy3, double zz3,
184 double xx4, double yy4, double zz4)
186 sl->x[0] = xx1; sl->y[0] = yy1; sl->z[0] = zz1;
187 sl->x[1] = xx2; sl->y[1] = yy2; sl->z[1] = zz2;
188 sl->x[2] = xx3; sl->y[2] = yy3; sl->z[2] = zz3;
189 sl->x[3] = xx4; sl->y[3] = yy4; sl->z[3] = zz4;
193 _slice_uv(State *st __UNUSED__, Slice *sl,
194 double u1, double v1,
195 double u2, double v2,
196 double u3, double v3,
197 double u4, double v4)
199 sl->u[0] = u1; sl->v[0] = v1;
200 sl->u[1] = u2; sl->v[1] = v2;
201 sl->u[2] = u3; sl->v[2] = v3;
202 sl->u[3] = u4; sl->v[3] = v4;
206 _deform_point(Vertex2 *vi, Vertex3 *vo, double rho, double theta, double A)
212 // theta == cone angle (0 -> PI/2)
213 // A == distance of cone apex from origin
214 // rho == angle of cone from vertical axis (...-PI/2 to PI/2...)
218 d = sqrt((vi->x * vi->x) + pow(vi->y - A, 2));
220 b = asin(vi->x / d) / sin(theta);
223 v1.y = d + A - (r * (1 - cos(b)) * sin(theta));
224 v1.z = r * (1 - cos(b)) * cos(theta);
226 vo->x = (v1.x * cos(rho)) - (v1.z * sin(rho));
228 vo->z = (v1.x * sin(rho)) + (v1.z * cos(rho));
232 _interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v)
234 vo->x = (v * vi2->x) + ((1.0 - v) * vi1->x);
235 vo->y = (v * vi2->y) + ((1.0 - v) * vi1->y);
236 vo->z = (v * vi2->z) + ((1.0 - v) * vi1->z);
240 _state_slices_clear(State *st)
247 for (j = 0; j < st->slices_h; j++)
249 for (i = 0; i < st->slices_w; i++)
251 if (st->slices[num]) _slice_free(st->slices[num]);
252 if (st->slices2[num]) _slice_free(st->slices2[num]);
266 _slice_obj_color_sum(Slice *s, int p, int *r, int *g, int *b, int *a)
269 int rr = 0, gg = 0, bb = 0, aa = 0;
272 m = (Evas_Map *)evas_object_map_get(s->obj);
274 evas_map_point_color_get(m, p, &rr, &gg, &bb, &aa);
275 *r += rr; *g += gg; *b += bb; *a += aa;
280 _slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a)
285 m = (Evas_Map *)evas_object_map_get(s->obj);
287 evas_map_point_color_set(m, p, r, g, b, a);
288 evas_object_map_set(s->obj, m);
292 _slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2,
293 Slice *s3, int p3, Slice *s4, int p4)
295 int r = 0, g = 0, b = 0, a = 0, n = 0;
297 n += _slice_obj_color_sum(s1, p1, &r, &g, &b, &a);
298 n += _slice_obj_color_sum(s2, p2, &r, &g, &b, &a);
299 n += _slice_obj_color_sum(s3, p3, &r, &g, &b, &a);
300 n += _slice_obj_color_sum(s4, p4, &r, &g, &b, &a);
303 r /= n; g /= n; b /= n; a /= n;
305 _slice_obj_color_set(s1, p1, r, g, b, a);
306 _slice_obj_color_set(s2, p2, r, g, b, a);
307 _slice_obj_color_set(s3, p3, r, g, b, a);
308 _slice_obj_color_set(s4, p4, r, g, b, a);
312 _state_update(State *st)
314 Evas_Coord xx1, yy1, xx2, yy2, mx, my, dst, dx, dy;
315 Evas_Coord x, y, w, h, ox, oy, ow, oh;
316 int i, j, num, nn, jump, num2;
318 double b, minv = 0.0, minva, mgrad;
319 int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh;
320 double rho, A, theta, perc, percm, n, rhol, Al, thetal;
325 evas_object_geometry_get(st->front, &x, &y, &w, &h);
326 ox = x; oy = y; ow = w; oh = h;
334 dst = sqrt((dx * dx) + (dy * dy));
337 if (dst < 20) // MAGIC: 20 == drag hysterisis
342 if ((xx1 > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) st->dir = 0; // left
343 else if ((xx1 < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) st->dir = 1; // right
344 else if ((yy1 > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) st->dir = 2; // up
345 else if ((yy1 < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) st->dir = 3; // down
346 if (st->dir == -1) return 0;
350 // no nothing. left drag is standard
352 else if (st->dir == 1)
357 else if (st->dir == 2)
361 tmp = xx1; xx1 = yy1; yy1 = tmp;
362 tmp = xx2; xx2 = yy2; yy2 = tmp;
363 tmp = w; w = h; h = tmp;
365 else if (st->dir == 3)
369 tmp = xx1; xx1 = yy1; yy1 = tmp;
370 tmp = xx2; xx2 = yy2; yy2 = tmp;
371 tmp = w; w = h; h = tmp;
376 if (xx2 >= xx1) xx2 = xx1 - 1;
377 mx = (xx1 + xx2) / 2;
378 my = (yy1 + yy2) / 2;
381 else if (mx >= w) mx = w - 1;
383 else if (my >= h) my = h - 1;
385 mgrad = (double)(yy1 - yy2) / (double)(xx1 - xx2);
387 if (mx < 1) mx = 1; // quick hack to keep curl line visible
389 if (mgrad == 0.0) // special horizontal case
390 mgrad = 0.001; // quick dirty hack for now
395 b = my + (minv * mx);
397 if ((b >= -5) && (b <= (h + 5)))
399 if (minv > 0.0) // clamp to h
401 minv = (double)(h + 5 - my) / (double)(mx);
402 b = my + (minv * mx);
406 minv = (double)(-5 - my) / (double)(mx);
407 b = my + (minv * mx);
411 perc = (double)xx2 / (double)xx1;
412 percm = (double)mx / (double)xx1;
413 if (perc < 0.0) perc = 0.0;
414 else if (perc > 1.0) perc = 1.0;
415 if (percm < 0.0) percm = 0.0;
416 else if (percm > 1.0) percm = 1.0;
418 minva = atan(minv) / (M_PI / 2);
419 if (minva < 0.0) minva = -minva;
424 if (A < -(h * 20)) A = -h * 20;
428 // rho = is how much the page is turned
430 n = 1.0 - cos(n * M_PI / 2.0);
436 // theta == curliness (how much page culrs in on itself
437 n = sin((1.0 - perc) * M_PI);
441 n = sin((1.0 - perc) * M_PI);
451 if (gszw < 4) gszw = 4;
452 if (gszh < 4) gszh = 4;
454 nw = (w + gszw - 1) / gszw;
455 nh = (h + gszh - 1) / gszh;
456 if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st);
461 st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
462 if (!st->slices) return 0;
463 st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
472 num = (st->slices_w + 1) * (st->slices_h + 1);
474 tvo = alloca(sizeof(Vertex3) * num);
475 tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1));
477 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
483 _deform_point(&vil, &(tvol[col]), rhol, thetal, Al);
486 n = minva * sin(perc * M_PI);
490 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
492 for (gy = 0; gy <= (h + gszh - 1); gy += gszh)
497 if (gx > w) vi.x = w;
499 if (gy > h) vi.y = h;
501 _deform_point(&vi, &vo, rho, theta, A);
503 if (gy > h) tvo1.y = h;
505 _interp_point(&vo, &tvo1, &(tvo[num]), n);
510 jump = st->slices_h + 1;
511 for (col = 0, gx = 0; gx < w; gx += gszw, col++)
513 num = st->slices_h * col;
517 if ((gx + gw) > w) gw = w - gx;
519 for (row = 0, gy = 0; gy < h; gy += gszh, row++)
523 if (b > 0) nn = num + st->slices_h - row - 1;
527 if ((gy + gh) > h) gh = h - gy;
529 vo[0] = tvo[num2 + row];
530 vo[1] = tvo[num2 + row + jump];
531 vo[2] = tvo[num2 + row + jump + 1];
532 vo[3] = tvo[num2 + row + 1];
533 #define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0)
538 vo[0].y = h - vo[0].y;
539 vo[1].y = h - vo[1].y;
540 vo[2].y = h - vo[2].y;
541 vo[3].y = h - vo[3].y;
548 sl = _slice_new(st, st->front);
552 vo[0].x, vo[0].y, vo[0].z,
553 vo[1].x, vo[1].y, vo[1].z,
554 vo[2].x, vo[2].y, vo[2].z,
555 vo[3].x, vo[3].y, vo[3].z);
559 gx + gw, gy + gh, gx, gy + gh);
562 gx, h - (gy + gh), gx + gw, h - (gy + gh),
563 gx + gw, h - gy, gx, h - gy);
566 sl = st->slices2[nn];
569 sl = _slice_new(st, st->back);
570 st->slices2[nn] = sl;
574 vo[1].x, vo[1].y, vo[1].z,
575 vo[0].x, vo[0].y, vo[0].z,
576 vo[3].x, vo[3].y, vo[3].z,
577 vo[2].x, vo[2].y, vo[2].z);
583 gx, gy + gh, gx + gw, gy + gh);
586 gx + gw, h - (gy + gh), gx, h - (gy + gh),
587 gx, h - gy, gx + gw, h - gy);
593 w - (gx + gw), gy, w - (gx), gy,
594 w - (gx), gy + gh, w - (gx + gw), gy + gh);
597 w - (gx + gw), h - (gy + gh), w - (gx), h - (gy + gh),
598 w - (gx), h - gy, w - (gx + gw), h - gy);
604 for (j = 0; j < st->slices_h; j++)
606 for (i = 0; i < st->slices_w; i++)
608 _slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh);
609 _slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh);
610 _slice_light(st, st->slices[num], ox, oy, ow, oh);
611 _slice_light(st, st->slices2[num], ox, oy, ow, oh);
616 for (i = 0; i <= st->slices_w; i++)
618 num = i * st->slices_h;
619 for (j = 0; j <= st->slices_h; j++)
623 s[0] = s[1] = s[2] = s[3] = NULL;
624 if ((i > 0) && (j > 0))
625 s[0] = st->slices[num - 1 - st->slices_h];
626 if ((i < st->slices_w) && (j > 0))
627 s[1] = st->slices[num - 1];
628 if ((i > 0) && (j < st->slices_h))
629 s[2] = st->slices[num - st->slices_h];
630 if ((i < st->slices_w) && (j < st->slices_h))
631 s[3] = st->slices[num];
633 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
635 else if (st->dir == 1)
636 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
638 else if (st->dir == 2)
639 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
641 else if (st->dir == 3)
642 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
644 s[0] = s[1] = s[2] = s[3] = NULL;
645 if ((i > 0) && (j > 0))
646 s[0] = st->slices2[num - 1 - st->slices_h];
647 if ((i < st->slices_w) && (j > 0))
648 s[1] = st->slices2[num - 1];
649 if ((i > 0) && (j < st->slices_h))
650 s[2] = st->slices2[num - st->slices_h];
651 if ((i < st->slices_w) && (j < st->slices_h))
652 s[3] = st->slices2[num];
654 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
656 else if (st->dir == 1)
657 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
659 else if (st->dir == 2)
660 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
662 else if (st->dir == 3)
663 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
670 for (i = 0; i < st->slices_w; i++)
672 for (j = 0; j < st->slices_h; j++)
674 _slice_3d(st, st->slices[num], ox, oy, ow, oh);
675 _slice_3d(st, st->slices2[num], ox, oy, ow, oh);
684 _state_end(State *st)
686 _state_slices_clear(st);
690 _state_anim(void *data, double pos)
695 p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
699 st->x = st->ox * (1.0 - p);
700 else if (st->dir == 1)
701 st->x = st->ox + ((st->w - st->ox) * p);
702 else if (st->dir == 2)
703 st->y = st->oy * (1.0 - p);
704 else if (st->dir == 3)
705 st->y = st->oy + ((st->h - st->oy) * p);
710 st->x = st->ox + ((st->w - st->ox) * p);
711 else if (st->dir == 1)
712 st->x = st->ox * (1.0 - p);
713 else if (st->dir == 2)
714 st->y = st->oy + ((st->h - st->oy) * p);
715 else if (st->dir == 3)
716 st->y = st->oy * (1.0 - p);
719 if (pos < 1.0) return EINA_TRUE;
720 evas_object_show(st->front);
721 evas_object_show(st->back);
728 _update_curl_job(void *data)
732 if (_state_update(st))
734 evas_object_hide(st->front);
735 evas_object_hide(st->back);
740 im_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
743 Evas_Event_Mouse_Down *ev = event_info;
744 Evas_Coord x, y, w, h;
746 if (ev->button != 1) return;
748 st->back = evas_object_data_get(data, "im2");
751 evas_object_geometry_get(st->front, &x, &y, &w, &h);
752 st->x = ev->canvas.x - x;
753 st->y = ev->canvas.y - y;
759 if (_state_update(st))
761 evas_object_hide(st->front);
762 evas_object_hide(st->back);
767 im_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
770 Evas_Event_Mouse_Up *ev = event_info;
771 Evas_Coord x, y, w, h;
774 if (ev->button != 1) return;
776 evas_object_geometry_get(st->front, &x, &y, &w, &h);
777 st->x = ev->canvas.x - x;
778 st->y = ev->canvas.y - y;
785 ecore_job_del(st->job);
788 if (st->anim) ecore_animator_del(st->anim);
792 tm = (double)st->x / (double)st->w;
793 if (st->x < (st->w / 2)) st->finish = 1;
795 else if (st->dir == 1)
797 if (st->x > (st->w / 2)) st->finish = 1;
798 tm = 1.0 - ((double)st->x / (double)st->w);
800 else if (st->dir == 2)
802 if (st->y < (st->h / 2)) st->finish = 1;
803 tm = (double)st->y / (double)st->h;
805 else if (st->dir == 3)
807 if (st->y > (st->h / 2)) st->finish = 1;
808 tm = 1.0 - ((double)st->y / (double)st->h);
810 if (tm < 0.01) tm = 0.01;
811 else if (tm > 0.99) tm = 0.99;
812 if (!st->finish) tm = 1.0 - tm;
814 st->anim = ecore_animator_timeline_add(tm, _state_anim, st);
815 _state_anim(st, 0.0);
819 im_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
822 Evas_Event_Mouse_Move *ev = event_info;
823 Evas_Coord x, y, w, h;
825 if (!st->down) return;
826 evas_object_geometry_get(st->front, &x, &y, &w, &h);
827 st->x = ev->cur.canvas.x - x;
828 st->y = ev->cur.canvas.y - y;
831 if (st->job) ecore_job_del(st->job);
832 st->job = ecore_job_add(_update_curl_job, st);
836 test_flip_page(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
838 Evas_Object *win, *bg, *im, *im2, *rc;
841 win = elm_win_add(NULL, "flip_page", ELM_WIN_BASIC);
842 elm_win_title_set(win, "Flip Page");
843 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
844 elm_win_autodel_set(win, EINA_TRUE);
846 bg = elm_bg_add(win);
847 elm_win_resize_object_add(win, bg);
848 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
849 evas_object_show(bg);
851 im2 = evas_object_image_filled_add(evas_object_evas_get(win));
852 snprintf(buf, sizeof(buf), "%s/images/%s",
853 elm_app_data_dir_get(), "sky_04.jpg");
854 evas_object_image_file_set(im2, buf, NULL);
855 evas_object_move(im2, 40, 40);
856 evas_object_resize(im2, 400, 400);
857 evas_object_show(im2);
860 im = elm_layout_add(win);
861 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
862 elm_layout_file_set(im, buf, "layout");
864 im = evas_object_image_filled_add(evas_object_evas_get(win));
865 snprintf(buf, sizeof(buf), "%s/images/%s",
866 elm_app_data_dir_get(), "twofish.jpg");
867 evas_object_image_file_set(im, buf, NULL);
869 evas_object_move(im, 40, 40);
870 evas_object_resize(im, 400, 400);
871 evas_object_show(im);
873 evas_object_data_set(im, "im2", im2);
876 rc = evas_object_rectangle_add(evas_object_evas_get(win));
877 evas_object_color_set(rc, 0, 0, 0, 0);
878 evas_object_move(rc, 40, 340);
879 evas_object_resize(rc, 400, 100);
880 evas_object_show(rc);
882 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
883 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
884 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
886 rc = evas_object_rectangle_add(evas_object_evas_get(win));
887 evas_object_color_set(rc, 0, 0, 0, 0);
888 evas_object_move(rc, 40, 40);
889 evas_object_resize(rc, 400, 100);
890 evas_object_show(rc);
892 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
893 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
894 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
896 rc = evas_object_rectangle_add(evas_object_evas_get(win));
897 evas_object_color_set(rc, 0, 0, 0, 0);
898 evas_object_move(rc, 340, 40);
899 evas_object_resize(rc, 100, 400);
900 evas_object_show(rc);
902 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
903 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
904 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
906 rc = evas_object_rectangle_add(evas_object_evas_get(win));
907 evas_object_color_set(rc, 0, 0, 0, 0);
908 evas_object_move(rc, 40, 40);
909 evas_object_resize(rc, 100, 400);
910 evas_object_show(rc);
912 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
913 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
914 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
916 evas_object_resize(win, 480, 480);
917 evas_object_show(win);