Picasso API
2.2
|
00001 00018 #ifndef _PICASSO_EXT_IMAGE_DECODERS_H_ 00019 #define _PICASSO_EXT_IMAGE_DECODERS_H_ 00020 00021 #include "picasso.h" 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00043 typedef struct _psx_image_frame { 00045 ps_image* img; 00047 ps_byte* data; 00049 size_t size; 00051 int duration; 00052 }psx_image_frame; 00053 00057 typedef struct _psx_image { 00059 int width; 00061 int height; 00063 int pitch; 00065 ps_color_format format; 00067 psx_image_frame* frames; 00069 size_t num_frames; 00070 }psx_image; 00071 00077 #define IMG_OBJ(image) IMG_OBJ_AT_INDEX(image, 0) 00078 00084 #define IMG_DATA(image) IMG_DATA_AT_INDEX(image, 0) 00085 00091 #define IMG_DATA_SIZE(image) IMG_DATA_SIZE_AT_INDEX(image, 0) 00092 00098 #define IMG_OBJ_AT_INDEX(image, idx) (image->frames[idx].img) 00099 00105 #define IMG_DATA_AT_INDEX(image, idx) (image->frames[idx].data) 00106 00112 #define IMG_DATA_SIZE_AT_INDEX(img, idx) (img->frames[idx].size) 00113 00119 #define IMG_DURATION_AT_INDEX(img, idx) (img->frames[idx].duration) 00120 00124 enum { 00126 S_OK = 0, 00128 S_BAD_PARAMS = 1, 00130 S_NOT_SUPPORT = 2, 00132 S_OUT_OF_MEMORY = 3, 00134 S_INIT_FAILURE = 4, 00136 S_FAILURE = 5, 00137 }; 00138 00154 PEXPORT int PICAPI psx_image_init(void); 00155 00164 PEXPORT int PICAPI psx_image_shutdown(void); 00165 00184 PEXPORT psx_image* PICAPI psx_image_create_from_data(ps_byte* data, ps_color_format fmt, 00185 int width, int height, int pitch, int* err_code); 00186 00199 PEXPORT psx_image* PICAPI psx_image_load(const char* file_name, int* err_code); 00200 00214 PEXPORT psx_image* PICAPI psx_image_load_from_memory(const ps_byte* data, size_t length, int* err_code); 00215 00219 typedef int (*image_writer_fn)(void* param, const ps_byte* data, size_t length); 00220 00235 PEXPORT int PICAPI psx_image_save(const psx_image* image, image_writer_fn func, 00236 void* param, const char* type, float quality); 00237 00251 PEXPORT int PICAPI psx_image_save_to_file(const psx_image* image, const char* file_name, 00252 const char* type, float quality); 00253 00264 PEXPORT int PICAPI psx_image_destroy(psx_image* image); 00269 #ifdef __cplusplus 00270 } 00271 #endif 00272 00273 #endif /*_PICASSO_EXT_IMAGE_DECODERS_H_*/ 00274