Evas_Map *m;
Slice *sl;
int rad;
-
+
evas_object_geometry_get(st->orig, &x, &y, &w, &h);
x1 = st->down_x;
y1 = st->down_y;
y2 = st->y;
mx = (x1 + x2) / 2;
my = (y1 + y2) / 2;
-
+
if (mx < 0) mx = 0;
else if (mx >= w) mx = w - 1;
if (my < 0) my = 0;
else if (my >= h) my = h - 1;
-
+
if (!st->base)
{
st->base = evas_object_image_add(evas_object_evas_get(st->win));
evas_object_image_source_set(st->base, st->orig);
evas_object_show(st->base);
}
-
+
m = evas_map_new(4);
evas_map_smooth_set(m, 0);
evas_map_point_coord_set(m, 1, x + mx, y , 0);
evas_map_point_coord_set(m, 2, x + mx, y + h, 0);
evas_map_point_coord_set(m, 3, x , y + h, 0);
-
+
evas_map_point_image_uv_set(m, 0, 0 , 0);
evas_map_point_image_uv_set(m, 1, mx, 0);
evas_map_point_image_uv_set(m, 2, mx, h);
evas_map_point_color_set(m, 1, 255, 255, 255, 255);
evas_map_point_color_set(m, 2, 255, 255, 255, 255);
evas_map_point_color_set(m, 3, 255, 255, 255, 255);
-
+
/*
// FIXME: lighting should be manual with pt 0 and 3 being white and
- // 2 and 3 matching the
- evas_map_util_3d_lighting(m,
+ // 2 and 3 matching the
+ evas_map_util_3d_lighting(m,
0 , 0 , -1000,
255, 255, 255,
20 , 20 , 20);
*/
evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 512);
-
+
evas_object_map_enable_set(st->base, 1);
evas_object_map_set(st->base, m);
evas_map_free(m);
-
+
EINA_LIST_FREE(st->slices, sl)
{
evas_object_del(sl->obj);
free(sl);
}
-
+
// cylinder radius is width / 8
rad = (w - mx) / 4;
if (rad < (w / 16)) rad = (w / 16);
if (rad > (w / 8)) rad = w / 8;
-
+
rad = w / 12;
-
+
px = mx;
prx = 0;
pry = rad;
evas_object_pass_events_set(sl->obj, 1);
evas_object_image_source_set(sl->obj, st->orig);
evas_object_show(sl->obj);
-
+
rx = (double)rad * sin((i * M_PI) / RES);
ry = (double)rad * cos((i * M_PI) / RES);
dx = rx - prx;
ry = pry + (((ry - pry) * dst) / pdst);
}
if (dst <= 0) break;
-
+
m = evas_map_new(4);
evas_map_smooth_set(m, 0);
evas_map_point_coord_set(m, 1, x + mx + rx , y , 0 - (rad - ry ));
evas_map_point_coord_set(m, 2, x + mx + rx , y + h, 0 - (rad - ry ));
evas_map_point_coord_set(m, 3, x + mx + prx, y + h, 0 - (rad - pry));
-
+
evas_map_point_image_uv_set(m, 0, px , 0);
evas_map_point_image_uv_set(m, 1, px + dst, 0);
evas_map_point_image_uv_set(m, 2, px + dst, h);
evas_map_point_image_uv_set(m, 3, px , h);
-
+
evas_map_point_color_set(m, 0, 255, 255, 255, 255);
evas_map_point_color_set(m, 1, 255, 255, 255, 255);
evas_map_point_color_set(m, 2, 255, 255, 255, 255);
evas_map_point_color_set(m, 3, 255, 255, 255, 255);
-
+
evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 512);
-
+
evas_object_map_enable_set(sl->obj, 1);
evas_object_map_set(sl->obj, m);
evas_map_free(m);
-
+
prx = rx;
pry = ry;
px += dst;
evas_object_pass_events_set(sl->obj, 1);
evas_object_image_source_set(sl->obj, st->orig);
evas_object_show(sl->obj);
-
+
m = evas_map_new(4);
evas_map_smooth_set(m, 0);
evas_map_point_coord_set(m, 1, x + mx + (px - w) , y , 0 - (rad * 2 ));
evas_map_point_coord_set(m, 2, x + mx + (px - w) , y + h, 0 - (rad * 2 ));
evas_map_point_coord_set(m, 3, x + mx + prx, y + h, 0 - (rad - pry));
-
+
evas_map_point_image_uv_set(m, 0, px , 0);
evas_map_point_image_uv_set(m, 1, w, 0);
evas_map_point_image_uv_set(m, 2, w, h);
evas_map_point_image_uv_set(m, 3, px , h);
-
+
evas_map_point_color_set(m, 0, 255, 255, 255, 255);
evas_map_point_color_set(m, 1, 255, 255, 255, 255);
evas_map_point_color_set(m, 2, 255, 255, 255, 255);
evas_map_point_color_set(m, 3, 255, 255, 255, 255);
-
+
evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 512);
-
+
evas_object_map_enable_set(sl->obj, 1);
evas_object_map_set(sl->obj, m);
evas_map_free(m);
Evas_Event_Mouse_Up *ev = event_info;
Evas_Object *win = data;
Evas_Coord x, y;
-
+
if (ev->button != 1) return;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
state.down = 0;
Evas_Event_Mouse_Move *ev = event_info;
Evas_Object *win = data;
Evas_Coord x, y;
-
+
if (!state.down) return;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
state.x = ev->cur.canvas.x - x;
im = elm_layout_add(win);
snprintf(buf, sizeof(buf), "%s/objects/test.edj", PACKAGE_DATA_DIR);
elm_layout_file_set(im, buf, "layout");
-#else
+#else
im = evas_object_image_filled_add(evas_object_evas_get(win));
snprintf(buf, sizeof(buf), "%s/images/%s",
PACKAGE_DATA_DIR, "twofish.jpg");
evas_object_image_file_set(im, buf, NULL);
-#endif
+#endif
evas_object_move(im, 40, 40);
evas_object_resize(im, 400, 400);
evas_object_show(im);
evas_object_event_callback_add(im, EVAS_CALLBACK_MOUSE_DOWN, im_down_cb, win);
evas_object_event_callback_add(im, EVAS_CALLBACK_MOUSE_UP, im_up_cb, win);
evas_object_event_callback_add(im, EVAS_CALLBACK_MOUSE_MOVE, im_move_cb, win);
-
+
evas_object_resize(win, 480, 480);
evas_object_show(win);
}
_ch_grid(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
int x, y, w, h;
-
+
elm_grid_pack_get(obj, &x, &y, &w, &h);
elm_grid_pack_set(obj, x - 1, y - 1, w + 2, h + 2);
}
elm_scrolled_entry_single_line_set(en, 1);
elm_grid_pack(gd, en, 50, 10, 40, 10);
evas_object_show(en);
-
+
en = elm_scrolled_entry_add(win);
elm_scrolled_entry_entry_set(en, "Entry text 2");
elm_scrolled_entry_single_line_set(en, 1);
elm_grid_pack(gd, en, 60, 20, 30, 10);
evas_object_show(en);
-
+
bt = elm_button_add(win);
elm_button_label_set(bt, "Button");
elm_grid_pack(gd, bt, 0, 0, 20, 20);
elm_grid_pack(gd, bt, 40, 40, 20, 20);
evas_object_smart_callback_add(bt, "clicked", _ch_grid, gd);
evas_object_show(bt);
-
+
rc = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(rc, 128, 0, 0, 128);
elm_grid_pack(gd, rc, 40, 70, 20, 10);