Eina_Bool animator_rotate_dashes(animator_callback_gui_shared_info_s *common_data) { int i; static int curr_step = 1; if (common_data->rotation.direction == LEFT){ curr_step--; } else { curr_step++; } double angle = curr_step * common_data->game.rotation_degree * common_data->game.turning_speed * REFRESH_SPEED; Evas_Coord x,y,w,h; Evas_Object **dashes = common_data->gui.dashes; /* array! */ Evas_Map *dashes_maps[DASHES_COUNT]; for (i=0;i<DASHES_COUNT;i++) { dashes_maps[i] = evas_map_new(4); evas_object_geometry_get(dashes[i], &x, &y, &w, &h); evas_map_util_points_populate_from_object(dashes_maps[i], dashes[i]); evas_map_util_rotate(dashes_maps[i], DASHES_INIT[i].rotation, x + DASH_LEN/2, y + DASH_LEN/2); evas_map_util_rotate(dashes_maps[i], angle, CENTER_X, CENTER_Y); evas_object_map_set(dashes[i], dashes_maps[i]); evas_object_map_enable_set(dashes[i], EINA_TRUE); evas_map_free(dashes_maps[i]); } #ifdef does_not_want_inertion if (--common_data->steps == 0) #endif ecore_animator_freeze(common_data->dash_animator); return ECORE_CALLBACK_RENEW; }
Evas_Map * efx_map_new(Evas_Object *obj) { Evas_Map *map; map = evas_map_new(4); evas_map_smooth_set(map, EINA_FALSE); evas_map_util_points_populate_from_object(map, obj); return map; (void)efx_speed_str; }
int main(void) { id_keeper = id_keeper_init(1000); //хеш хранения всех объектов по id struct ui_object wconf; wconf.h = 800; wconf.w = 1600; int64_t main_id = ui_frame_create_window(&wconf); //printf("id is %d\n", main_id); //struct ui_frame *main = (struct ui_frame*) id_keeper->id_array[main_id]; // printf("Hello %d\n", main->canvas); //Evas_Object *bg, *r1, *r2, *r3; //bg = evas_object_rectangle_add(main->canvas); //evas_object_color_set(bg, 255, 255, 255,150); // white bg //evas_object_move(bg, 100, 100); // at origin //evas_object_resize(bg, main->ui.w, main->ui.h); // covers full canvas //evas_object_show(bg); // Evas_Object *grid = evas_object_grid_add(main->canvas); //evas_object_grid_size_set(grid, 400, 400); //evas_object_show(grid); struct ui_object frame_ui; frame_ui.h = 600; frame_ui.w = 1000; int64_t main_f = ui_evas_frame_create(main_id, &frame_ui); //Evas_Object *main_f = evas_smart_frame_add(main->canvas); //evas_object_move(main_f, 20, 20); // evas_object_resize(main_f, 100, 100); //evas_object_show(main_f); //rotate Evas_Map *m = evas_map_new(4); evas_map_util_points_populate_from_object(m, main_f); int cx, cy, cw, ch; evas_object_geometry_get(main_f, &cx, &cy, &cw, &ch); evas_map_util_rotate(m, 30, cx + cw, cy + ch); evas_object_map_enable_set(main_f, EINA_TRUE); evas_object_map_set(main_f, m); puts("initial scene, with just background:"); /* // Evas_Object *cube = evas_object_rectangle_add(canvas_win); Evas_Object *cube = evas_object_image_filled_add(main->canvas); evas_object_image_file_set(cube, "./balalaika.svg", NULL); evas_object_color_set(cube, 0, 255, 255, 200); // white bg evas_object_move(cube, 700, 400); // at origin int csize[2]; csize[0] = 30; csize[1] = 20; int cpos[2]; cpos[0] = 700; cpos[1] = 400; // evas_object_resize(cube, csize[0], csize[1]); // covers full canvas evas_object_resize(cube, 400, 300); // covers full canvas evas_object_show(cube); // evas_object_anti_alias_set(cube, 1); // evas_object_render_op_set(cube, EVAS_RENDER_BLEND); // evas_object_image_smooth_scale_set(cube, EINA_TRUE); int deg = 1; int cx, cy, cw, ch; Evas_Map *m = evas_map_new(4); // evas_map_point_image_uv_set(m, 0, 0, 0); // evas_map_point_image_uv_set(m, 1, 150, 0); //evas_map_point_image_uv_set(m, 2, 150, 200); //evas_map_point_image_uv_set(m, 3, 0, 200); Ecore_Task_Cb _cube_anim(void *data){ evas_map_util_points_populate_from_object(m, cube); evas_object_geometry_get(cube, &cx, &cy, &cw, &ch); evas_map_util_rotate(m, ++deg, cx + cw, cy + ch); evas_object_map_enable_set(cube, EINA_TRUE); evas_object_map_set(cube, m); evas_object_move(cube, (cpos[0] = cpos[0] - 5) >=0 ? cpos[0] : 0, (cpos[1] = cpos[1] - 5) >=0 ? cpos[1] : 0); evas_object_resize(cube, csize[0] = csize[0] + 1, csize[1] = csize[1] + 1); //evas_object_image_filled_set(cube, EINA_TRUE); //evas_render(canvas_win); return ECORE_CALLBACK_DONE; // Ecore_Timer *timer1 = ecore_timer_loop_add(0.4, timer_func, NULL); } ecore_animator_frametime_set(1./30); Ecore_Animator *anim = ecore_animator_add(_cube_anim,cube); // ecore_animator_timeline_add(20,_cube_anim, cube); ecore_animator_thaw(anim); */ ecore_main_loop_begin(); //ecore_animator_del(anim); //evas_map_free(m); //*/ // destroy_canvas(main->datacanvas); evas_shutdown(); return 0; }
int main(int argc, char** argv) { Eina_Bool ret; Ecore_Evas *ecore_evas; Evas *evas; Evas_Object *bg, *video; Evas_Map *m; if(argc != 2) { fprintf(stderr, "Usage: %s moviefile\n", argv[0]); return 1; } ecore_init(); ecore_evas_init(); emotion_init(); ecore_evas = ecore_evas_new ("software_x11", 300, 200, WINDOW_WIDTH, WINDOW_HEIGHT, NULL); if (!ecore_evas) goto end; ecore_evas_callback_delete_request_set(ecore_evas, main_delete_request); // ecore_evas_callback_resize_set(ecore_evas, main_resize); ecore_evas_title_set(ecore_evas, "Evas Media Test Program"); // ecore_evas_name_class_set(ecore_evas, "evas_media_test", "main"); ecore_evas_show(ecore_evas); evas = ecore_evas_get(ecore_evas); bg = evas_object_rectangle_add(evas); evas_object_color_set(bg, 0x00, 0x00, 0x00, 0xff); evas_object_move(bg, 0, 0); evas_object_resize(bg, WINDOW_WIDTH, WINDOW_HEIGHT); evas_object_show(bg); video = emotion_object_add(evas); evas_object_move(video, 0, 0); evas_object_resize(video, WINDOW_WIDTH, WINDOW_HEIGHT); ret = emotion_object_init(video, "gstreamer"); if(ret != EINA_TRUE) { fprintf(stderr, "faild to emotion_object_init\n"); goto end; } ret = emotion_object_file_set(video, argv[1]); if(ret != EINA_TRUE) { fprintf(stderr, "emotion_object_file_set\n"); goto end; } emotion_object_play_set(video, EINA_TRUE); evas_object_show(video); m = evas_map_new(4); evas_map_util_points_populate_from_object(m, video); // 2d rotate // evas_map_util_rotate(m, 90, 0 + (WINDOW_WIDTH/2), 0 + (WINDOW_HEIGHT/2)); // 3d rotate //evas_map_util_3d_rotate(m, 10.0, 10.0, 0.0, 0, 0, 0); evas_object_map_set(video, m); evas_object_map_enable_set(video, EINA_TRUE); ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, key_cb, video); ecore_main_loop_begin(); end: if(ecore_evas) ecore_evas_free(ecore_evas); evas_map_free(m); emotion_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); return 0; }
static Eina_Bool _anim_cb(void *data) { App_Data *ad = data; Evas_Map *m; Evas_Object *o; int r, g, b, a; int win_w, win_h, img_w, img_h; Evas_Coord x, y, w, h; evas_output_size_get(ad->canvas, &win_w, &win_h); m = evas_map_new(4); evas_map_smooth_set(m, ad->smooth); evas_map_alpha_set(m, ad->alpha); r = ad->colors[ad->colors_index].r; g = ad->colors[ad->colors_index].g; b = ad->colors[ad->colors_index].b; a = ad->colors[ad->colors_index].a; evas_map_util_points_color_set(m, r, g, b, a); o = evas_object_name_find(ad->canvas, "obj1"); evas_object_geometry_get(o, &x, &y, &w, &h); evas_map_util_points_populate_from_object(m, o); evas_map_util_rotate(m, 3 * ad->frame, x + (w / 2), y + (h / 2)); evas_object_map_set(o, m); evas_object_map_enable_set(o, EINA_TRUE); o = evas_object_name_find(ad->canvas, "obj2"); evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_image_size_get(o, &img_w, &img_h); evas_map_util_points_populate_from_object_full(m, o, 100); evas_map_point_image_uv_set(m, 0, 0, 0); evas_map_point_image_uv_set(m, 1, img_w, 0); evas_map_point_image_uv_set(m, 2, img_w, img_h); evas_map_point_image_uv_set(m, 3, 0, img_h); evas_map_util_3d_rotate(m, ad->frame * 6, ad->frame * 6, ad->frame * 6, x + (w / 3), y + 10, 0); if (ad->apply_lighting) evas_map_util_3d_lighting(m, win_w / 2, win_h / 2, -100, 255, 255, 255, 0, 0, 0); evas_object_map_set(o, m); evas_object_map_enable_set(o, EINA_TRUE); o = evas_object_name_find(ad->canvas, "obj3"); evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_image_size_get(o, &img_w, &img_h); evas_map_util_points_populate_from_geometry(m, x, y + (h / 2), w, h, -20); evas_map_point_image_uv_set(m, 0, 0, 0); evas_map_point_image_uv_set(m, 1, img_w, 0); evas_map_point_image_uv_set(m, 2, img_w, img_h); evas_map_point_image_uv_set(m, 3, 0, img_h); evas_map_util_3d_rotate(m, 20, ad->frame * 6, 0, x + (w / 2), y + (w / 2), w / 2); if (ad->apply_perspective) evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 256); if (ad->apply_lighting) { Evas_Coord mx, my; evas_pointer_canvas_xy_get(ad->canvas, &mx, &my); evas_map_util_3d_lighting(m, mx, my, -256, 255, 255, 255, 0, 0, 0); } if (ad->backface_culling) { if (evas_map_util_clockwise_get(m)) evas_object_show(o); else evas_object_hide(o); } else evas_object_show(o); evas_object_map_set(o, m); evas_object_map_enable_set(o, EINA_TRUE); evas_map_free(m); o = evas_object_name_find(ad->canvas, "obj4"); evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_image_size_get(o, &img_w, &img_h); m = evas_map_new(4); evas_map_point_coord_set(m, 0, x, y + h, 0); evas_map_point_coord_set(m, 1, x + w, y + h, 0); evas_map_point_coord_set(m, 2, win_w - 10, win_h - 30, 0); evas_map_point_coord_set(m, 3, (win_w / 2) + 10, win_h - 30, 0); evas_map_point_image_uv_set(m, 0, 0, img_h); evas_map_point_image_uv_set(m, 1, img_w, img_h); evas_map_point_image_uv_set(m, 2, img_w, 2 * (img_h / 3)); evas_map_point_image_uv_set(m, 3, 0, 2 * (img_h / 3)); evas_map_point_color_set(m, 0, 200, 200, 200, 150); evas_map_point_color_set(m, 1, 200, 200, 200, 150); evas_map_point_color_set(m, 2, 0, 0, 0, 0); evas_map_point_color_set(m, 3, 0, 0, 0, 0); evas_object_map_set(o, m); evas_object_map_enable_set(o, EINA_TRUE); evas_map_free(m); ad->frame = (ad->frame + 1) % 60; return EINA_TRUE; }