summaryrefslogtreecommitdiff
path: root/src/lib/ethumb/Ethumb.h
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-12 01:15:45 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-12 01:15:45 +0000
commit34f53151414bcdf44ec81e582b007f74da595694 (patch)
tree863058f0d94e9d39998774a375aa6d242d8714a4 /src/lib/ethumb/Ethumb.h
parentae51833bac7ba5f72bd40a96beb13081c8d573f6 (diff)
merge ethumb.
This one was a painful bitch. The edbus2 port was quite broken, mainly leaking eina_stringshare and also not adding the '\0' to the strings that are represented as bytearray (paths cannot be utf8 to avoid translations). Emotion plugin was also quite bogus and the video thumbnail as edje (animated) is not working yet due bug in Edje_Edit api -- someone needs to investigate this, seems strange. Emotion plugin also had a bug that it was deleting the object from inside object callback. Now it seems to work. Please report if it does not. SVN revision: 82675
Diffstat (limited to 'src/lib/ethumb/Ethumb.h')
-rw-r--r--src/lib/ethumb/Ethumb.h279
1 files changed, 279 insertions, 0 deletions
diff --git a/src/lib/ethumb/Ethumb.h b/src/lib/ethumb/Ethumb.h
new file mode 100644
index 0000000000..fd4dff708a
--- /dev/null
+++ b/src/lib/ethumb/Ethumb.h
@@ -0,0 +1,279 @@
1#ifndef __ETHUMB_H__
2#define __ETHUMB_H__ 1
3
4#include <Eina.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif
9
10#ifdef _WIN32
11# ifdef EFL_ETHUMB_BUILD
12# ifdef DLL_EXPORT
13# define EAPI __declspec(dllexport)
14# else
15# define EAPI
16# endif /* ! DLL_EXPORT */
17# else
18# define EAPI __declspec(dllimport)
19# endif /* ! EFL_ETHUMB_BUILD */
20#else
21# ifdef __GNUC__
22# if __GNUC__ >= 4
23# define EAPI __attribute__ ((visibility("default")))
24# else
25# define EAPI
26# endif
27# else
28# define EAPI
29# endif
30#endif /* ! _WIN32 */
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define ETHUMB_VERSION_MAJOR 1
37#define ETHUMB_VERSION_MINOR 8
38
39 typedef struct _Ethumb_Version
40 {
41 int major;
42 int minor;
43 int micro;
44 int revision;
45 } Ethumb_Version;
46
47 EAPI extern Ethumb_Version *ethumb_version;
48
49/**
50 * @page ethumb_main Ethumb
51 *
52 * @date 2009 (created)
53 *
54 * @section toc Table of Contents
55 *
56 * @li @ref ethumb_main_intro
57 * @li @ref ethumb_main_compiling
58 * @li @ref ethumb_main_next_steps
59 *
60 * @section ethumb_main_intro Introduction
61 *
62 * Ethumb will use @ref Evas to generate thumbnail images of given
63 * files. The API allows great customization of the generated files
64 * and also helps compling to FreeDesktop.Org Thumbnail Specification
65 * (http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html)
66 *
67 * However, thumbnailing can be an expensive process that will impact
68 * your application experience, blocking animations and user
69 * interaction during the generation. Another problem is that one
70 * should try to cache the thumbnails in a place that other
71 * applications can benefit from the file.
72 *
73 * @ref Ethumb_Client exists to solve this. It will communicate with a
74 * server using standard D-Bus protocol. The server will use @ref
75 * Ethumb itself to generate the thumbnail images and cache them using
76 * FreeDesktop.Org standard. It is recommended that most applications
77 * use @ref Ethumb_Client instead of @ref Ethumb directly.
78 *
79 * @section ethumb_main_compiling How to compile
80 *
81 * Ethumb is a library your application links to. The procedure for
82 * this is very simple. Note that usually you want the D-Bus client
83 * library. You simply have to compile your application with the
84 * appropriate compiler flags that the @c pkg-config script
85 * outputs. For example:
86 *
87 * Compiling C or C++ files into object files:
88 *
89 * @verbatim
90 gcc -c -o main.o main.c `pkg-config --cflags ethumb_client`
91 @endverbatim
92 *
93 * Linking object files into a binary executable:
94 *
95 * @verbatim
96 gcc -o my_application main.o `pkg-config --libs ethumb_client`
97 @endverbatim
98 *
99 * See @ref pkgconfig
100 *
101 * @section ethumb_main_next_steps Next Steps
102 *
103 * After you understood what Ethumb is and installed it in your system
104 * you should proceed understanding the programming interface.
105 *
106 * Recommended reading:
107 *
108 * @li @ref Ethumb_Client to generate thumbnails using a server
109 * (recommended).
110 * @li @ref Ethumb to generate thumbnails in the local process.
111 *
112 */
113
114/**
115 * @defgroup Ethumb Ethumb
116 *
117 * @{
118 */
119/**
120 * @defgroup Ethumb_Basics Ethumb Basics
121 *
122 * Functions that all users must know of to use Ethumb.
123 *
124 * @{
125 */
126
127/**
128 * @brief thumbnailer handle.
129 *
130 * The handle is returned by ethumb_new() and destroyed by ethumb_free().
131 */
132typedef struct _Ethumb Ethumb;
133
134/**
135 * @brief reports results of ethumb_generate().
136 *
137 * @param data extra context given to ethumb_generate().
138 * @param e handle of the current thumbnailer.
139 * @param success @c EINA_TRUE if generated or @c EINA_FALSE on errors.
140 */
141typedef void (*Ethumb_Generate_Cb)(void *data, Ethumb *e, Eina_Bool success);
142
143EAPI int ethumb_init(void);
144EAPI int ethumb_shutdown(void);
145
146EAPI Ethumb * ethumb_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
147EAPI void ethumb_free(Ethumb *e);
148
149/**
150 * @}
151 */
152
153/**
154 * @defgroup Ethumb_Setup Ethumb Fine Tune Setup
155 *
156 * How to fine tune thumbnail generation, setting size, aspect,
157 * frames, quality and so on.
158 *
159 * @{
160 */
161
162EAPI Eina_Bool ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1);
163EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1);
164
165EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1);
166EAPI const char *ethumb_thumb_dir_path_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
167
168EAPI void ethumb_thumb_category_set(Ethumb *e, const char *category) EINA_ARG_NONNULL(1);
169EAPI const char *ethumb_thumb_category_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
170
171EAPI void ethumb_thumb_path_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1);
172EAPI void ethumb_thumb_path_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
173EAPI void ethumb_thumb_hash(Ethumb *e) EINA_ARG_NONNULL(1);
174EAPI void ethumb_thumb_hash_copy(Ethumb *dst, const Ethumb *src) EINA_ARG_NONNULL(1, 2);
175
176typedef enum _Ethumb_Thumb_FDO_Size
177{
178 ETHUMB_THUMB_NORMAL, /**< 128x128 as defined by FreeDesktop.Org standard */
179 ETHUMB_THUMB_LARGE /**< 256x256 as defined by FreeDesktop.Org standard */
180} Ethumb_Thumb_FDO_Size;
181
182typedef enum _Ethumb_Thumb_Format
183{
184 ETHUMB_THUMB_FDO, /**< PNG as defined by FreeDesktop.Org standard */
185 ETHUMB_THUMB_JPEG, /**< JPEGs are often smaller and faster to read/write */
186 ETHUMB_THUMB_EET /**< EFL's own storage system, supports key parameter */
187} Ethumb_Thumb_Format;
188
189typedef enum _Ethumb_Thumb_Aspect
190{
191 ETHUMB_THUMB_KEEP_ASPECT, /**< keep original proportion between width and height */
192 ETHUMB_THUMB_IGNORE_ASPECT, /**< ignore aspect and foce it to match thumbnail's width and height */
193 ETHUMB_THUMB_CROP /**< keep aspect but crop (cut) the largest dimension */
194} Ethumb_Thumb_Aspect;
195
196typedef enum _Ethumb_Thumb_Orientation
197{
198 ETHUMB_THUMB_ORIENT_NONE, /**< keep orientation as pixel data is */
199 ETHUMB_THUMB_ROTATE_90_CW, /**< rotate 90° clockwise */
200 ETHUMB_THUMB_ROTATE_180, /**< rotate 180° */
201 ETHUMB_THUMB_ROTATE_90_CCW, /**< rotate 90° counter-clockwise */
202 ETHUMB_THUMB_FLIP_HORIZONTAL, /**< flip horizontally */
203 ETHUMB_THUMB_FLIP_VERTICAL, /**< flip vertically */
204 ETHUMB_THUMB_FLIP_TRANSPOSE, /**< transpose */
205 ETHUMB_THUMB_FLIP_TRANSVERSE, /**< transverse */
206 ETHUMB_THUMB_ORIENT_ORIGINAL /**< use orientation from metadata (EXIF-only currently) */
207} Ethumb_Thumb_Orientation;
208
209EAPI void ethumb_thumb_fdo_set(Ethumb *e, Ethumb_Thumb_FDO_Size s) EINA_ARG_NONNULL(1);
210
211EAPI void ethumb_thumb_size_set(Ethumb *e, int tw, int th) EINA_ARG_NONNULL(1);
212EAPI void ethumb_thumb_size_get(const Ethumb *e, int *tw, int *th) EINA_ARG_NONNULL(1);
213
214EAPI void ethumb_thumb_format_set(Ethumb *e, Ethumb_Thumb_Format f) EINA_ARG_NONNULL(1);
215EAPI Ethumb_Thumb_Format ethumb_thumb_format_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
216
217EAPI void ethumb_thumb_aspect_set(Ethumb *e, Ethumb_Thumb_Aspect a) EINA_ARG_NONNULL(1);
218EAPI Ethumb_Thumb_Aspect ethumb_thumb_aspect_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
219
220EAPI void ethumb_thumb_orientation_set(Ethumb *e, Ethumb_Thumb_Orientation o) EINA_ARG_NONNULL(1);
221EAPI Ethumb_Thumb_Orientation ethumb_thumb_orientation_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
222
223EAPI void ethumb_thumb_crop_align_set(Ethumb *e, float x, float y) EINA_ARG_NONNULL(1);
224EAPI void ethumb_thumb_crop_align_get(const Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1);
225
226EAPI void ethumb_thumb_quality_set(Ethumb *e, int quality) EINA_ARG_NONNULL(1);
227EAPI int ethumb_thumb_quality_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE;
228
229EAPI void ethumb_thumb_compress_set(Ethumb *e, int compress) EINA_ARG_NONNULL(1);
230EAPI int ethumb_thumb_compress_get(const Ethumb *e) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE;
231
232EAPI void ethumb_video_start_set(Ethumb *e, float start) EINA_ARG_NONNULL(1);
233EAPI float ethumb_video_start_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
234EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1);
235EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
236EAPI void ethumb_video_interval_set(Ethumb *e, float interval) EINA_ARG_NONNULL(1);
237EAPI float ethumb_video_interval_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
238EAPI void ethumb_video_ntimes_set(Ethumb *e, unsigned int ntimes) EINA_ARG_NONNULL(1);
239EAPI unsigned int ethumb_video_ntimes_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
240EAPI void ethumb_video_fps_set(Ethumb *e, unsigned int fps) EINA_ARG_NONNULL(1);
241EAPI unsigned int ethumb_video_fps_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
242
243
244EAPI void ethumb_document_page_set(Ethumb *e, unsigned int page) EINA_ARG_NONNULL(1);
245EAPI unsigned int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
246/**
247 * @}
248 */
249
250/**
251 * @addtogroup Ethumb_Basics Ethumb Basics
252 * @{
253 */
254EAPI Eina_Bool ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2);
255EAPI void ethumb_file_get(const Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1);
256EAPI void ethumb_file_free(Ethumb *e) EINA_ARG_NONNULL(1);
257
258EAPI Eina_Bool ethumb_generate(Ethumb *e, Ethumb_Generate_Cb finished_cb, const void *data, Eina_Free_Cb free_data) EINA_ARG_NONNULL(1, 2);
259EAPI Eina_Bool ethumb_exists(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
260
261EAPI Ethumb *ethumb_dup(const Ethumb *e) EINA_ARG_NONNULL(1);
262EAPI Eina_Bool ethumb_cmp(const Ethumb *e1, const Ethumb *e2) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT EINA_PURE;
263EAPI int ethumb_hash(const void *key, int key_length) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE;
264EAPI int ethumb_key_cmp(const void *key1, int key1_length,
265 const void *key2, int key2_length) EINA_ARG_NONNULL(1, 3) EINA_WARN_UNUSED_RESULT EINA_PURE;
266EAPI unsigned int ethumb_length(const void *key) EINA_PURE EINA_WARN_UNUSED_RESULT;
267
268 /**
269 * @}
270 */
271
272/**
273 * @}
274 */
275
276#ifdef __cplusplus
277}
278#endif
279#endif /* __ETHUMB_H__ */