Gestures in photocam widget

This code snippet demonstrates how to enable gestures for elementary photocam widget. It will allow user to use fingers to zoom in/out.
#define IMG_DIR "/opt/usr/apps/org.example.myapp/res/images"

static void photocam_test(Evas_Object *parent) {
	//create photocam object
	Evas_Object *photocam = elm_photocam_add(parent);
	elm_win_resize_object_add(parent, photocam);

    //set image file
	char path[100] = { 0 };
	snprintf(path, sizeof(path), IMG_DIR"/%s", "big_image.jpg");
	elm_photocam_file_set(photocam, path);

	//enable scroller bouncing
	elm_scroller_bounce_set(photocam, EINA_TRUE, EINA_TRUE);

	//fit the image to parent's size
	elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);

	//enable  gestures
	elm_photocam_gesture_enabled_set(photocam, EINA_TRUE);

    //show photocam object
	evas_object_show(photocam);
}

Responses

0 Replies