1 #include <Elementary.h>
5 * @defgroup Photocam Photocam
8 * This is a widget specifically for displaying high-resolution digital
9 * camera photos giving speedy feedback (fast load), low memory footprint
10 * and zooming and panning as well as fitting logic. It is entirely focused
11 * on jpeg images, and takes advantage of properties of the jpeg format (via
12 * evas loader features in the jpeg loader).
14 * Signals that you can add callbacks for are:
16 * "clicked" - This is called when a user has clicked the photo without dragging
18 * "press" - This is called when a user has pressed down on the photo.
19 * "longpressed" - This is called when a user has pressed down on the photo for
20 * a long time without dragging around.
21 * "clicked,double" - This is called when a user has double-clicked the photo.
22 * "load" - Photo load begins.
23 * "loaded" - This is called when the image file load is complete for the first
24 * view (low resolution blurry version).
25 * "load,details" - Photo detailed data load begins.
26 * "loaded,details" - This is called when the image file load is complete for
27 * the detailed image data (full resolution needed).
28 * "zoom,start" - Zoom animation started.
29 * "zoom,stop" - Zoom animation stopped.
30 * "zoom,change" - Zoom changed when using an auto zoom mode.
31 * "scroll" - the content has been scrolled (moved)
32 * "scroll,anim,start" - scrolling animation has started
33 * "scroll,anim,stop" - scrolling animation has stopped
34 * "scroll,drag,start" - dragging the contents around has started
35 * "scroll,drag,stop" - dragging the contents around has stopped
39 * TODO (maybe - optional future stuff):
41 * 1. wrap photo in theme edje so u can have styling around photo (like white
44 * 3. rotation flags in exif handling (nasty! should have rot in evas)
47 typedef struct _Widget_Data Widget_Data;
48 typedef struct _Pan Pan;
49 typedef struct _Grid Grid;
50 typedef struct _Grid_Item Grid_Item;
66 int tsize; // size of tile (tsize x tsize pixels)
67 int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8)
68 int iw, ih; // size of image in pixels
69 int w, h; // size of grid image in pixels (represented by grid)
70 int gw, gh; // size of grid in tiles
71 Grid_Item *grid; // the grid (gw * gh items)
72 Eina_Bool dead : 1; // old grid. will die as soon as anim is over
79 Evas_Object *pan_smart;
81 Evas_Coord pan_x, pan_y, minw, minh;
84 Elm_Photocam_Zoom_Mode mode;
88 Ecore_Timer *scr_timer;
89 Ecore_Timer *long_timer;
90 Ecore_Animator *zoom_animator;
91 double t_start, t_end;
105 Evas_Coord x, y ,w ,h;
108 Evas_Object *img; // low res version of image (scale down == 8)
112 Eina_Bool main_load_pending : 1;
113 Eina_Bool resized : 1;
114 Eina_Bool longpressed : 1;
115 Eina_Bool on_hold : 1;
116 Eina_Bool paused : 1;
121 Evas_Object_Smart_Clipped_Data __clipped_data;
125 static const char *widtype = NULL;
126 static void _del_hook(Evas_Object *obj);
127 static void _theme_hook(Evas_Object *obj);
128 static void _on_focus_hook(void *data, Evas_Object *obj);
129 //static void _show_region_hook(void *data, Evas_Object *obj);
130 static void _sizing_eval(Evas_Object *obj);
131 static void _calc_job(void *data);
132 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
133 Evas_Callback_Type type, void *event_info);
134 static void grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh);
135 static void grid_clear(Evas_Object *obj, Grid *g);
136 static Grid *grid_create(Evas_Object *obj);
137 static void grid_load(Evas_Object *obj, Grid *g);
140 nearest_pow2(int num)
142 unsigned int n = num - 1;
152 img_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
154 Widget_Data *wd = elm_widget_data_get(obj);
155 Evas_Coord ax, ay, gw, gh;
161 if (ow > gw) ax = (ow - gw) / 2;
162 if (oh > gh) ay = (oh - gh) / 2;
163 evas_object_move(wd->img, ox + 0 - px + ax, oy + 0 - py + ay);
164 evas_object_resize(wd->img, gw, gh);
168 wd->show.show = EINA_FALSE;
169 elm_smart_scroller_child_region_show(wd->scr, wd->show.x, wd->show.y, wd->show.w, wd->show.h);
174 grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
176 Widget_Data *wd = elm_widget_data_get(obj);
177 Evas_Coord ax, ay, gw, gh, tx, ty;
184 if (ow > gw) ax = (ow - gw) / 2;
185 if (oh > gh) ay = (oh - gh) / 2;
186 for (y = 0; y < g->gh; y++)
188 for (x = 0; x < g->gw; x++)
190 int tn, xx, yy, ww, hh;
192 tn = (y * g->gw) + x;
193 xx = g->grid[tn].out.x;
194 yy = g->grid[tn].out.y;
195 ww = g->grid[tn].out.w;
196 hh = g->grid[tn].out.h;
197 if ((gw != g->w) && (g->w > 0))
200 xx = (gw * xx) / g->w;
201 ww = ((gw * (tx + ww)) / g->w) - xx;
203 if ((gh != g->h) && (g->h > 0))
206 yy = (gh * yy) / g->h;
207 hh = ((gh * (ty + hh)) / g->h) - yy;
209 evas_object_move(g->grid[tn].img,
212 evas_object_resize(g->grid[tn].img, ww, hh);
218 grid_clear(Evas_Object *obj, Grid *g)
220 Widget_Data *wd = elm_widget_data_get(obj);
223 if (!g->grid) return;
224 for (y = 0; y < g->gh; y++)
226 for (x = 0; x < g->gw; x++)
230 tn = (y * g->gw) + x;
231 evas_object_del(g->grid[tn].img);
232 if (g->grid[tn].want)
235 if (!wd->preload_num)
237 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
238 "elm,state,busy,stop", "elm");
239 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
251 _tile_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
253 Grid_Item *git = data;
258 evas_object_show(git->img);
260 git->wd->preload_num--;
261 if (!git->wd->preload_num)
263 edje_object_signal_emit(elm_smart_scroller_edje_object_get(git->wd->scr),
264 "elm,state,busy,stop", "elm");
265 evas_object_smart_callback_call(git->wd->obj, "loaded,detail", NULL);
271 grid_zoom_calc(double zoom)
275 return nearest_pow2(z);
279 grid_create(Evas_Object *obj)
281 Widget_Data *wd = elm_widget_data_get(obj);
285 if (!wd) return NULL;
286 g = calloc(1, sizeof(Grid));
288 g->zoom = grid_zoom_calc(wd->zoom);
289 g->tsize = wd->tsize;
290 g->iw = wd->size.imw;
291 g->ih = wd->size.imh;
293 g->w = g->iw / g->zoom;
294 g->h = g->ih / g->zoom;
295 if (g->zoom >= 8) return NULL;
296 g->gw = (g->w + g->tsize - 1) / g->tsize;
297 g->gh = (g->h + g->tsize - 1) / g->tsize;
298 g->grid = calloc(1, sizeof(Grid_Item) * g->gw * g->gh);
305 for (y = 0; y < g->gh; y++)
307 for (x = 0; x < g->gw; x++)
311 tn = (y * g->gw) + x;
312 g->grid[tn].src.x = x * g->tsize;
313 if (x == (g->gw - 1))
314 g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize);
316 g->grid[tn].src.w = g->tsize;
317 g->grid[tn].src.y = y * g->tsize;
318 if (y == (g->gh - 1))
319 g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize);
321 g->grid[tn].src.h = g->tsize;
323 g->grid[tn].out.x = g->grid[tn].src.x;
324 g->grid[tn].out.y = g->grid[tn].src.y;
325 g->grid[tn].out.w = g->grid[tn].src.w;
326 g->grid[tn].out.h = g->grid[tn].src.h;
330 evas_object_image_add(evas_object_evas_get(obj));
331 evas_object_image_scale_hint_set
332 (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
333 evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
334 evas_object_smart_member_add(g->grid[tn].img,
336 elm_widget_sub_object_add(obj, g->grid[tn].img);
337 evas_object_image_filled_set(g->grid[tn].img, 1);
338 evas_object_event_callback_add(g->grid[tn].img,
339 EVAS_CALLBACK_IMAGE_PRELOADED,
348 grid_load(Evas_Object *obj, Grid *g)
350 Widget_Data *wd = elm_widget_data_get(obj);
352 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh, gw, gh, tx, ty;
354 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
355 evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy, &cvw, &cvh);
358 for (y = 0; y < g->gh; y++)
360 for (x = 0; x < g->gw; x++)
362 int tn, xx, yy, ww, hh;
363 Eina_Bool visible = EINA_FALSE;
365 tn = (y * g->gw) + x;
366 xx = g->grid[tn].out.x;
367 yy = g->grid[tn].out.y;
368 ww = g->grid[tn].out.w;
369 hh = g->grid[tn].out.h;
370 if ((gw != g->w) && (g->w > 0))
373 xx = (gw * xx) / g->w;
374 ww = ((gw * (tx + ww)) / g->w) - xx;
376 if ((gh != g->h) && (g->h > 0))
379 yy = (gh * yy) / g->h;
380 hh = ((gh * (ty + hh)) / g->h) - yy;
382 if (ELM_RECTS_INTERSECT(xx - wd->pan_x + ox,
387 if ((visible) && (!g->grid[tn].have) && (!g->grid[tn].want))
389 g->grid[tn].want = 1;
390 evas_object_hide(g->grid[tn].img);
391 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
392 evas_object_image_load_scale_down_set(g->grid[tn].img, g->zoom);
393 evas_object_image_load_region_set(g->grid[tn].img,
398 evas_object_image_file_set(g->grid[tn].img, wd->file, NULL);
399 evas_object_image_preload(g->grid[tn].img, 0);
401 if (wd->preload_num == 1)
403 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
404 "elm,state,busy,start", "elm");
405 evas_object_smart_callback_call(obj, "load,detail", NULL);
408 else if ((g->grid[tn].want) && (!visible))
411 if (!wd->preload_num)
413 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
414 "elm,state,busy,stop", "elm");
415 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
417 g->grid[tn].want = 0;
418 evas_object_hide(g->grid[tn].img);
419 evas_object_image_preload(g->grid[tn].img, 1);
420 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
422 else if ((g->grid[tn].have) && (!visible))
424 g->grid[tn].have = 0;
425 evas_object_hide(g->grid[tn].img);
426 evas_object_image_preload(g->grid[tn].img, 1);
427 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
434 grid_clearall(Evas_Object *obj)
436 Widget_Data *wd = elm_widget_data_get(obj);
439 EINA_LIST_FREE(wd->grids, g)
447 _smooth_update(Evas_Object *obj)
449 Widget_Data *wd = elm_widget_data_get(obj);
454 EINA_LIST_FOREACH(wd->grids, l, g)
456 for (y = 0; y < g->gh; y++)
458 for (x = 0; x < g->gw; x++)
462 tn = (y * g->gw) + x;
463 evas_object_image_smooth_scale_set(g->grid[tn].img, (!wd->nosmooth));
467 evas_object_image_smooth_scale_set(wd->img, (!wd->nosmooth));
475 for (y = 0; y < g->gh; y++)
477 for (x = 0; x < g->gw; x++)
481 tn = (y * g->gw) + x;
482 evas_object_raise(g->grid[tn].img);
488 _scr_timeout(void *data)
490 Widget_Data *wd = elm_widget_data_get(data);
491 if (!wd) return ECORE_CALLBACK_CANCEL;
493 if (!wd->nosmooth) _smooth_update(data);
494 wd->scr_timer = NULL;
495 return ECORE_CALLBACK_CANCEL;
499 _scr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
501 Widget_Data *wd = elm_widget_data_get(data);
506 if (wd->nosmooth == 1) _smooth_update(data);
508 if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
509 wd->scr_timer = ecore_timer_add(0.5, _scr_timeout, data);
513 _main_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
515 Evas_Object *obj = data;
516 Widget_Data *wd = elm_widget_data_get(obj);
519 evas_object_show(wd->img);
520 wd->main_load_pending = 0;
521 g = grid_create(obj);
524 wd->grids = eina_list_prepend(wd->grids, g);
525 grid_load(wd->obj, g);
527 if (wd->calc_job) ecore_job_del(wd->calc_job);
528 wd->calc_job = ecore_job_add(_calc_job, wd);
529 evas_object_smart_callback_call(data, "loaded", NULL);
531 if (!wd->preload_num)
533 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
534 "elm,state,busy,stop", "elm");
535 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
540 zoom_do(Evas_Object *obj, double t)
542 Widget_Data *wd = elm_widget_data_get(obj);
543 Evas_Coord xx, yy, ow, oh;
544 if (!wd) return ECORE_CALLBACK_CANCEL;
545 wd->size.w = (wd->size.ow * (1.0 - t)) + (wd->size.nw * t);
546 wd->size.h = (wd->size.oh * (1.0 - t)) + (wd->size.nh * t);
547 elm_smart_scroller_child_viewport_size_get(wd->scr, &ow, &oh);
548 xx = (wd->size.spos.x * wd->size.w) - (ow / 2);
549 yy = (wd->size.spos.y * wd->size.h) - (oh / 2);
551 else if (xx > (wd->size.w - ow)) xx = wd->size.w - ow;
553 else if (yy > (wd->size.h - oh)) yy = wd->size.h - oh;
555 wd->show.show = EINA_TRUE;
561 if (wd->calc_job) ecore_job_del(wd->calc_job);
562 wd->calc_job = ecore_job_add(_calc_job, wd);
565 Eina_List *l, *l_next;
568 EINA_LIST_FOREACH_SAFE(wd->grids, l, l_next, g)
572 wd->grids = eina_list_remove_list(wd->grids, l);
577 return ECORE_CALLBACK_CANCEL;
579 return ECORE_CALLBACK_RENEW;
584 _zoom_anim(void *data)
586 Evas_Object *obj = data;
587 Widget_Data *wd = elm_widget_data_get(obj);
590 if (!wd) return ECORE_CALLBACK_CANCEL;
591 t = ecore_loop_time_get();
594 else if (wd->t_end > wd->t_start)
595 t = (t - wd->t_start) / (wd->t_end - wd->t_start);
600 go = zoom_do(obj, t);
604 if (!wd->nosmooth) _smooth_update(data);
605 wd->zoom_animator = NULL;
606 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
612 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
614 Widget_Data *wd = elm_widget_data_get(data);
615 // Evas_Event_Mouse_Move *ev = event_info;
620 _long_press(void *data)
622 Widget_Data *wd = elm_widget_data_get(data);
623 if (!wd) return ECORE_CALLBACK_CANCEL;
624 wd->long_timer = NULL;
625 wd->longpressed = EINA_TRUE;
626 evas_object_smart_callback_call(data, "longpressed", NULL);
627 return ECORE_CALLBACK_CANCEL;
631 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
633 Widget_Data *wd = elm_widget_data_get(data);
634 Evas_Event_Mouse_Down *ev = event_info;
636 if (ev->button != 1) return;
637 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
638 else wd->on_hold = EINA_FALSE;
639 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
640 evas_object_smart_callback_call(data, "clicked,double", NULL);
642 evas_object_smart_callback_call(data, "press", NULL);
643 wd->longpressed = EINA_FALSE;
644 if (wd->long_timer) ecore_timer_del(wd->long_timer);
645 wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
649 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
651 Widget_Data *wd = elm_widget_data_get(data);
652 Evas_Event_Mouse_Up *ev = event_info;
654 if (ev->button != 1) return;
655 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
656 else wd->on_hold = EINA_FALSE;
659 ecore_timer_del(wd->long_timer);
660 wd->long_timer = NULL;
663 evas_object_smart_callback_call(data, "clicked", NULL);
664 wd->on_hold = EINA_FALSE;
667 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_NULL;
670 _del_hook(Evas_Object *obj)
672 Widget_Data *wd = elm_widget_data_get(obj);
675 EINA_LIST_FREE(wd->grids, g)
677 if (g->grid) free(g->grid);
680 evas_object_del(wd->pan_smart);
681 wd->pan_smart = NULL;
682 if (wd->file) eina_stringshare_del(wd->file);
683 if (wd->calc_job) ecore_job_del(wd->calc_job);
684 if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
685 if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator);
686 if (wd->long_timer) ecore_timer_del(wd->long_timer);
691 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
693 Widget_Data *wd = elm_widget_data_get(obj);
695 if (elm_widget_focus_get(obj))
697 edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
698 evas_object_focus_set(wd->obj, EINA_TRUE);
702 edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
703 evas_object_focus_set(wd->obj, EINA_FALSE);
708 _theme_hook(Evas_Object *obj)
710 Widget_Data *wd = elm_widget_data_get(obj);
712 elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", elm_widget_style_get(obj));
713 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
719 _show_region_hook(void *data, Evas_Object *obj)
721 Widget_Data *wd = elm_widget_data_get(data);
722 Evas_Coord x, y, w, h;
724 elm_widget_show_region_get(obj, &x, &y, &w, &h);
725 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
730 _sizing_eval(Evas_Object *obj)
732 Widget_Data *wd = elm_widget_data_get(obj);
733 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
735 // evas_object_size_hint_min_get(wd->scr, &minw, &minh);
736 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
739 // if (wd->mode != ELM_LIST_LIMIT) minw = -1;
740 evas_object_size_hint_min_set(obj, minw, minh);
741 evas_object_size_hint_max_set(obj, maxw, maxh);
745 _calc_job(void *data)
747 Widget_Data *wd = data;
748 Evas_Coord minw, minh;
755 if (wd->mode != ELM_PHOTOCAM_ZOOM_MODE_MANUAL)
757 double tz = wd->zoom;
759 elm_photocam_zoom_set(wd->obj, tz);
762 if ((minw != wd->minw) || (minh != wd->minh))
766 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
767 _sizing_eval(wd->obj);
770 evas_object_smart_changed(wd->pan_smart);
774 _pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
776 Pan *sd = evas_object_smart_data_get(obj);
778 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
781 evas_object_smart_changed(obj);
785 _pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
787 Pan *sd = evas_object_smart_data_get(obj);
789 if (x) *x = sd->wd->pan_x;
790 if (y) *y = sd->wd->pan_y;
794 _pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
796 Pan *sd = evas_object_smart_data_get(obj);
799 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
800 ow = sd->wd->minw - ow;
802 oh = sd->wd->minh - oh;
809 _pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y)
816 _pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
818 Pan *sd = evas_object_smart_data_get(obj);
820 if (w) *w = sd->wd->minw;
821 if (h) *h = sd->wd->minh;
825 _pan_add(Evas_Object *obj)
828 Evas_Object_Smart_Clipped_Data *cd;
830 cd = evas_object_smart_data_get(obj);
832 sd = calloc(1, sizeof(Pan));
834 sd->__clipped_data = *cd;
836 evas_object_smart_data_set(obj, sd);
840 _pan_del(Evas_Object *obj)
842 Pan *sd = evas_object_smart_data_get(obj);
848 _pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
850 Pan *sd = evas_object_smart_data_get(obj);
853 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
854 if ((ow == w) && (oh == h)) return;
856 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
857 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
861 _pan_calculate(Evas_Object *obj)
863 Pan *sd = evas_object_smart_data_get(obj);
864 Evas_Coord ox, oy, ow, oh;
868 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
869 img_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
870 EINA_LIST_FOREACH(sd->wd->grids, l, g)
872 grid_load(sd->wd->obj, g);
873 grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
878 _pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
880 Pan *sd = evas_object_smart_data_get(obj);
882 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
883 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
887 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
889 Widget_Data *wd = elm_widget_data_get(obj);
891 elm_smart_scroller_hold_set(wd->scr, 1);
895 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
897 Widget_Data *wd = elm_widget_data_get(obj);
899 elm_smart_scroller_hold_set(wd->scr, 0);
903 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
905 Widget_Data *wd = elm_widget_data_get(obj);
907 elm_smart_scroller_freeze_set(wd->scr, 1);
911 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
913 Widget_Data *wd = elm_widget_data_get(obj);
915 elm_smart_scroller_freeze_set(wd->scr, 0);
919 _scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
921 evas_object_smart_callback_call(data, "scroll,anim,start", NULL);
925 _scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
927 evas_object_smart_callback_call(data, "scroll,anim,stop", NULL);
931 _scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
933 evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
937 _scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
939 evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
943 _scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
945 evas_object_smart_callback_call(data, "scroll", NULL);
949 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
950 Evas_Callback_Type type, void *event_info)
953 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
954 Evas_Event_Key_Down *ev = event_info;
955 Widget_Data *wd = elm_widget_data_get(obj);
956 if (!wd) return EINA_FALSE;
957 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
961 Evas_Coord step_x = 0;
962 Evas_Coord step_y = 0;
965 Evas_Coord page_x = 0;
966 Evas_Coord page_y = 0;
968 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
969 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
970 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
971 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
973 if ((!strcmp(ev->keyname, "Left")) ||
974 (!strcmp(ev->keyname, "KP_Left")))
978 else if ((!strcmp(ev->keyname, "Right")) ||
979 (!strcmp(ev->keyname, "KP_Right")))
983 else if ((!strcmp(ev->keyname, "Up")) ||
984 (!strcmp(ev->keyname, "KP_Up")))
988 else if ((!strcmp(ev->keyname, "Down")) ||
989 (!strcmp(ev->keyname, "KP_Down")))
993 else if ((!strcmp(ev->keyname, "Prior")) ||
994 (!strcmp(ev->keyname, "KP_Prior")))
997 y -= -(page_y * v_h) / 100;
1001 else if ((!strcmp(ev->keyname, "Next")) ||
1002 (!strcmp(ev->keyname, "KP_Next")))
1005 y += -(page_y * v_h) / 100;
1009 else if ((!strcmp(ev->keyname, "KP_Add")))
1011 zoom = elm_photocam_zoom_get(obj);
1013 elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
1014 elm_photocam_zoom_set(obj, zoom);
1017 else if ((!strcmp(ev->keyname, "KP_Subtract")))
1019 zoom = elm_photocam_zoom_get(obj);
1021 elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
1022 elm_photocam_zoom_set(obj, zoom);
1025 else return EINA_FALSE;
1027 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1028 elm_smart_scroller_child_pos_set(wd->scr, x, y);
1034 * Add a new Photocam object
1036 * @param parent The parent object
1037 * @return The new object or NULL if it cannot be created
1042 elm_photocam_add(Evas_Object *parent)
1047 Evas_Coord minw, minh;
1048 static Evas_Smart *smart = NULL;
1049 Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
1051 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1053 ELM_SET_WIDTYPE(widtype, "photocam");
1054 elm_widget_type_set(obj, "photocam");
1055 elm_widget_sub_object_add(parent, obj);
1056 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1057 elm_widget_data_set(obj, wd);
1058 elm_widget_del_hook_set(obj, _del_hook);
1059 elm_widget_theme_hook_set(obj, _theme_hook);
1060 elm_widget_can_focus_set(obj, EINA_TRUE);
1061 elm_widget_event_hook_set(obj, _event_hook);
1063 wd->scr = elm_smart_scroller_add(e);
1064 elm_smart_scroller_widget_set(wd->scr, obj);
1065 elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", "default");
1066 evas_object_smart_callback_add(wd->scr, "scroll", _scr, obj);
1067 evas_object_smart_callback_add(wd->scr, "drag", _scr, obj);
1068 elm_widget_resize_object_set(obj, wd->scr);
1070 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
1071 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
1072 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
1073 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
1074 evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
1076 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce);
1080 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
1081 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
1082 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
1083 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
1087 static Evas_Smart_Class sc;
1089 evas_object_smart_clipped_smart_set(&_pan_sc);
1091 sc.name = "elm_photocam_pan";
1092 sc.version = EVAS_SMART_CLASS_VERSION;
1095 sc.resize = _pan_resize;
1096 sc.move = _pan_move;
1097 sc.calculate = _pan_calculate;
1098 smart = evas_smart_class_new(&sc);
1102 wd->pan_smart = evas_object_smart_add(e, smart);
1103 wd->pan = evas_object_smart_data_get(wd->pan_smart);
1107 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
1108 _pan_set, _pan_get, _pan_max_get,
1109 _pan_min_get, _pan_child_size_get);
1112 wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
1116 wd->img = evas_object_image_add(e);
1117 evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
1118 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_DOWN,
1120 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
1122 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_MOVE,
1124 evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_STATIC);
1125 evas_object_smart_member_add(wd->img, wd->pan_smart);
1126 elm_widget_sub_object_add(obj, wd->img);
1127 evas_object_image_filled_set(wd->img, 1);
1128 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_IMAGE_PRELOADED,
1129 _main_preloaded, obj);
1131 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
1133 evas_object_size_hint_min_set(obj, minw, minh);
1140 * Set the photo file to be shown
1142 * This sets (and shows) the specified file (with a relative or absolute path)
1143 * and will return a load error (same error that
1144 * evas_object_image_load_error_get() will return). The image will change and
1145 * adjust its size at this point and begin a background load process for this
1146 * photo that at some time in the future will be displayed at the full quality
1149 * @param obj The photocam object
1150 * @param file The photo file
1151 * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
1155 EAPI Evas_Load_Error
1156 elm_photocam_file_set(Evas_Object *obj, const char *file)
1158 ELM_CHECK_WIDTYPE(obj, widtype) EVAS_LOAD_ERROR_NONE;
1159 Widget_Data *wd = elm_widget_data_get(obj);
1161 if (!wd) return EVAS_LOAD_ERROR_GENERIC;
1162 if (!eina_stringshare_replace(&wd->file, file)) return EVAS_LOAD_ERROR_NONE;
1165 evas_object_hide(wd->img);
1166 evas_object_image_smooth_scale_set(wd->img, (wd->nosmooth == 0));
1167 evas_object_image_file_set(wd->img, NULL, NULL);
1168 evas_object_image_load_scale_down_set(wd->img, 0);
1169 evas_object_image_file_set(wd->img, wd->file, NULL);
1170 evas_object_image_size_get(wd->img, &w, &h);
1173 wd->size.w = wd->size.imw / wd->zoom;
1174 wd->size.h = wd->size.imh / wd->zoom;
1175 if (wd->zoom_animator)
1178 if (wd->nosmooth == 0) _smooth_update(obj);
1179 ecore_animator_del(wd->zoom_animator);
1180 wd->zoom_animator = NULL;
1182 evas_object_image_file_set(wd->img, NULL, NULL);
1183 evas_object_image_load_scale_down_set(wd->img, 8);
1184 evas_object_image_file_set(wd->img, wd->file, NULL);
1185 evas_object_image_preload(wd->img, 0);
1186 wd->main_load_pending = 1;
1187 if (wd->calc_job) ecore_job_del(wd->calc_job);
1188 wd->calc_job = ecore_job_add(_calc_job, wd);
1189 evas_object_smart_callback_call(obj, "load", NULL);
1191 if (wd->preload_num == 1)
1193 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
1194 "elm,state,busy,start", "elm");
1195 evas_object_smart_callback_call(obj, "load,detail", NULL);
1198 double tz = wd->zoom;
1200 elm_photocam_zoom_set(wd->obj, tz);
1202 return evas_object_image_load_error_get(wd->img);
1206 * Returns the path of the current image file
1208 * @param obj The photocam object
1209 * @return Returns the path
1214 elm_photocam_file_get(const Evas_Object *obj)
1216 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1217 Widget_Data *wd = elm_widget_data_get(obj);
1218 if (!wd) return NULL;
1223 * Set the zoom level of the photo
1225 * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
1226 * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
1227 * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
1228 * be greater than 0. It is usggested to stick to powers of 2. (1, 2, 4, 8,
1231 * @param obj The photocam object
1232 * @param zoom The zoom level to set
1237 elm_photocam_zoom_set(Evas_Object *obj, double zoom)
1239 ELM_CHECK_WIDTYPE(obj, widtype);
1240 Widget_Data *wd = elm_widget_data_get(obj);
1242 Grid *g, *g_zoom = NULL;
1243 Evas_Coord pw, ph, rx, ry, rw, rh;
1245 int zoom_changed = 0, started = 0;
1248 if (zoom <= (1.0 / 256.0)) zoom = (1.0 / 256.0);
1249 if (zoom == wd->zoom) return;
1251 wd->size.ow = wd->size.w;
1252 wd->size.oh = wd->size.h;
1253 elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry);
1254 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
1255 if ((rw <= 0) || (rh <= 0)) return;
1257 if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_MANUAL)
1259 wd->size.nw = (double)wd->size.imw / wd->zoom;
1260 wd->size.nh = (double)wd->size.imh / wd->zoom;
1262 else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT)
1264 if ((wd->size.imw < 1) || (wd->size.imh < 1))
1271 ph = (wd->size.imh * rw) / wd->size.imw;
1274 pw = (wd->size.imw * rh) / wd->size.imh;
1281 if (wd->size.imw > wd->size.imh)
1282 z = wd->size.imw / pw;
1284 z = wd->size.imh / ph;
1286 else if (z >= 4) z = 4;
1287 else if (z >= 2) z = 2;
1289 if (z != wd->zoom) zoom_changed = 1;
1295 else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL)
1297 if ((wd->size.imw < 1) || (wd->size.imh < 1))
1304 ph = (wd->size.imh * rw) / wd->size.imw;
1307 pw = (wd->size.imw * rh) / wd->size.imh;
1314 if (wd->size.imw > wd->size.imh)
1315 z = wd->size.imw / pw;
1317 z = wd->size.imh / ph;
1319 else if (z >= 4) z = 4;
1320 else if (z >= 2) z = 2;
1322 if (z != wd->zoom) zoom_changed = 1;
1328 if (wd->main_load_pending)
1330 wd->size.w = wd->size.nw;
1331 wd->size.h = wd->size.nh;
1334 EINA_LIST_FOREACH(wd->grids, l, g)
1336 if (g->zoom == grid_zoom_calc(wd->zoom))
1338 wd->grids = eina_list_remove(wd->grids, g);
1339 wd->grids = eina_list_prepend(wd->grids, g);
1344 g = grid_create(obj);
1347 if (eina_list_count(wd->grids) > 1)
1349 g_zoom = eina_list_last(wd->grids)->data;
1350 wd->grids = eina_list_remove(wd->grids, g_zoom);
1351 grid_clear(obj, g_zoom);
1353 EINA_LIST_FOREACH(wd->grids, l, g_zoom)
1358 wd->grids = eina_list_prepend(wd->grids, g);
1362 EINA_LIST_FREE(wd->grids, g)
1369 wd->t_start = ecore_loop_time_get();
1370 wd->t_end = wd->t_start + _elm_config->zoom_friction;
1371 if ((wd->size.w > 0) && (wd->size.h > 0))
1373 wd->size.spos.x = (double)(rx + (rw / 2)) / (double)wd->size.w;
1374 wd->size.spos.y = (double)(ry + (rh / 2)) / (double)wd->size.h;
1378 wd->size.spos.x = 0.5;
1379 wd->size.spos.y = 0.5;
1381 if (rw > wd->size.w) wd->size.spos.x = 0.5;
1382 if (rh > wd->size.h) wd->size.spos.y = 0.5;
1383 if (wd->size.spos.x > 1.0) wd->size.spos.x = 1.0;
1384 if (wd->size.spos.y > 1.0) wd->size.spos.y = 1.0;
1391 if (!wd->zoom_animator)
1393 wd->zoom_animator = ecore_animator_add(_zoom_anim, obj);
1395 if (wd->nosmooth == 1) _smooth_update(obj);
1399 an = wd->zoom_animator;
1402 if (!_zoom_anim(obj))
1404 ecore_animator_del(an);
1408 if (wd->calc_job) ecore_job_del(wd->calc_job);
1409 wd->calc_job = ecore_job_add(_calc_job, wd);
1413 evas_object_smart_callback_call(obj, "zoom,start", NULL);
1415 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1418 evas_object_smart_callback_call(obj, "zoom,change", NULL);
1422 * Get the zoom level of the photo
1424 * This returns the current zoom level of the photocam object. Note that if
1425 * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
1426 * (which is the default), the zoom level may be changed at any time by the
1427 * photocam object itself to account for photo size and photocam viewpoer size
1429 * @param obj The photocam object
1430 * @return The current zoom level
1435 elm_photocam_zoom_get(const Evas_Object *obj)
1437 ELM_CHECK_WIDTYPE(obj, widtype) 1.0;
1438 Widget_Data *wd = elm_widget_data_get(obj);
1439 if (!wd) return 1.0;
1446 * This sets the zoom mode to manual or one of several automatic levels.
1447 * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
1448 * elm_photocam_zoom_set() and will stay at that level until changed by code
1449 * or until zoom mode is changed. This is the default mode.
1450 * The Automatic modes will allow the photocam object to automatically
1451 * adjust zoom mode based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will
1452 * adjust zoom so the photo fits EXACTLY inside the scroll frame with no pixels
1453 * outside this area. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but
1454 * ensure no pixels within the frame are left unfilled.
1456 * @param obj The photocam object
1457 * @param mode The desired mode
1462 elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
1464 ELM_CHECK_WIDTYPE(obj, widtype);
1465 Widget_Data *wd = elm_widget_data_get(obj);
1467 if (wd->mode == mode) return;
1470 double tz = wd->zoom;
1472 elm_photocam_zoom_set(wd->obj, tz);
1479 * This gets the current zoom mode of the photocam object
1481 * @param obj The photocam object
1482 * @return The current zoom mode
1486 EAPI Elm_Photocam_Zoom_Mode
1487 elm_photocam_zoom_mode_get(const Evas_Object *obj)
1489 ELM_CHECK_WIDTYPE(obj, widtype) ELM_PHOTOCAM_ZOOM_MODE_LAST;
1490 Widget_Data *wd = elm_widget_data_get(obj);
1491 if (!wd) return ELM_PHOTOCAM_ZOOM_MODE_LAST;
1496 * Get the current image pixel width and height
1498 * This gets the current photo pixel width and height (for the original).
1499 * The size will be returned in the integers @p w and @p h that are pointed
1502 * @param obj The photocam object
1503 * @param w A pointer to the width return
1504 * @param h A pointer to the height return
1509 elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
1511 ELM_CHECK_WIDTYPE(obj, widtype);
1512 Widget_Data *wd = elm_widget_data_get(obj);
1514 if (w) *w = wd->size.imw;
1515 if (h) *h = wd->size.imh;
1519 * Get the current area of the image that is currently shown
1521 * This gets the region
1525 elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
1527 ELM_CHECK_WIDTYPE(obj, widtype);
1528 Widget_Data *wd = elm_widget_data_get(obj);
1529 Evas_Coord sx, sy, sw, sh;
1531 elm_smart_scroller_child_pos_get(wd->scr, &sx, &sy);
1532 elm_smart_scroller_child_viewport_size_get(wd->scr, &sw, &sh);
1537 *x = (wd->size.imw * sx) / wd->size.w;
1538 if (*x > wd->size.imw) *x = wd->size.imw;
1539 else if (*x < 0) *x = 0;
1543 *w = (wd->size.imw * sw) / wd->size.w;
1544 if (*w > wd->size.imw) *w = wd->size.imw;
1545 else if (*w < 0) *w = 0;
1558 *y = (wd->size.imh * sy) / wd->size.h;
1559 if (*y > wd->size.imh) *y = wd->size.imh;
1560 else if (*y < 0) *y = 0;
1564 *h = (wd->size.imh * sh) / wd->size.h;
1565 if (*h > wd->size.imh) *h = wd->size.imh;
1566 else if (*h < 0) *h = 0;
1577 * Set the viewed portion of the image
1579 * This sets the region of the image to be viewed
1581 * @param obj The photocam object
1582 * @param x X-coordinate of region in image original pixels
1583 * @param y Y-coordinate of region in image original pixels
1584 * @param w Width of region in image original pixels
1585 * @param h Height of region in image original pixels
1590 elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1592 ELM_CHECK_WIDTYPE(obj, widtype);
1593 Widget_Data *wd = elm_widget_data_get(obj);
1596 if ((wd->size.imw < 1) || (wd->size.imh < 1)) return;
1597 rx = (x * wd->size.w) / wd->size.imw;
1598 ry = (y * wd->size.h) / wd->size.imh;
1599 rw = (w * wd->size.w) / wd->size.imw;
1600 rh = (w * wd->size.h) / wd->size.imh;
1603 if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
1604 if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
1605 if (wd->zoom_animator)
1608 ecore_animator_del(wd->zoom_animator);
1609 wd->zoom_animator = NULL;
1611 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1613 elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh);
1617 * Bring in the viewed portion of the image
1619 * This brings in the region of the image over time
1621 * @param obj The photocam object
1622 * @param x X-coordinate of region in image original pixels
1623 * @param y Y-coordinate of region in image original pixels
1624 * @param w Width of region in image original pixels
1625 * @param h Height of region in image original pixels
1630 elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1632 ELM_CHECK_WIDTYPE(obj, widtype);
1633 Widget_Data *wd = elm_widget_data_get(obj);
1636 if ((wd->size.imw < 1) || (wd->size.imh < 1)) return;
1637 rx = (x * wd->size.w) / wd->size.imw;
1638 ry = (y * wd->size.h) / wd->size.imh;
1639 rw = (w * wd->size.w) / wd->size.imw;
1640 rh = (w * wd->size.h) / wd->size.imh;
1643 if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
1644 if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
1645 if (wd->zoom_animator)
1648 if (!wd->nosmooth) _smooth_update(obj);
1649 ecore_animator_del(wd->zoom_animator);
1650 wd->zoom_animator = NULL;
1652 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1654 elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh);
1658 * Set the paused state for photocam
1660 * This sets the paused state to on (1) or off (0) for photocam. The default
1661 * is on. This will stop zooming using animation ch change zoom levels and
1662 * change instantly. This will stop any existing animations that are running.
1664 * @param obj The photocam object
1665 * @param paused The pause state to set
1670 elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
1672 ELM_CHECK_WIDTYPE(obj, widtype);
1673 Widget_Data *wd = elm_widget_data_get(obj);
1675 if (wd->paused == !!paused) return;
1676 wd->paused = paused;
1679 if (wd->zoom_animator)
1681 ecore_animator_del(wd->zoom_animator);
1682 wd->zoom_animator = NULL;
1684 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1690 * Get the paused state for photocam
1692 * This gets the current paused state for the photocam object.
1694 * @param obj The photocam object
1695 * @return The current paused state
1700 elm_photocam_paused_get(const Evas_Object *obj)
1702 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1703 Widget_Data *wd = elm_widget_data_get(obj);
1704 if (!wd) return EINA_FALSE;
1709 * Get the internal low-res image used for photocam
1711 * This gets the internal image object inside photocam. Do not modify it. It
1712 * is for inspection only, and hooking callbacks to. Nothing else. It may be
1713 * deleted at any time as well.
1715 * @param obj The photocam object
1716 * @return The internal image object handle, or NULL if none exists
1721 elm_photocam_internal_image_get(const Evas_Object *obj)
1723 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1724 Widget_Data *wd = elm_widget_data_get(obj);
1725 if (!wd) return NULL;
1730 * Set the photocam scrolling bouncing.
1732 * @param obj The photocam object
1733 * @param h_bounce bouncing for horizontal
1734 * @param v_bounce bouncing for vertical
1738 elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
1740 ELM_CHECK_WIDTYPE(obj, widtype);
1741 Widget_Data *wd = elm_widget_data_get(obj);
1743 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
1748 * Get the photocam scrolling bouncing.
1750 * @param obj The photocam object
1751 * @param h_bounce bouncing for horizontal
1752 * @param v_bounce bouncing for vertical
1756 elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
1758 ELM_CHECK_WIDTYPE(obj, widtype);
1759 Widget_Data *wd = elm_widget_data_get(obj);
1761 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);