5 typedef struct _Evas_Cache_Image Evas_Cache_Image;
6 typedef struct _Evas_Cache_Image_Func Evas_Cache_Image_Func;
7 typedef struct _Evas_Cache_Engine_Image Evas_Cache_Engine_Image;
8 typedef struct _Evas_Cache_Engine_Image_Func Evas_Cache_Engine_Image_Func;
11 struct _Evas_Cache_Image_Func
13 Image_Entry *(*alloc)(void);
14 void (*dealloc)(Image_Entry *im);
16 /* The cache provide some helpers for surface manipulation. */
17 int (*surface_alloc)(Image_Entry *im, int w, int h);
18 void (*surface_delete)(Image_Entry *im);
19 DATA32 *(*surface_pixels)(Image_Entry *im);
21 /* The cache is doing the allocation and deallocation, you must just do the rest. */
22 int (*constructor)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
23 void (*destructor)(Image_Entry *im);
25 void (*dirty_region)(Image_Entry *im, int x, int y, int w, int h);
26 /* Only called when references > 0. Need to provide a fresh copie of im. */
27 /* The destination surface does have a surface, but no allocated pixel data. */
28 int (*dirty)(Image_Entry *dst, const Image_Entry *src);
29 /* Only called when references == 1. We will call drop on `im'. */
30 /* The destination surface does not have any surface. */
31 int (*size_set)(Image_Entry *dst, const Image_Entry *src, int w, int h);
33 /* The destination surface does not have any surface. */
34 int (*copied_data)(Image_Entry *dst, int w, int h, DATA32 *image_data, int alpha, int cspace);
35 /* The destination surface does not have any surface. */
36 int (*data)(Image_Entry *dst, int w, int h, DATA32 *image_data, int alpha, int cspace);
37 int (*color_space)(Image_Entry *dst, int cspace);
39 /* This function need to update im->w and im->h. */
40 int (*load)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
41 int (*mem_size_get)(Image_Entry *im);
42 void (*debug)(const char *context, Image_Entry *im);
45 struct _Evas_Cache_Image
47 Evas_Cache_Image_Func func;
55 Eina_Inlist *lru_nodata;
63 #ifdef EVAS_FRAME_QUEUING
68 struct _Evas_Cache_Engine_Image_Func
70 /* Must return a char* allocated with eina_stringshare_add. */
71 char* (*key)(Image_Entry *im, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
73 Engine_Image_Entry* (*alloc)(void);
74 void (*dealloc)(Engine_Image_Entry *eim);
76 int (*constructor)(Engine_Image_Entry *eim, void* data);
77 void (*destructor)(Engine_Image_Entry *eim);
79 void (*dirty_region)(Engine_Image_Entry *eim, int x, int y, int w, int h);
80 /* Only called when references > 0. Need to provide a fresh copie of im. */
81 int (*dirty)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
82 /* Only called when references == 1. We will call drop on `im'. */
83 int (*size_set)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
85 int (*update_data)(Engine_Image_Entry* dst, void* data);
87 void (*load)(Engine_Image_Entry *eim, const Image_Entry* im);
88 int (*mem_size_get)(Engine_Image_Entry *eim);
89 void (*debug)(const char* context, Engine_Image_Entry *eim);
92 struct _Evas_Cache_Engine_Image
94 Evas_Cache_Engine_Image_Func func;
102 Evas_Cache_Image* parent;
103 Evas_Cache_Engine_Image* brother;
117 EAPI Evas_Cache_Image* evas_cache_image_init(const Evas_Cache_Image_Func *cb);
118 EAPI void evas_cache_image_shutdown(Evas_Cache_Image *cache);
119 EAPI Image_Entry* evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
120 EAPI void evas_cache_image_drop(Image_Entry *im);
121 EAPI void evas_cache_image_data_not_needed(Image_Entry *im);
122 EAPI int evas_cache_image_flush(Evas_Cache_Image *cache);
123 EAPI void evas_cache_private_set(Evas_Cache_Image *cache, const void *data);
124 EAPI void* evas_cache_private_get(Evas_Cache_Image *cache);
125 EAPI void* evas_cache_private_from_image_entry_get(Image_Entry *im);
127 EAPI int evas_cache_image_usage_get(Evas_Cache_Image *cache);
128 EAPI int evas_cache_image_get(Evas_Cache_Image *cache);
129 EAPI void evas_cache_image_set(Evas_Cache_Image *cache, int size);
131 EAPI Image_Entry* evas_cache_image_alone(Image_Entry *im);
132 EAPI Image_Entry* evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h);
133 EAPI void evas_cache_image_load_data(Image_Entry *im);
134 EAPI void evas_cache_image_unload_data(Image_Entry *im);
135 EAPI Eina_Bool evas_cache_image_is_loaded(Image_Entry *im);
136 EAPI void evas_cache_image_unload_all(Evas_Cache_Image *cache);
137 EAPI void evas_cache_image_surface_alloc(Image_Entry *im, int w, int h);
138 EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
139 EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
140 EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
141 EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);
142 EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
143 EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, int w, int h);
145 EAPI Evas_Cache_Engine_Image* evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent);
146 EAPI void evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache);
148 EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache);
149 EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache);
150 EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit);
152 EAPI Engine_Image_Entry* evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, void *engine_data, int *error);
153 EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim);
154 EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data);
155 EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim);
156 EAPI Engine_Image_Entry* evas_cache_engine_image_alone(Engine_Image_Entry *eim, void *data);
157 EAPI Engine_Image_Entry* evas_cache_engine_image_dirty(Engine_Image_Entry *eim, int x, int y, int w, int h);
158 EAPI Engine_Image_Entry* evas_cache_engine_image_copied_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
159 EAPI Engine_Image_Entry* evas_cache_engine_image_data(Evas_Cache_Engine_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace, void *engine_data);
160 EAPI void evas_cache_engine_image_colorspace(Engine_Image_Entry *eim, int cspace, void *engine_data);
161 EAPI Engine_Image_Entry* evas_cache_engine_image_size_set(Engine_Image_Entry *eim, int w, int h);
163 EAPI void evas_cache_engine_image_load_data(Engine_Image_Entry *eim);
165 EAPI void evas_cache_image_preload_data(Image_Entry *im, const void *target);
166 EAPI void evas_cache_image_preload_cancel(Image_Entry *im, const void *target);
168 EAPI void evas_cache_image_wakeup(void);
175 #endif /* _EVAS_CACHE_H */