Elementary photocam widget

This snippet shows how to create a photocam widget and use it's basic features (zoom, bounce). Photocam is used for working with big image files.
//icon directory should look like this
#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 source file (a big image file)
	char path[100] = { 0 };
	snprintf(path, sizeof(path), IMG_DIR"/%s", "big_image.jpg");

	if (!elm_photocam_file_set(photocam, path)) {
		dlog_print(DLOG_ERROR, LOG_TAG, "Unable to load photocam!");
	}

	//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);

	//manual zoom control
	elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);

	//set zoom, here the photo will be 2 times smaller than original
	//values can be <1, then we'll make photo larger than original
	elm_photocam_zoom_set(photocam, 2);

	evas_object_show(photocam);
}

Responses

0 Replies