Table of Contents

Widgets Menu


Photocam Widgets

The photocam widget displays high resolution photos taken from digital cameras. It provides a way to zoom in the photo, load it fast and fit it nicely. It is optimized for .jpeg images format and has a low memory footprint.

This widget implements the scroller interface, so all the functions concerning the scroller can be used with the photocam widget.

Table of Contents

Adding a Photocam

This is how to create a photocam widget 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

We can choose between two automatic zoom modes and a manual zoom mode. Here we set the zoom mode to manual and ask for a double zoom.

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 widget.

Multi-touch zooming is activated by enabling gestures.

elm_photocam_gesture_enabled_set(photocam, EINA_TRUE);

We can zoom in a specific region. In this example, we want to zoom in the region starting at the coordinates (200×200), 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 widget emits the following signals:

For all these signals, event_info is NULL.

This is 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
 
static void
loaded_cb(void *data, Evas_Object *obj, void *event_info)
{
   printf("The photo has been loaded\n");
}


A Photocam Example


Widgets Menu