New style enums for ethumb

...not really tested as there are no test nor examples for ethumb :(
This commit is contained in:
Davide Andreoli 2015-01-04 22:46:40 +01:00
parent bbb747eb5e
commit 4bc8d227a9
3 changed files with 52 additions and 36 deletions

View File

@ -1,26 +0,0 @@
cdef extern from "Ethumb.h":
ctypedef enum Ethumb_Thumb_Orientation:
ETHUMB_THUMB_ORIENT_NONE # keep orientation as pixel data is
ETHUMB_THUMB_ROTATE_90_CW # rotate 90° clockwise
ETHUMB_THUMB_ROTATE_180 # rotate 180°
ETHUMB_THUMB_ROTATE_90_CCW # rotate 90° counter-clockwise
ETHUMB_THUMB_FLIP_HORIZONTAL # flip horizontally
ETHUMB_THUMB_FLIP_VERTICAL # flip vertically
ETHUMB_THUMB_FLIP_TRANSPOSE # transpose
ETHUMB_THUMB_FLIP_TRANSVERSE # transverse
ETHUMB_THUMB_ORIENT_ORIGINAL # use orientation from metadata (EXIF-only currently)
ctypedef enum Ethumb_Thumb_FDO_Size:
ETHUMB_THUMB_NORMAL # 128x128 as defined by FreeDesktop.Org standard
ETHUMB_THUMB_LARGE # 256x256 as defined by FreeDesktop.Org standard
ctypedef enum Ethumb_Thumb_Format:
ETHUMB_THUMB_FDO # PNG as defined by FreeDesktop.Org standard
ETHUMB_THUMB_JPEG # JPEGs are often smaller and faster to read/write
ETHUMB_THUMB_EET # EFL's own storage system, supports key parameter
ctypedef enum Ethumb_Thumb_Aspect:
ETHUMB_THUMB_KEEP_ASPECT # keep original proportion between width and height
ETHUMB_THUMB_IGNORE_ASPECT # ignore aspect and force it to match thumbnail's width and height
ETHUMB_THUMB_CROP # keep aspect but crop (cut) the largest dimension

View File

@ -16,33 +16,76 @@
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from efl.eina cimport Eina_Bool, Eina_Free_Cb
from efl.ethumb.enums cimport Ethumb_Thumb_FDO_Size, Ethumb_Thumb_Format, \
Ethumb_Thumb_Aspect, Ethumb_Thumb_Orientation
cdef extern from "Ethumb.h":
####################################################################
# Enums
#
cpdef enum Ethumb_Thumb_Orientation:
ETHUMB_THUMB_ORIENT_NONE
ETHUMB_THUMB_ROTATE_90_CW
ETHUMB_THUMB_ROTATE_180
ETHUMB_THUMB_ROTATE_90_CCW
ETHUMB_THUMB_FLIP_HORIZONTAL
ETHUMB_THUMB_FLIP_VERTICAL
ETHUMB_THUMB_FLIP_TRANSPOSE
ETHUMB_THUMB_FLIP_TRANSVERSE
ETHUMB_THUMB_ORIENT_ORIGINAL
ctypedef enum Ethumb_Thumb_Orientation:
pass
cpdef enum Ethumb_Thumb_FDO_Size:
ETHUMB_THUMB_NORMAL
ETHUMB_THUMB_LARGE
ctypedef enum Ethumb_Thumb_FDO_Size:
pass
cpdef enum Ethumb_Thumb_Format:
ETHUMB_THUMB_FDO
ETHUMB_THUMB_JPEG
ETHUMB_THUMB_EET
ctypedef enum Ethumb_Thumb_Format:
pass
cpdef enum Ethumb_Thumb_Aspect:
ETHUMB_THUMB_KEEP_ASPECT
ETHUMB_THUMB_IGNORE_ASPECT
ETHUMB_THUMB_CROP
ctypedef enum Ethumb_Thumb_Aspect:
pass
####################################################################
# Structs
#
cdef struct Ethumb:
int tw
int th
int format
int aspect
####################################################################
# Other typedefs
#
ctypedef void (*Ethumb_Generate_Cb)(void *data, Ethumb *e, Eina_Bool success)
# Ethumb
####################################################################
# Functions
#
int ethumb_init()
void ethumb_shutdown()
Ethumb *ethumb_new()
Ethumb * ethumb_new()
void ethumb_free(Ethumb *e)
# Setup
Eina_Bool ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow)
void ethumb_frame_get(Ethumb *e, const char **theme_file, const char **group, const char **swallow)
void ethumb_thumb_dir_path_set(Ethumb *e, const char *path)
const char * ethumb_thumb_dir_path_get(Ethumb *e)
const char * ethumb_thumb_dir_path_get(Ethumb *e)
void ethumb_thumb_category_set(Ethumb *e, const char *category)
const char * ethumb_thumb_category_get(Ethumb *e)
const char * ethumb_thumb_category_get(Ethumb *e)
void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key)
void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key)
@ -84,7 +127,6 @@ cdef extern from "Ethumb.h":
void ethumb_video_fps_set(Ethumb *e, unsigned int fps)
unsigned int ethumb_video_fps_get(Ethumb *e)
# Basics
void ethumb_document_page_set(Ethumb *e, unsigned int page)
unsigned int ethumb_document_page_get(Ethumb *e)
@ -95,7 +137,7 @@ cdef extern from "Ethumb.h":
Eina_Bool ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, void *data, Eina_Free_Cb free_data)
Eina_Bool ethumb_exists(Ethumb *e)
Ethumb *ethumb_dup(Ethumb *e)
Ethumb * ethumb_dup(Ethumb *e)
Eina_Bool ethumb_cmp(Ethumb *e1, Ethumb *e2)
int ethumb_hash(void *key, int key_length)
int ethumb_key_cmp(void *key1, int key1_length, void *key2, int key2_length)

View File

@ -16,7 +16,7 @@
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from efl.eina cimport Eina_Bool, Eina_Free_Cb
from efl.ethumb.enums cimport Ethumb_Thumb_Orientation
from efl.ethumb cimport Ethumb_Thumb_Orientation
cdef extern from "Ethumb_Client.h":
ctypedef struct Ethumb_Client