1 #include <Elementary.h>
3 # include "elementary_config.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++)
143 evas_map_point_coord_get(m, i, &x, &y, &z);
144 evas_map_point_coord_set(m, i, x, y, 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 x1, double y1, double z1,
182 double x2, double y2, double z2,
183 double x3, double y3, double z3,
184 double x4, double y4, double z4)
186 sl->x[0] = x1; sl->y[0] = y1; sl->z[0] = z1;
187 sl->x[1] = x2; sl->y[1] = y2; sl->z[1] = z2;
188 sl->x[2] = x3; sl->y[2] = y3; sl->z[2] = z3;
189 sl->x[3] = x4; sl->y[3] = y4; sl->z[3] = z4;
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 x1, y1, x2, y2, 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;
326 evas_object_geometry_get(st->front, &x, &y, &w, &h);
327 ox = x; oy = y; ow = w; oh = h;
335 dst = sqrt((dx * dx) + (dy * dy));
338 if (dst < 20) // MAGIC: 20 == drag hysterisis
343 if ((x1 > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) st->dir = 0; // left
344 else if ((x1 < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) st->dir = 1; // right
345 else if ((y1 > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) st->dir = 2; // up
346 else if ((y1 < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) st->dir = 3; // down
347 if (st->dir == -1) return 0;
351 // no nothing. left drag is standard
353 else if (st->dir == 1)
358 else if (st->dir == 2)
362 tmp = x1; x1 = y1; y1 = tmp;
363 tmp = x2; x2 = y2; y2 = tmp;
364 tmp = w; w = h; h = tmp;
366 else if (st->dir == 3)
370 tmp = x1; x1 = y1; y1 = tmp;
371 tmp = x2; x2 = y2; y2 = tmp;
372 tmp = w; w = h; h = tmp;
377 if (x2 >= x1) x2 = x1 - 1;
382 else if (mx >= w) mx = w - 1;
384 else if (my >= h) my = h - 1;
386 mgrad = (double)(y1 - y2) / (double)(x1 - x2);
388 if (mx < 1) mx = 1; // quick hack to keep curl line visible
390 if (mgrad == 0.0) // special horizontal case
391 mgrad = 0.001; // quick dirty hack for now
396 b = my + (minv * mx);
398 if ((b >= -5) && (b <= (h + 5)))
400 if (minv > 0.0) // clamp to h
402 minv = (double)(h + 5 - my) / (double)(mx);
403 b = my + (minv * mx);
407 minv = (double)(-5 - my) / (double)(mx);
408 b = my + (minv * mx);
412 perc = (double)x2 / (double)x1;
413 percm = (double)mx / (double)x1;
414 if (perc < 0.0) perc = 0.0;
415 else if (perc > 1.0) perc = 1.0;
416 if (percm < 0.0) percm = 0.0;
417 else if (percm > 1.0) percm = 1.0;
419 minva = atan(minv) / (M_PI / 2);
420 if (minva < 0.0) minva = -minva;
425 if (A < -(h * 20)) A = -h * 20;
429 // rho = is how much the page is turned
431 n = 1.0 - cos(n * M_PI / 2.0);
437 // theta == curliness (how much page culrs in on itself
438 n = sin((1.0 - perc) * M_PI);
442 n = sin((1.0 - perc) * M_PI);
454 if (gszw < 4) gszw = 4;
455 if (gszh < 4) gszh = 4;
457 nw = (w + gszw - 1) / gszw;
458 nh = (h + gszh - 1) / gszh;
459 if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st);
464 st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
465 if (!st->slices) return 0;
466 st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
475 num = (st->slices_w + 1) * (st->slices_h + 1);
477 tvi = alloca(sizeof(Vertex2) * num);
478 tvo = alloca(sizeof(Vertex3) * num);
479 tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1));
481 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
487 _deform_point(&vil, &(tvol[col]), rhol, thetal, Al);
490 n = minva * sin(perc * M_PI);
494 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
496 for (gy = 0; gy <= (h + gszh - 1); gy += gszh)
501 if (gx > w) vi.x = w;
503 if (gy > h) vi.y = h;
505 _deform_point(&vi, &vo, rho, theta, A);
507 if (gy > h) tvo1.y = h;
509 _interp_point(&vo, &tvo1, &(tvo[num]), n);
514 jump = st->slices_h + 1;
515 for (col = 0, gx = 0; gx < w; gx += gszw, col++)
517 num = st->slices_h * col;
521 if ((gx + gw) > w) gw = w - gx;
523 for (row = 0, gy = 0; gy < h; gy += gszh, row++)
527 if (b > 0) nn = num + st->slices_h - row - 1;
531 if ((gy + gh) > h) gh = h - gy;
533 vo[0] = tvo[num2 + row];
534 vo[1] = tvo[num2 + row + jump];
535 vo[2] = tvo[num2 + row + jump + 1];
536 vo[3] = tvo[num2 + row + 1];
537 #define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0)
542 vo[0].y = h - vo[0].y;
543 vo[1].y = h - vo[1].y;
544 vo[2].y = h - vo[2].y;
545 vo[3].y = h - vo[3].y;
552 sl = _slice_new(st, st->front);
556 vo[0].x, vo[0].y, vo[0].z,
557 vo[1].x, vo[1].y, vo[1].z,
558 vo[2].x, vo[2].y, vo[2].z,
559 vo[3].x, vo[3].y, vo[3].z);
563 gx + gw, gy + gh, gx, gy + gh);
566 gx, h - (gy + gh), gx + gw, h - (gy + gh),
567 gx + gw, h - gy, gx, h - gy);
570 sl = st->slices2[nn];
573 sl = _slice_new(st, st->back);
574 st->slices2[nn] = sl;
578 vo[1].x, vo[1].y, vo[1].z,
579 vo[0].x, vo[0].y, vo[0].z,
580 vo[3].x, vo[3].y, vo[3].z,
581 vo[2].x, vo[2].y, vo[2].z);
587 gx, gy + gh, gx + gw, gy + gh);
590 gx + gw, h - (gy + gh), gx, h - (gy + gh),
591 gx, h - gy, gx + gw, h - gy);
597 w - (gx + gw), gy, w - (gx), gy,
598 w - (gx), gy + gh, w - (gx + gw), gy + gh);
601 w - (gx + gw), h - (gy + gh), w - (gx), h - (gy + gh),
602 w - (gx), h - gy, w - (gx + gw), h - gy);
608 for (j = 0; j < st->slices_h; j++)
610 for (i = 0; i < st->slices_w; i++)
612 _slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh);
613 _slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh);
614 _slice_light(st, st->slices[num], ox, oy, ow, oh);
615 _slice_light(st, st->slices2[num], ox, oy, ow, oh);
620 for (i = 0; i <= st->slices_w; i++)
622 num = i * st->slices_h;
623 for (j = 0; j <= st->slices_h; j++)
627 s[0] = s[1] = s[2] = s[3] = NULL;
628 if ((i > 0) && (j > 0))
629 s[0] = st->slices[num - 1 - st->slices_h];
630 if ((i < st->slices_w) && (j > 0))
631 s[1] = st->slices[num - 1];
632 if ((i > 0) && (j < st->slices_h))
633 s[2] = st->slices[num - st->slices_h];
634 if ((i < st->slices_w) && (j < st->slices_h))
635 s[3] = st->slices[num];
637 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
639 else if (st->dir == 1)
640 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
642 else if (st->dir == 2)
643 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
645 else if (st->dir == 3)
646 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
648 s[0] = s[1] = s[2] = s[3] = NULL;
649 if ((i > 0) && (j > 0))
650 s[0] = st->slices2[num - 1 - st->slices_h];
651 if ((i < st->slices_w) && (j > 0))
652 s[1] = st->slices2[num - 1];
653 if ((i > 0) && (j < st->slices_h))
654 s[2] = st->slices2[num - st->slices_h];
655 if ((i < st->slices_w) && (j < st->slices_h))
656 s[3] = st->slices2[num];
658 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
660 else if (st->dir == 1)
661 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
663 else if (st->dir == 2)
664 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
666 else if (st->dir == 3)
667 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
674 for (i = 0; i < st->slices_w; i++)
676 for (j = 0; j < st->slices_h; j++)
678 _slice_3d(st, st->slices[num], ox, oy, ow, oh);
679 _slice_3d(st, st->slices2[num], ox, oy, ow, oh);
688 _state_end(State *st)
690 _state_slices_clear(st);
694 _state_anim(void *data, double pos)
699 p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
703 st->x = st->ox * (1.0 - p);
704 else if (st->dir == 1)
705 st->x = st->ox + ((st->w - st->ox) * p);
706 else if (st->dir == 2)
707 st->y = st->oy * (1.0 - p);
708 else if (st->dir == 3)
709 st->y = st->oy + ((st->h - st->oy) * p);
714 st->x = st->ox + ((st->w - st->ox) * p);
715 else if (st->dir == 1)
716 st->x = st->ox * (1.0 - p);
717 else if (st->dir == 2)
718 st->y = st->oy + ((st->h - st->oy) * p);
719 else if (st->dir == 3)
720 st->y = st->oy * (1.0 - p);
723 if (pos < 1.0) return EINA_TRUE;
724 evas_object_show(st->front);
725 evas_object_show(st->back);
732 _update_curl_job(void *data)
736 if (_state_update(st))
738 evas_object_hide(st->front);
739 evas_object_hide(st->back);
744 im_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
747 Evas_Event_Mouse_Down *ev = event_info;
748 Evas_Coord x, y, w, h;
750 if (ev->button != 1) return;
752 st->back = evas_object_data_get(data, "im2");
755 evas_object_geometry_get(st->front, &x, &y, &w, &h);
756 st->x = ev->canvas.x - x;
757 st->y = ev->canvas.y - y;
763 if (_state_update(st))
765 evas_object_hide(st->front);
766 evas_object_hide(st->back);
771 im_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
774 Evas_Event_Mouse_Up *ev = event_info;
775 Evas_Coord x, y, w, h;
778 if (ev->button != 1) return;
780 evas_object_geometry_get(st->front, &x, &y, &w, &h);
781 st->x = ev->canvas.x - x;
782 st->y = ev->canvas.y - y;
789 ecore_job_del(st->job);
792 if (st->anim) ecore_animator_del(st->anim);
796 tm = (double)st->x / (double)st->w;
797 if (st->x < (st->w / 2)) st->finish = 1;
799 else if (st->dir == 1)
801 if (st->x > (st->w / 2)) st->finish = 1;
802 tm = 1.0 - ((double)st->x / (double)st->w);
804 else if (st->dir == 2)
806 if (st->y < (st->h / 2)) st->finish = 1;
807 tm = (double)st->y / (double)st->h;
809 else if (st->dir == 3)
811 if (st->y > (st->h / 2)) st->finish = 1;
812 tm = 1.0 - ((double)st->y / (double)st->h);
814 if (tm < 0.01) tm = 0.01;
815 else if (tm > 0.99) tm = 0.99;
816 if (!st->finish) tm = 1.0 - tm;
818 st->anim = ecore_animator_timeline_add(tm, _state_anim, st);
819 _state_anim(st, 0.0);
823 im_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
826 Evas_Event_Mouse_Move *ev = event_info;
827 Evas_Coord x, y, w, h;
829 if (!st->down) return;
830 evas_object_geometry_get(st->front, &x, &y, &w, &h);
831 st->x = ev->cur.canvas.x - x;
832 st->y = ev->cur.canvas.y - y;
835 if (st->job) ecore_job_del(st->job);
836 st->job = ecore_job_add(_update_curl_job, st);
840 test_flip_page(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
842 Evas_Object *win, *bg, *im, *im2, *rc;
845 win = elm_win_add(NULL, "flip_page", ELM_WIN_BASIC);
846 elm_win_title_set(win, "Flip Page");
847 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
848 elm_win_autodel_set(win, EINA_TRUE);
850 bg = elm_bg_add(win);
851 elm_win_resize_object_add(win, bg);
852 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
853 evas_object_show(bg);
855 im2 = evas_object_image_filled_add(evas_object_evas_get(win));
856 snprintf(buf, sizeof(buf), "%s/images/%s",
857 PACKAGE_DATA_DIR, "sky_04.jpg");
858 evas_object_image_file_set(im2, buf, NULL);
859 evas_object_move(im2, 40, 40);
860 evas_object_resize(im2, 400, 400);
861 evas_object_show(im2);
864 im = elm_layout_add(win);
865 snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
866 elm_layout_file_set(im, buf, "layout");
868 im = evas_object_image_filled_add(evas_object_evas_get(win));
869 snprintf(buf, sizeof(buf), "%s/images/%s",
870 PACKAGE_DATA_DIR, "twofish.jpg");
871 evas_object_image_file_set(im, buf, NULL);
873 evas_object_move(im, 40, 40);
874 evas_object_resize(im, 400, 400);
875 evas_object_show(im);
877 evas_object_data_set(im, "im2", im2);
880 rc = evas_object_rectangle_add(evas_object_evas_get(win));
881 evas_object_color_set(rc, 0, 0, 0, 0);
882 evas_object_move(rc, 40, 340);
883 evas_object_resize(rc, 400, 100);
884 evas_object_show(rc);
886 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
887 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
888 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
890 rc = evas_object_rectangle_add(evas_object_evas_get(win));
891 evas_object_color_set(rc, 0, 0, 0, 0);
892 evas_object_move(rc, 40, 40);
893 evas_object_resize(rc, 400, 100);
894 evas_object_show(rc);
896 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
897 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
898 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
900 rc = evas_object_rectangle_add(evas_object_evas_get(win));
901 evas_object_color_set(rc, 0, 0, 0, 0);
902 evas_object_move(rc, 340, 40);
903 evas_object_resize(rc, 100, 400);
904 evas_object_show(rc);
906 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
907 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
908 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
910 rc = evas_object_rectangle_add(evas_object_evas_get(win));
911 evas_object_color_set(rc, 0, 0, 0, 0);
912 evas_object_move(rc, 40, 40);
913 evas_object_resize(rc, 100, 400);
914 evas_object_show(rc);
916 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
917 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
918 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
920 evas_object_resize(win, 480, 480);
921 evas_object_show(win);