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);
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);
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;
49 Evas_Object_List *dirty;
51 Evas_Object_List *lru;
52 Evas_Object_List *lru_nodata;
62 struct _Evas_Cache_Engine_Image_Func
64 /* Must return a char* allocated with evas_stringshare_add. */
65 char* (*key)(Image_Entry *im, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
67 Engine_Image_Entry* (*alloc)(void);
68 void (*dealloc)(Engine_Image_Entry *eim);
70 int (*constructor)(Engine_Image_Entry *eim, void* data);
71 void (*destructor)(Engine_Image_Entry *eim);
73 void (*dirty_region)(Engine_Image_Entry *eim, int x, int y, int w, int h);
74 /* Only called when references > 0. Need to provide a fresh copie of im. */
75 int (*dirty)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
76 /* Only called when references == 1. We will call drop on `im'. */
77 int (*size_set)(Engine_Image_Entry *dst, const Engine_Image_Entry *src);
79 int (*update_data)(Engine_Image_Entry* dst, void* data);
81 void (*load)(Engine_Image_Entry *eim, const Image_Entry* im);
82 int (*mem_size_get)(Engine_Image_Entry *eim);
83 void (*debug)(const char* context, Engine_Image_Entry *eim);
86 struct _Evas_Cache_Engine_Image
88 Evas_Cache_Engine_Image_Func func;
90 Evas_Object_List* dirty;
94 Evas_Object_List* lru;
96 Evas_Cache_Image* parent;
97 Evas_Cache_Engine_Image* brother;
111 EAPI Evas_Cache_Image* evas_cache_image_init(const Evas_Cache_Image_Func *cb);
112 EAPI void evas_cache_image_shutdown(Evas_Cache_Image *cache);
113 EAPI Image_Entry* evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error);
114 EAPI void evas_cache_image_drop(Image_Entry *im);
115 EAPI void evas_cache_image_data_not_needed(Image_Entry *im);
116 EAPI int evas_cache_image_flush(Evas_Cache_Image *cache);
117 EAPI void evas_cache_private_set(Evas_Cache_Image *cache, const void *data);
118 EAPI void* evas_cache_private_get(Evas_Cache_Image *cache);
119 EAPI void* evas_cache_private_from_image_entry_get(Image_Entry *im);
121 EAPI int evas_cache_image_usage_get(Evas_Cache_Image *cache);
122 EAPI int evas_cache_image_get(Evas_Cache_Image *cache);
123 EAPI void evas_cache_image_set(Evas_Cache_Image *cache, int size);
125 EAPI Image_Entry* evas_cache_image_alone(Image_Entry *im);
126 EAPI Image_Entry* evas_cache_image_dirty(Image_Entry *im, int x, int y, int w, int h);
127 EAPI void evas_cache_image_load_data(Image_Entry *im);
128 EAPI void evas_cache_image_surface_alloc(Image_Entry *im, int w, int h);
129 EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
130 EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
131 EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, int w, int h, DATA32 *image_data, int alpha, int cspace);
132 EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace);
133 EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
134 EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, int w, int h);
136 EAPI Evas_Cache_Engine_Image* evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_Image *parent);
137 EAPI void evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache);
139 EAPI void evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache);
140 EAPI int evas_cache_engine_image_usage_get(Evas_Cache_Engine_Image *cache);
141 EAPI int evas_cache_engine_image_get(Evas_Cache_Engine_Image *cache);
142 EAPI void evas_cache_engine_image_set(Evas_Cache_Engine_Image *cache, int limit);
144 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);
145 EAPI void evas_cache_engine_parent_not_needed(Engine_Image_Entry *eim);
146 EAPI Engine_Image_Entry* evas_cache_engine_image_engine(Evas_Cache_Engine_Image *cache, void *engine_data);
147 EAPI void evas_cache_engine_image_drop(Engine_Image_Entry *eim);
148 EAPI Engine_Image_Entry* evas_cache_engine_image_alone(Engine_Image_Entry *eim, void *data);
149 EAPI Engine_Image_Entry* evas_cache_engine_image_dirty(Engine_Image_Entry *eim, int x, int y, int w, int h);
150 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);
151 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);
152 EAPI void evas_cache_engine_image_colorspace(Engine_Image_Entry *eim, int cspace, void *engine_data);
153 EAPI Engine_Image_Entry* evas_cache_engine_image_size_set(Engine_Image_Entry *eim, int w, int h);
155 EAPI void evas_cache_engine_image_load_data(Engine_Image_Entry *eim);
163 #endif /* _EVAS_CACHE_H */