/* setup */ static void _setup(void) { int i; Evas_Object *o; o = evas_object_image_add(evas); o_mask = o; evas_object_image_file_set(o, build_path("e-logo-mask.png"), NULL); evas_object_image_fill_set(o, 0, 0, 720, 420); evas_object_resize(o, 720, 420); evas_object_move(o, (win_w - 720) / 2, (win_h - 420) / 2); evas_object_show(o); for (i = 0; i < OBNUM; i++) { o = evas_object_image_add(evas); o_images[i] = o; evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_fill_set(o, 0, 0, 120, 160); evas_object_resize(o, 120, 160); evas_object_image_smooth_scale_set(o, 1); evas_object_clip_set(o, o_mask); evas_object_show(o); } done = 0; }
static Evas_Object *_ewk_view_single_smart_backing_store_add(Ewk_View_Smart_Data *sd) { Evas_Object *bs = evas_object_image_add(sd->base.evas); evas_object_image_alpha_set(bs, EINA_FALSE); evas_object_image_smooth_scale_set(bs, sd->zoom_weak_smooth_scale); return bs; }
EAPI void emotion_object_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth) { Smart_Data *sd; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); evas_object_image_smooth_scale_set(sd->obj, smooth); }
static Cube * _cube_new(Evas *evas, Evas_Coord w, Evas_Coord h, Evas_Coord d) { Cube *c; int i; w -= (w / 2); h -= (h / 2); d -= (d / 2); c = calloc(1, sizeof(Cube)); for (i = 0; i < 6; i++) { Evas_Object *o; char buf[PATH_MAX]; o = evas_object_image_add(evas); c->side[i].o = o; snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "twofish.jpg"); evas_object_image_file_set(o, buf, NULL); evas_object_image_fill_set(o, 0, 0, 256, 256); evas_object_resize(o, 256, 256); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } POINT(0, 0, -w, -h, -d, 0, 0); POINT(0, 1, w, -h, -d, 256, 0); POINT(0, 2, w, h, -d, 256, 256); POINT(0, 3, -w, h, -d, 0, 256); POINT(1, 0, w, -h, -d, 0, 0); POINT(1, 1, w, -h, d, 256, 0); POINT(1, 2, w, h, d, 256, 256); POINT(1, 3, w, h, -d, 0, 256); POINT(2, 0, w, -h, d, 0, 0); POINT(2, 1, -w, -h, d, 256, 0); POINT(2, 2, -w, h, d, 256, 256); POINT(2, 3, w, h, d, 0, 256); POINT(3, 0, -w, -h, d, 0, 0); POINT(3, 1, -w, -h, -d, 256, 0); POINT(3, 2, -w, h, -d, 256, 256); POINT(3, 3, -w, h, d, 0, 256); POINT(4, 0, -w, -h, d, 0, 0); POINT(4, 1, w, -h, d, 256, 0); POINT(4, 2, w, -h, -d, 256, 256); POINT(4, 3, -w, -h, -d, 0, 256); POINT(5, 0, -w, h, -d, 0, 0); POINT(5, 1, w, h, -d, 256, 0); POINT(5, 2, w, h, d, 256, 256); POINT(5, 3, -w, h, d, 0, 256); return c; }
EAPI void e_icon_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; if (sd->edje) return; evas_object_image_smooth_scale_set(sd->obj, smooth); }
static Cube * _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) { Cube *c; int i; w -= (w / 2); h -= (h / 2); d -= (d / 2); c = calloc(1, sizeof(Cube)); for (i = 0; i < 6; i++) { Evas_Object *o; char buf[256]; o = evas_object_image_add(evas); c->side[i].o = o; snprintf(buf, sizeof(buf), "im%i.png", (i % 2) + 1); evas_object_image_file_set(o, build_path(buf), NULL); evas_object_image_fill_set(o, 0, 0, 720, 420); evas_object_resize(o, 720, 420); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } POINT(0, 0, -w, -h, -d, 0, 0); POINT(0, 1, w, -h, -d, 720, 0); POINT(0, 2, w, h, -d, 720, 420); POINT(0, 3, -w, h, -d, 0, 420); POINT(1, 0, w, -h, -d, 0, 0); POINT(1, 1, w, -h, d, 720, 0); POINT(1, 2, w, h, d, 720, 420); POINT(1, 3, w, h, -d, 0, 420); POINT(2, 0, w, -h, d, 0, 0); POINT(2, 1, -w, -h, d, 720, 0); POINT(2, 2, -w, h, d, 720, 420); POINT(2, 3, w, h, d, 0, 420); POINT(3, 0, -w, -h, d, 0, 0); POINT(3, 1, -w, -h, -d, 720, 0); POINT(3, 2, -w, h, -d, 720, 420); POINT(3, 3, -w, h, d, 0, 420); POINT(4, 0, -w, -h, d, 0, 0); POINT(4, 1, w, -h, d, 720, 0); POINT(4, 2, w, -h, -d, 720, 420); POINT(4, 3, -w, -h, -d, 0, 420); POINT(5, 0, -w, h, -d, 0, 0); POINT(5, 1, w, h, -d, 720, 0); POINT(5, 2, w, h, d, 720, 420); POINT(5, 3, -w, h, d, 0, 420); return c; }
EAPI void e_icon_smooth_scale_set(Evas_Object *obj, int smooth) { E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return; if (!strcmp(evas_object_type_get(sd->obj), "edje")) return; evas_object_image_smooth_scale_set(sd->obj, smooth); }
static Evas_Object* _ewk_view_single_smart_backing_store_add(Ewk_View_Smart_Data* smartData) { Evas_Object* bs = evas_object_image_add(smartData->base.evas); EINA_SAFETY_ON_NULL_RETURN_VAL(bs, 0); const Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); const char* engine = ecore_evas_engine_name_get(ecoreEvas); if (!strncmp(engine, "opengl_x11", strlen("opengl_x11"))) evas_object_image_content_hint_set(bs, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); evas_object_image_alpha_set(bs, false); evas_object_image_smooth_scale_set(bs, smartData->zoom_weak_smooth_scale); return bs; }
/* setup */ static void _setup(void) { int i; Evas_Object *o; for (i = 0; i < OBNUM; i++) { o = evas_object_image_add(evas); o_images[i] = o; evas_object_image_file_set(o, build_path("image.png"), NULL); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } done = 0; }
static Evas_Object *_ewk_view_single_smart_backing_store_add(Ewk_View_Smart_Data *sd) { Evas_Object *bs = evas_object_image_add(sd->base.evas); Evas_Object *clip = evas_object_rectangle_add(sd->base.evas); evas_object_image_alpha_set(bs, EINA_FALSE); evas_object_image_smooth_scale_set(bs, sd->zoom_weak_smooth_scale); evas_object_clip_set(bs, clip); evas_object_show(clip); evas_object_event_callback_add (bs, EVAS_CALLBACK_DEL, _ewk_view_single_on_del, clip); return bs; }
/* setup */ static void _setup(void) { int i; Evas_Object *o; for (i = 0; i < (OBNUM / 2); i++) { o = evas_object_image_add(evas); o_images[i] = o; evas_object_image_file_set(o, build_path("logo.png"), NULL); evas_object_image_fill_set(o, 0, 0, 120, 160); evas_object_resize(o, 120, 160); evas_object_image_smooth_scale_set(o, 0); evas_object_show(o); } done = 0; }
static void _ewk_view_single_smart_zoom_weak_smooth_scale_set(Ewk_View_Smart_Data *sd, Eina_Bool smooth_scale) { evas_object_image_smooth_scale_set(sd->backing_store, smooth_scale); }
int main(int argc, char *argv[]) { Ecore_Evas *ee; Evas_Object *bridge, *img; const char *opt, *input, *output, *params; int r = 0, w = -1, h = -1, err; double scale = -1.0; if (argc < 4) { fprintf(stderr, "Usage:\n" "\t%s <percentage%%|WxH|w=W|h=H> <input> <output>" " [save-params]\n" "where save-params is evas supported parameters, like:\n" "\tquality=85\n" "\tcompress=9\n", argv[0]); return 1; } opt = argv[1]; input = argv[2]; output = argv[3]; params = argv[4]; if (strncasecmp(opt, "w=", 2) == 0) { char *end = NULL; w = strtol(opt + 2, &end, 10); if (!end || *end != '\0') { fprintf(stderr, "ERROR: invalid decimal integer '%s'\n", opt + 2); return 1; } else if (w < 1) { fprintf(stderr, "ERROR: invalid width %d, must be >= 1\n", w); return 1; } } else if (strncasecmp(opt, "h=", 2) == 0) { char *end = NULL; h = strtol(opt + 2, &end, 10); if (!end || *end != '\0') { fprintf(stderr, "ERROR: invalid decimal integer '%s'\n", opt + 2); return 1; } else if (h < 1) { fprintf(stderr, "ERROR: invalid height %d, must be >= 1\n", h); return 1; } } else if (strchr(opt, '%')) { char *end = NULL; scale = strtod(opt, &end); if (!end || *end != '%') { fprintf(stderr, "ERROR: invalid percentual '%s'\n", opt); return 1; } else if (scale <= 0.0) { fprintf(stderr, "ERROR: invalid percentual %g, must be > 0.0\n", scale); return 1; } scale /= 100.0; } else if (strchr(opt, 'x')) { if (sscanf(opt, "%dx%d", &w, &h) != 2) { fprintf(stderr, "ERROR: invalid size format '%s'\n", opt); return 1; } else if (w < 1) { fprintf(stderr, "ERROR: invalid width %d, must be >= 1\n", w); return 1; } else { fprintf(stderr, "ERROR: invalid height %d, must be >= 1\n", h); return 1; } } else { fprintf(stderr, "ERROR: first parameter must be in format:\n" "\tpercentage%% - example: 10%%\n" "\tWxH - example: 1024x768\n" "\tw=W - example: w=1024\n" "\th=H - example: h=768\n" "But '%s' was used!\n", opt); return 1; } ecore_evas_init(); evas_init(); ee = ecore_evas_buffer_new(1, 1); bridge = ecore_evas_object_image_new(ee); img = evas_object_image_add(ecore_evas_object_evas_get(bridge)); evas_object_image_smooth_scale_set(img, EINA_TRUE); if (w > 0 && h > 0) evas_object_image_load_size_set(img, w, h); evas_object_image_file_set(img, input, NULL); err = evas_object_image_load_error_get(img); if (err != EVAS_LOAD_ERROR_NONE) { const char *msg = evas_load_error_str(err); fprintf(stderr, "ERROR: could not load '%s': %s\n", input, msg); r = 1; goto end; } if (w < 1 || h < 1) { int iw, ih; evas_object_image_size_get(img, &iw, &ih); if (iw < 0 || ih < 0) { fprintf(stderr, "ERROR: invalid source image size %dx%d (%s)\n", iw, ih, input); goto end; } if (scale > 0) { w = ceil(iw * scale); h = ceil(ih * scale); } else if (w < 1) w = ceil(iw * (double)h / (double)ih); else if (h < 1) h = ceil(ih * (double)w / (double)iw); if (iw != w && ih != h) evas_object_image_load_size_set(img, w, h); } printf("output: %s, size: %dx%d, alpha: %s, params: %s\n", output, w, h, evas_object_image_alpha_get(img) ? "yes" : "no", params ? params : "<none>"); evas_object_image_fill_set(img, 0, 0, w, h); evas_object_resize(img, w, h); evas_object_show(img); evas_object_image_alpha_set(bridge, evas_object_image_alpha_get(img)); evas_object_image_size_set(bridge, w, h); ecore_evas_manual_render(ecore_evas_object_ecore_evas_get(bridge)); evas_object_image_save(bridge, output, NULL, params); end: evas_object_del(img); evas_object_del(bridge); ecore_evas_free(ee); evas_shutdown(); ecore_evas_shutdown(); return r; }