New 1.14 API: elm.Photocam.image_orient

with test.

NOTE: playing with the test reveal lots of image_orient errors
This commit is contained in:
Davide Andreoli 2015-04-12 13:41:05 +02:00
parent 6fbe0ba320
commit e9f07ff537
4 changed files with 53 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error
from efl.evas cimport Eina_Bool, Evas_Object, Evas_Load_Error, Evas_Image_Orient
cdef extern from "Elementary.h":
@ -32,6 +32,8 @@ cdef extern from "Elementary.h":
void elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h)
void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h)
Evas_Image_Orient elm_photocam_image_orient_get(const Evas_Object *obj)
void elm_photocam_image_orient_set(const Evas_Object *obj, Evas_Image_Orient orient)
void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
Eina_Bool elm_photocam_paused_get(const Evas_Object *obj)
Evas_Object *elm_photocam_internal_image_get(const Evas_Object *obj)

View File

@ -354,6 +354,24 @@ cdef class Photocam(Object):
"""
elm_photocam_image_region_bring_in(self.obj, x, y, w, h)
property image_orient:
"""This allows to rotate or flip the photocam image.
:type: :ref:`Evas_Image_Orient`
.. versionadded:: 1.14
"""
def __set__(self, orient):
elm_photocam_image_orient_set(self.obj, orient)
def __get__(self):
return elm_photocam_image_orient_get(self.obj)
def image_orient_set(self, orient):
elm_photocam_image_orient_set(self.obj, orient)
def image_orient_get(self):
return elm_photocam_image_orient_get(self.obj)
property paused:
"""Set the paused state for photocam

View File

@ -701,11 +701,11 @@ Evas_Image_Orient
Flip image vertically
.. data:: EVAS_IMAGE_FLIP_TRANSVERSE
.. data:: EVAS_IMAGE_FLIP_TRANSPOSE
Flip image along the y = (width - x) line (bottom-left to top-right)
.. data:: EVAS_IMAGE_ORIENT
.. data:: EVAS_IMAGE_FLIP_TRANSVERSE
Flip image along the y = x line (top-left to bottom-right)

View File

@ -1,7 +1,10 @@
#!/usr/bin/env python
# encoding: utf-8
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH, \
EVAS_IMAGE_ORIENT_0, EVAS_IMAGE_ORIENT_90, EVAS_IMAGE_ORIENT_180, \
EVAS_IMAGE_ORIENT_270, EVAS_IMAGE_FLIP_HORIZONTAL, EVAS_IMAGE_FLIP_VERTICAL, \
EVAS_IMAGE_FLIP_TRANSPOSE, EVAS_IMAGE_FLIP_TRANSVERSE
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
@ -50,6 +53,10 @@ def _cb_pc_download_error(im, info, pb):
pb.hide()
def _cb_orient(btn, pc, orient):
pc.image_orient = orient
def photocam_clicked(obj):
win = StandardWindow("photocam", "Photocam test", autodel=True,
size=(600, 600))
@ -118,6 +125,28 @@ def photocam_clicked(obj):
tb.pack(bt, 2, 2, 1, 1)
bt.show()
# Orient buttons
box = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
tb.pack(box, 0, 1, 1, 1)
box.show()
orients = [
(EVAS_IMAGE_ORIENT_0, "Orient 0"),
(EVAS_IMAGE_ORIENT_90, "Orient 90"),
(EVAS_IMAGE_ORIENT_180, "Orient 180"),
(EVAS_IMAGE_ORIENT_270, "Orient 270"),
(EVAS_IMAGE_FLIP_HORIZONTAL, "Flip Horiz"),
(EVAS_IMAGE_FLIP_VERTICAL, "Flip Vert"),
(EVAS_IMAGE_FLIP_TRANSPOSE, "Transpose"),
(EVAS_IMAGE_FLIP_TRANSVERSE, "Transverse"),
]
for val, label in orients:
bt = Button(win, text=label, size_hint_align=(0.1, 0.5))
bt.callback_clicked_add(_cb_orient, pc, val)
box.pack_end(bt)
bt.show()
# show the win
win.show()