Photocam
This feature is supported in mobile applications only.
The photocam component displays high resolution photos taken from digital cameras. It provides a way to zoom in the photo, load it fast, and fit it nicely on the screen. It is optimized for .jpeg images format and has a low memory footprint.
This UI component implements the scroller interface, so all the functions concerning the scroller can be used with the photocam component.
Figure: Photocam hierarchy
Adding a Photocam Component
The following example shows how to create a photocam component and set an image file on it.
Evas_Object *photocam; photocam = elm_photocam_add(win); elm_photocam_file_set(photocam, "/tmp/photo.jpeg");
Using Photocam Zoom
You can choose between two automatic zoom modes and a manual zoom mode. In the following example the zoom mode is set to manual and a double zoom is requested.
elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL); elm_photocam_zoom_set(photocam, 2.0);
The zoom mode can be set to ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT. In this case, the photo fits exactly inside the scroll frame with no pixels outside this region. The zoom mode can also be set to ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL to fill all the pixels of the photocam component.
Multi-touch zooming is activated by enabling gestures.
elm_photocam_gesture_enabled_set(photocam, EINA_TRUE);
You can zoom in a specific region. The following example shows how to zoom in the region starting at the coordinates (200x200), with a width of 400px and a height of 300px.
elm_photocam_image_region_bring_in(photocam, 200, 200, 400, 300);
Using Photocam Callbacks
The photocam component emits the following signals:
- clicked: The user has clicked the photo without dragging around.
- press: The user has pressed down on the photo.
- longpressed: The user has pressed down on the photo for a long time without dragging around.
- clicked,double: The user has double-clicked the photo.
- load: The photo load begins.
- loaded: The image file load is complete for the first view (a low resolution blurry version).
- load,detail: A photo detailed data load begins.
- loaded,detail: The image file load is complete for the detailed image data (full resolution is needed).
- zoom,start: Zoom animation starts.
- zoom,stop: Zoom animation stops.
- zoom,change: The zoom is changed when using an auto zoom mode.
- scroll: The content is scrolled.
- scroll,anim,start: Scrolling animation starts.
- scroll,anim,stop: Scrolling animation stops.
- scroll,drag,start: Dragging the content around starts.
- scroll,drag,stop: Dragging the content around stops.
For all these signals, event_info is NULL.
The following example shows how to register a callback on the loaded signal.
void message_port_cb(int local_port_id, const char *remote_app_id, bundle *message) { evas_object_smart_callback_add(photocam, "loaded", loaded_cb, data); } // Callback function for the "loaded" signal // The photocam has loaded the photo file in a low resolution void loaded_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "The photo has been loaded\n"); }