www-content/pages/program_guide/widgets/photocam.txt

112 lines
4.2 KiB
Plaintext

~~Title: Photocam Widget PG~~
{{page>widgets_index}}
----
===== Photocam Widgets =====
{{ :widgets_photocam_tree.png }}{{ :widgets_photocam.png }}
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|Adding a Photocam]]
* [[#Using_Photocam_Zoom|Using Photocam Zoom]]
* [[#Using_Photocam_Callbacks|Using Photocam Callbacks]]
=== Related Info ===
* [[https://build.enlightenment.org/job/nightly_elm_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Photocam.html|Photocam Widget API]]
* [[https://build.enlightenment.org/job/nightly_elm_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/tutorial_photocam.html|A Photocam Example]]
==== Adding a Photocam ====
This is how to create a photocam widget and set an image file on it.
<code c>
Evas_Object *photocam;
photocam = elm_photocam_add(win);
elm_photocam_file_set(photocam, "/tmp/photo.jpeg");
</code>
==== 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.
<code c>
elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
elm_photocam_zoom_set(photocam, 2.0);
</code>
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.
<code c>
elm_photocam_gesture_enabled_set(photocam, EINA_TRUE);
</code>
We can zoom in a specific region. In this example, we want to zoom in the
region starting at the coordinates (200x200), with a width of 400px and a
height of 300px.
<code c>
elm_photocam_image_region_bring_in(photocam, 200, 200, 400, 300);
</code>
==== Using Photocam Callbacks ====
The photocam widget emits the following signals:
* ''"clicked"'' - This is called when a user has clicked the photo without dragging around.
* ''"press"'' - This is called when a user has pressed down on the photo.
* ''"longpressed"'' - This is called when a user has pressed down on the photo for a long time without dragging around.
* ''"clicked,double"'' - This is called when a user has double-clicked the photo.
* ''"load"'' - Photo load begins.
* ''"loaded"'' - This is called when the image file load is complete for the first view (low resolution blurry version).
* ''"load,detail"'' - Photo detailed data load begins.
* ''"loaded,detail"'' - This is called when the image file load is complete for the detailed image data (full resolution needed).
* ''"zoom,start"'' - Zoom animation started.
* ''"zoom,stop"'' - Zoom animation stopped.
* ''"zoom,change"'' - Zoom changed when using an auto zoom mode.
* ''"scroll"'' - the content has been scrolled (moved)
* ''"scroll,anim,start"'' - scrolling animation has started
* ''"scroll,anim,stop"'' - scrolling animation has stopped
* ''"scroll,drag,start"'' - dragging the contents around has started
* ''"scroll,drag,stop"'' - dragging the contents around has stopped
* ''"focused"'' - When the photocam has received focus. (since 1.8)
* ''"unfocused"'' - When the photocam has lost focus. (since 1.8)
For all these signals, event_info is NULL.
This is how to register a callback on the "loaded" signal.
<code c>
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");
}
</code>
\\
//**__[[https://build.enlightenment.org/job/nightly_elm_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/tutorial_photocam.html|A Photocam Example]]__**//
\\
----
{{page>widgets_index}}