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++)
144 evas_map_point_coord_get(m, i, &x, &y, &z);
145 evas_map_point_coord_set(m, i, x, y, 0);
147 Evas_Coord xx, yy, zz;
148 evas_map_point_coord_get(m, i, &xx, &yy, &zz);
149 evas_map_point_coord_set(m, i, xx, yy, 0);
150 >>>>>>> remotes/origin/upstream
152 if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj);
153 else evas_object_hide(sl->obj);
154 evas_object_map_set(sl->obj, m);
158 _slice_light(State *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
160 Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
164 evas_map_util_3d_lighting(m,
166 // (centered over page 10 * h toward camera)
167 x + (w / 2) , y + (h / 2) , -10000,
168 255, 255, 255, // light color
169 0 , 0 , 0); // ambient minimum
170 // multiply brightness by 1.2 to make lightish bits all white so we dont
171 // add shading where we could otherwise be pure white
172 for (i = 0; i < 4; i++)
176 evas_map_point_color_get(m, i, &r, &g, &b, &a);
177 r = (double)r * 1.2; if (r > 255) r = 255;
178 g = (double)g * 1.2; if (g > 255) g = 255;
179 b = (double)b * 1.2; if (b > 255) b = 255;
180 evas_map_point_color_set(m, i, r, g, b, a);
182 evas_object_map_set(sl->obj, m);
186 _slice_xyz(State *st __UNUSED__, Slice *sl,
188 double x1, double y1, double z1,
189 double x2, double y2, double z2,
190 double x3, double y3, double z3,
191 double x4, double y4, double z4)
193 sl->x[0] = x1; sl->y[0] = y1; sl->z[0] = z1;
194 sl->x[1] = x2; sl->y[1] = y2; sl->z[1] = z2;
195 sl->x[2] = x3; sl->y[2] = y3; sl->z[2] = z3;
196 sl->x[3] = x4; sl->y[3] = y4; sl->z[3] = z4;
198 double xx1, double yy1, double zz1,
199 double xx2, double yy2, double zz2,
200 double xx3, double yy3, double zz3,
201 double xx4, double yy4, double zz4)
203 sl->x[0] = xx1; sl->y[0] = yy1; sl->z[0] = zz1;
204 sl->x[1] = xx2; sl->y[1] = yy2; sl->z[1] = zz2;
205 sl->x[2] = xx3; sl->y[2] = yy3; sl->z[2] = zz3;
206 sl->x[3] = xx4; sl->y[3] = yy4; sl->z[3] = zz4;
207 >>>>>>> remotes/origin/upstream
211 _slice_uv(State *st __UNUSED__, Slice *sl,
212 double u1, double v1,
213 double u2, double v2,
214 double u3, double v3,
215 double u4, double v4)
217 sl->u[0] = u1; sl->v[0] = v1;
218 sl->u[1] = u2; sl->v[1] = v2;
219 sl->u[2] = u3; sl->v[2] = v3;
220 sl->u[3] = u4; sl->v[3] = v4;
224 _deform_point(Vertex2 *vi, Vertex3 *vo, double rho, double theta, double A)
230 // theta == cone angle (0 -> PI/2)
231 // A == distance of cone apex from origin
232 // rho == angle of cone from vertical axis (...-PI/2 to PI/2...)
236 d = sqrt((vi->x * vi->x) + pow(vi->y - A, 2));
238 b = asin(vi->x / d) / sin(theta);
241 v1.y = d + A - (r * (1 - cos(b)) * sin(theta));
242 v1.z = r * (1 - cos(b)) * cos(theta);
244 vo->x = (v1.x * cos(rho)) - (v1.z * sin(rho));
246 vo->z = (v1.x * sin(rho)) + (v1.z * cos(rho));
250 _interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v)
252 vo->x = (v * vi2->x) + ((1.0 - v) * vi1->x);
253 vo->y = (v * vi2->y) + ((1.0 - v) * vi1->y);
254 vo->z = (v * vi2->z) + ((1.0 - v) * vi1->z);
258 _state_slices_clear(State *st)
265 for (j = 0; j < st->slices_h; j++)
267 for (i = 0; i < st->slices_w; i++)
269 if (st->slices[num]) _slice_free(st->slices[num]);
270 if (st->slices2[num]) _slice_free(st->slices2[num]);
284 _slice_obj_color_sum(Slice *s, int p, int *r, int *g, int *b, int *a)
287 int rr = 0, gg = 0, bb = 0, aa = 0;
290 m = (Evas_Map *)evas_object_map_get(s->obj);
292 evas_map_point_color_get(m, p, &rr, &gg, &bb, &aa);
293 *r += rr; *g += gg; *b += bb; *a += aa;
298 _slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a)
303 m = (Evas_Map *)evas_object_map_get(s->obj);
305 evas_map_point_color_set(m, p, r, g, b, a);
306 evas_object_map_set(s->obj, m);
310 _slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2,
311 Slice *s3, int p3, Slice *s4, int p4)
313 int r = 0, g = 0, b = 0, a = 0, n = 0;
315 n += _slice_obj_color_sum(s1, p1, &r, &g, &b, &a);
316 n += _slice_obj_color_sum(s2, p2, &r, &g, &b, &a);
317 n += _slice_obj_color_sum(s3, p3, &r, &g, &b, &a);
318 n += _slice_obj_color_sum(s4, p4, &r, &g, &b, &a);
321 r /= n; g /= n; b /= n; a /= n;
323 _slice_obj_color_set(s1, p1, r, g, b, a);
324 _slice_obj_color_set(s2, p2, r, g, b, a);
325 _slice_obj_color_set(s3, p3, r, g, b, a);
326 _slice_obj_color_set(s4, p4, r, g, b, a);
330 _state_update(State *st)
333 Evas_Coord x1, y1, x2, y2, mx, my, dst, dx, dy;
335 Evas_Coord xx1, yy1, xx2, yy2, mx, my, dst, dx, dy;
336 >>>>>>> remotes/origin/upstream
337 Evas_Coord x, y, w, h, ox, oy, ow, oh;
338 int i, j, num, nn, jump, num2;
340 double b, minv = 0.0, minva, mgrad;
341 int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh;
342 double rho, A, theta, perc, percm, n, rhol, Al, thetal;
347 evas_object_geometry_get(st->front, &x, &y, &w, &h);
348 ox = x; oy = y; ow = w; oh = h;
365 >>>>>>> remotes/origin/upstream
366 dst = sqrt((dx * dx) + (dy * dy));
369 if (dst < 20) // MAGIC: 20 == drag hysterisis
375 if ((x1 > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) st->dir = 0; // left
376 else if ((x1 < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) st->dir = 1; // right
377 else if ((y1 > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) st->dir = 2; // up
378 else if ((y1 < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) st->dir = 3; // down
380 if ((xx1 > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) st->dir = 0; // left
381 else if ((xx1 < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) st->dir = 1; // right
382 else if ((yy1 > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) st->dir = 2; // up
383 else if ((yy1 < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) st->dir = 3; // down
384 >>>>>>> remotes/origin/upstream
385 if (st->dir == -1) return 0;
389 // no nothing. left drag is standard
391 else if (st->dir == 1)
399 >>>>>>> remotes/origin/upstream
401 else if (st->dir == 2)
406 tmp = x1; x1 = y1; y1 = tmp;
407 tmp = x2; x2 = y2; y2 = tmp;
409 tmp = xx1; xx1 = yy1; yy1 = tmp;
410 tmp = xx2; xx2 = yy2; yy2 = tmp;
411 >>>>>>> remotes/origin/upstream
412 tmp = w; w = h; h = tmp;
414 else if (st->dir == 3)
419 tmp = x1; x1 = y1; y1 = tmp;
420 tmp = x2; x2 = y2; y2 = tmp;
421 tmp = w; w = h; h = tmp;
426 if (x2 >= x1) x2 = x1 - 1;
430 tmp = xx1; xx1 = yy1; yy1 = tmp;
431 tmp = xx2; xx2 = yy2; yy2 = tmp;
432 tmp = w; w = h; h = tmp;
437 if (xx2 >= xx1) xx2 = xx1 - 1;
438 mx = (xx1 + xx2) / 2;
439 my = (yy1 + yy2) / 2;
440 >>>>>>> remotes/origin/upstream
443 else if (mx >= w) mx = w - 1;
445 else if (my >= h) my = h - 1;
448 mgrad = (double)(y1 - y2) / (double)(x1 - x2);
450 mgrad = (double)(yy1 - yy2) / (double)(xx1 - xx2);
451 >>>>>>> remotes/origin/upstream
453 if (mx < 1) mx = 1; // quick hack to keep curl line visible
455 if (mgrad == 0.0) // special horizontal case
456 mgrad = 0.001; // quick dirty hack for now
461 b = my + (minv * mx);
463 if ((b >= -5) && (b <= (h + 5)))
465 if (minv > 0.0) // clamp to h
467 minv = (double)(h + 5 - my) / (double)(mx);
468 b = my + (minv * mx);
472 minv = (double)(-5 - my) / (double)(mx);
473 b = my + (minv * mx);
478 perc = (double)x2 / (double)x1;
479 percm = (double)mx / (double)x1;
481 perc = (double)xx2 / (double)xx1;
482 percm = (double)mx / (double)xx1;
483 >>>>>>> remotes/origin/upstream
484 if (perc < 0.0) perc = 0.0;
485 else if (perc > 1.0) perc = 1.0;
486 if (percm < 0.0) percm = 0.0;
487 else if (percm > 1.0) percm = 1.0;
489 minva = atan(minv) / (M_PI / 2);
490 if (minva < 0.0) minva = -minva;
495 if (A < -(h * 20)) A = -h * 20;
499 // rho = is how much the page is turned
501 n = 1.0 - cos(n * M_PI / 2.0);
507 // theta == curliness (how much page culrs in on itself
508 n = sin((1.0 - perc) * M_PI);
512 n = sin((1.0 - perc) * M_PI);
522 if (gszw < 4) gszw = 4;
523 if (gszh < 4) gszh = 4;
525 nw = (w + gszw - 1) / gszw;
526 nh = (h + gszh - 1) / gszh;
527 if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st);
532 st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
533 if (!st->slices) return 0;
534 st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
543 num = (st->slices_w + 1) * (st->slices_h + 1);
545 tvo = alloca(sizeof(Vertex3) * num);
546 tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1));
548 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
554 _deform_point(&vil, &(tvol[col]), rhol, thetal, Al);
557 n = minva * sin(perc * M_PI);
561 for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
563 for (gy = 0; gy <= (h + gszh - 1); gy += gszh)
568 if (gx > w) vi.x = w;
570 if (gy > h) vi.y = h;
572 _deform_point(&vi, &vo, rho, theta, A);
574 if (gy > h) tvo1.y = h;
576 _interp_point(&vo, &tvo1, &(tvo[num]), n);
581 jump = st->slices_h + 1;
582 for (col = 0, gx = 0; gx < w; gx += gszw, col++)
584 num = st->slices_h * col;
588 if ((gx + gw) > w) gw = w - gx;
590 for (row = 0, gy = 0; gy < h; gy += gszh, row++)
594 if (b > 0) nn = num + st->slices_h - row - 1;
598 if ((gy + gh) > h) gh = h - gy;
600 vo[0] = tvo[num2 + row];
601 vo[1] = tvo[num2 + row + jump];
602 vo[2] = tvo[num2 + row + jump + 1];
603 vo[3] = tvo[num2 + row + 1];
604 #define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0)
609 vo[0].y = h - vo[0].y;
610 vo[1].y = h - vo[1].y;
611 vo[2].y = h - vo[2].y;
612 vo[3].y = h - vo[3].y;
619 sl = _slice_new(st, st->front);
623 vo[0].x, vo[0].y, vo[0].z,
624 vo[1].x, vo[1].y, vo[1].z,
625 vo[2].x, vo[2].y, vo[2].z,
626 vo[3].x, vo[3].y, vo[3].z);
630 gx + gw, gy + gh, gx, gy + gh);
633 gx, h - (gy + gh), gx + gw, h - (gy + gh),
634 gx + gw, h - gy, gx, h - gy);
637 sl = st->slices2[nn];
640 sl = _slice_new(st, st->back);
641 st->slices2[nn] = sl;
645 vo[1].x, vo[1].y, vo[1].z,
646 vo[0].x, vo[0].y, vo[0].z,
647 vo[3].x, vo[3].y, vo[3].z,
648 vo[2].x, vo[2].y, vo[2].z);
654 gx, gy + gh, gx + gw, gy + gh);
657 gx + gw, h - (gy + gh), gx, h - (gy + gh),
658 gx, h - gy, gx + gw, h - gy);
664 w - (gx + gw), gy, w - (gx), gy,
665 w - (gx), gy + gh, w - (gx + gw), gy + gh);
668 w - (gx + gw), h - (gy + gh), w - (gx), h - (gy + gh),
669 w - (gx), h - gy, w - (gx + gw), h - gy);
675 for (j = 0; j < st->slices_h; j++)
677 for (i = 0; i < st->slices_w; i++)
679 _slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh);
680 _slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh);
681 _slice_light(st, st->slices[num], ox, oy, ow, oh);
682 _slice_light(st, st->slices2[num], ox, oy, ow, oh);
687 for (i = 0; i <= st->slices_w; i++)
689 num = i * st->slices_h;
690 for (j = 0; j <= st->slices_h; j++)
694 s[0] = s[1] = s[2] = s[3] = NULL;
695 if ((i > 0) && (j > 0))
696 s[0] = st->slices[num - 1 - st->slices_h];
697 if ((i < st->slices_w) && (j > 0))
698 s[1] = st->slices[num - 1];
699 if ((i > 0) && (j < st->slices_h))
700 s[2] = st->slices[num - st->slices_h];
701 if ((i < st->slices_w) && (j < st->slices_h))
702 s[3] = st->slices[num];
704 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
706 else if (st->dir == 1)
707 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
709 else if (st->dir == 2)
710 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
712 else if (st->dir == 3)
713 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
715 s[0] = s[1] = s[2] = s[3] = NULL;
716 if ((i > 0) && (j > 0))
717 s[0] = st->slices2[num - 1 - st->slices_h];
718 if ((i < st->slices_w) && (j > 0))
719 s[1] = st->slices2[num - 1];
720 if ((i > 0) && (j < st->slices_h))
721 s[2] = st->slices2[num - st->slices_h];
722 if ((i < st->slices_w) && (j < st->slices_h))
723 s[3] = st->slices2[num];
725 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
727 else if (st->dir == 1)
728 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
730 else if (st->dir == 2)
731 _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
733 else if (st->dir == 3)
734 _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
741 for (i = 0; i < st->slices_w; i++)
743 for (j = 0; j < st->slices_h; j++)
745 _slice_3d(st, st->slices[num], ox, oy, ow, oh);
746 _slice_3d(st, st->slices2[num], ox, oy, ow, oh);
755 _state_end(State *st)
757 _state_slices_clear(st);
761 _state_anim(void *data, double pos)
766 p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
770 st->x = st->ox * (1.0 - p);
771 else if (st->dir == 1)
772 st->x = st->ox + ((st->w - st->ox) * p);
773 else if (st->dir == 2)
774 st->y = st->oy * (1.0 - p);
775 else if (st->dir == 3)
776 st->y = st->oy + ((st->h - st->oy) * p);
781 st->x = st->ox + ((st->w - st->ox) * p);
782 else if (st->dir == 1)
783 st->x = st->ox * (1.0 - p);
784 else if (st->dir == 2)
785 st->y = st->oy + ((st->h - st->oy) * p);
786 else if (st->dir == 3)
787 st->y = st->oy * (1.0 - p);
790 if (pos < 1.0) return EINA_TRUE;
791 evas_object_show(st->front);
792 evas_object_show(st->back);
799 _update_curl_job(void *data)
803 if (_state_update(st))
805 evas_object_hide(st->front);
806 evas_object_hide(st->back);
811 im_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
814 Evas_Event_Mouse_Down *ev = event_info;
815 Evas_Coord x, y, w, h;
817 if (ev->button != 1) return;
819 st->back = evas_object_data_get(data, "im2");
822 evas_object_geometry_get(st->front, &x, &y, &w, &h);
823 st->x = ev->canvas.x - x;
824 st->y = ev->canvas.y - y;
830 if (_state_update(st))
832 evas_object_hide(st->front);
833 evas_object_hide(st->back);
838 im_up_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
841 Evas_Event_Mouse_Up *ev = event_info;
842 Evas_Coord x, y, w, h;
845 if (ev->button != 1) return;
847 evas_object_geometry_get(st->front, &x, &y, &w, &h);
848 st->x = ev->canvas.x - x;
849 st->y = ev->canvas.y - y;
856 ecore_job_del(st->job);
859 if (st->anim) ecore_animator_del(st->anim);
863 tm = (double)st->x / (double)st->w;
864 if (st->x < (st->w / 2)) st->finish = 1;
866 else if (st->dir == 1)
868 if (st->x > (st->w / 2)) st->finish = 1;
869 tm = 1.0 - ((double)st->x / (double)st->w);
871 else if (st->dir == 2)
873 if (st->y < (st->h / 2)) st->finish = 1;
874 tm = (double)st->y / (double)st->h;
876 else if (st->dir == 3)
878 if (st->y > (st->h / 2)) st->finish = 1;
879 tm = 1.0 - ((double)st->y / (double)st->h);
881 if (tm < 0.01) tm = 0.01;
882 else if (tm > 0.99) tm = 0.99;
883 if (!st->finish) tm = 1.0 - tm;
885 st->anim = ecore_animator_timeline_add(tm, _state_anim, st);
886 _state_anim(st, 0.0);
890 im_move_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
893 Evas_Event_Mouse_Move *ev = event_info;
894 Evas_Coord x, y, w, h;
896 if (!st->down) return;
897 evas_object_geometry_get(st->front, &x, &y, &w, &h);
898 st->x = ev->cur.canvas.x - x;
899 st->y = ev->cur.canvas.y - y;
902 if (st->job) ecore_job_del(st->job);
903 st->job = ecore_job_add(_update_curl_job, st);
907 test_flip_page(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
909 Evas_Object *win, *bg, *im, *im2, *rc;
912 win = elm_win_add(NULL, "flip_page", ELM_WIN_BASIC);
913 elm_win_title_set(win, "Flip Page");
914 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
915 elm_win_autodel_set(win, EINA_TRUE);
917 bg = elm_bg_add(win);
918 elm_win_resize_object_add(win, bg);
919 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
920 evas_object_show(bg);
922 im2 = evas_object_image_filled_add(evas_object_evas_get(win));
923 snprintf(buf, sizeof(buf), "%s/images/%s",
924 elm_app_data_dir_get(), "sky_04.jpg");
925 evas_object_image_file_set(im2, buf, NULL);
926 evas_object_move(im2, 40, 40);
927 evas_object_resize(im2, 400, 400);
928 evas_object_show(im2);
931 im = elm_layout_add(win);
932 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
933 elm_layout_file_set(im, buf, "layout");
935 im = evas_object_image_filled_add(evas_object_evas_get(win));
936 snprintf(buf, sizeof(buf), "%s/images/%s",
937 elm_app_data_dir_get(), "twofish.jpg");
938 evas_object_image_file_set(im, buf, NULL);
940 evas_object_move(im, 40, 40);
941 evas_object_resize(im, 400, 400);
942 evas_object_show(im);
944 evas_object_data_set(im, "im2", im2);
947 rc = evas_object_rectangle_add(evas_object_evas_get(win));
948 evas_object_color_set(rc, 0, 0, 0, 0);
949 evas_object_move(rc, 40, 340);
950 evas_object_resize(rc, 400, 100);
951 evas_object_show(rc);
953 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
954 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
955 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
957 rc = evas_object_rectangle_add(evas_object_evas_get(win));
958 evas_object_color_set(rc, 0, 0, 0, 0);
959 evas_object_move(rc, 40, 40);
960 evas_object_resize(rc, 400, 100);
961 evas_object_show(rc);
963 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
964 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
965 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
967 rc = evas_object_rectangle_add(evas_object_evas_get(win));
968 evas_object_color_set(rc, 0, 0, 0, 0);
969 evas_object_move(rc, 340, 40);
970 evas_object_resize(rc, 100, 400);
971 evas_object_show(rc);
973 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
974 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
975 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
977 rc = evas_object_rectangle_add(evas_object_evas_get(win));
978 evas_object_color_set(rc, 0, 0, 0, 0);
979 evas_object_move(rc, 40, 40);
980 evas_object_resize(rc, 100, 400);
981 evas_object_show(rc);
983 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, im);
984 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_UP, im_up_cb, im);
985 evas_object_event_callback_add(rc, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, im);
987 evas_object_resize(win, 480, 480);
988 evas_object_show(win);