Mobile native

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 the .jpeg images format and has a low memory footprint.

The photocam component implements the scroller interface, which means that scroller functions can be used with the photocam component.

For more information, see the Photocam API.

Figure: Photocam hierarchy

Photocam hierarchy

Adding a Photocam Component

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

To use the photocam zoom:

  • Set the zoom mode. You can choose between 2 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.

  • Activate the multi-touch zooming by enabling gestures:

    elm_photocam_gesture_enabled_set(photocam, EINA_TRUE);
    
  • Zoom in a specific region. The following example shows how to zoom in the region starting at the coordinates (200 x 200), with a width of 400 px and a height of 300 px.

    elm_photocam_image_region_bring_in(photocam, 200, 200, 400, 300);
    

Using Photocam Callbacks

The photocam component emits the following signals:

  • clicked: The photo has been clicked without dragging around.
  • press: The photo has been pressed.
  • longpressed: The photo has been pressed down for a long time without dragging around.
  • clicked,double: The photo has been double-clicked.
  • 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");
}
Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top