45 #ifdef SIMAGE_GDIPLUS_SUPPORT
61 #ifdef SIMAGE_TGA_SUPPORT
69 #ifdef SIMAGE_PIC_SUPPORT
73 #ifdef SIMAGE_RGB_SUPPORT
81 #ifdef SIMAGE_XWD_SUPPORT
85 #ifdef SIMAGE_QIMAGE_SUPPORT
89 #ifdef SIMAGE_QUICKTIME_SUPPORT
93 #ifdef SIMAGE_CGIMAGE_SUPPORT
112 unsigned char *(*load_func)(
const char *,
116 int (*identify_func)(
const char *,
117 const unsigned char *,
119 int (*error_func)(
char *,
int),
131 if (first_loader == NULL) first_loader = last_loader = loader;
135 first_loader = loader;
138 last_loader->
next = loader;
139 last_loader = loader;
142 return (
void*) loader;
155 unsigned char buf[256] = {0};
156 FILE *fp = fopen(filename,
"rb");
157 if (!fp)
return NULL;
159 readlen = fread(buf, 1, 256, fp);
162 if (err)
return NULL;
167 loader = loader->
next;
176 static int first = 1;
179 #ifdef SIMAGE_GDIPLUS_SUPPORT
203 #ifdef SIMAGE_TGA_SUPPORT
231 #ifdef SIMAGE_RGB_SUPPORT
241 #ifdef SIMAGE_PIC_SUPPORT
255 #ifdef SIMAGE_XWD_SUPPORT
262 #ifdef SIMAGE_QIMAGE_SUPPORT
269 #ifdef SIMAGE_QUICKTIME_SUPPORT
277 #ifdef SIMAGE_CGIMAGE_SUPPORT
288 #define SIMAGE_ERROR_BUFSIZE 512
293 int *width,
int *height,
298 simage_error_msg[0] = 0;
304 unsigned char * data =
306 height, numComponents);
313 strcpy(simage_error_msg,
"Unsupported image format.");
353 loader = loader->
next;
357 if (last_loader == loader) {
360 if (prev) prev->
next = loader->
next;
361 else first_loader = loader->
next;
362 if (loader) free(loader);
400 if ( major != NULL ) *major = SIMAGE_MAJOR_VERSION;
401 if ( minor != NULL ) *minor = SIMAGE_MINOR_VERSION;
402 if ( micro != NULL ) *micro = SIMAGE_MICRO_VERSION;
408 if (imagedata) free(imagedata);
419 simage_error_msg[0] = 0;
438 image->
openfilename = (
char*) malloc(strlen(filename)+1);
459 memcpy(buf, image->
data + bpr*line, bpr);
int simage_png_identify(const char *filename, const unsigned char *header, int headerlen)
unsigned char * simage_rgb_load(const char *filename, int *width, int *height, int *numcomponents)
void * simage_tiff_open(const char *filename, int *width, int *height, int *numcomponents)
int simage_next_power_of_two(int val)
int simage_tiff_error(char *buffer, int bufferlen)
int(* read_line_func)(void *opendata, int y, unsigned char *buf)
struct simage_plugin funcs
int simage_tga_error(char *buffer, int bufferlen)
int simage_rgb_read_line(void *opendata, int y, unsigned char *buf)
void s_dlclose_func(void *handle)
int simage_png_error(char *buffer, int bufferlen)
static s_dlsym_func * dlsym
void simage_rgb_close(void *opendata)
int simage_rgb_error(char *buffer, int bufferlen)
void * s_dlopen_func(const char *filename)
unsigned char * simage_qimage_load(const char *filename, int *width_ret, int *height_ret, int *numComponents_ret)
void * simage_add_loader(const struct simage_plugin *plugin, int addbefore)
int simage_gif_identify(const char *filename, const unsigned char *header, int headerlen)
unsigned char * simage_pic_load(const char *filename, int *width, int *height, int *numComponents)
unsigned char * simage_quicktime_load(const char *file, int *width, int *height, int *numcomponents)
int simage_gif_error(char *buffer, int bufferlen)
char simage_error_msg[512+1]
static loader_data * first_loader
#define SIMAGE_ERROR_BUFSIZE
static loader_data * last_loader
int simage_pic_identify(const char *filename, const unsigned char *header, int headerlen)
struct simage_open_funcs openfuncs
static s_dlopen_func * dlopen
void simage_free_image(unsigned char *imagedata)
int simage_jpeg_identify(const char *filename, const unsigned char *header, int headerlen)
void simage_remove_loader(void *handle)
unsigned char * simage_tga_load(const char *filename, int *width, int *height, int *numComponents)
int simage_qimage_error(char *buffer, int buflen)
int(* identify_func)(const char *filename, const unsigned char *header, int headerlen)
struct simage_open_funcs openfuncs
int simage_cgimage_identify(const char *file, const unsigned char *header, int headerlen)
void simage_tiff_close(void *opendata)
void simage_gdiplus_close(void *opendata)
int simage_qimage_identify(const char *ptr, const unsigned char *header, int headerlen)
unsigned char * simage_tiff_load(const char *filename, int *width, int *height, int *numComponents)
int simage_xwd_identify(const char *filename, const unsigned char *header, int headerlen)
unsigned char * simage_gif_load(const char *filename, int *width, int *height, int *numComponents)
Windows specific information.
unsigned char * simage_xwd_load(const char *filename, int *width, int *height, int *numcomponents)
int simage_rgb_identify(const char *filename, const unsigned char *header, int headerlen)
int s_image_read_line(s_image *image, int line, unsigned char *buf)
void(* close_func)(void *opendata)
int simage_cgimage_error(char *cstr, int buflen)
void * simage_gdiplus_open(const char *filename, int *width, int *height, int *numcomponents)
void s_set_dynamic_loader_interface(s_dlopen_func *dlopen_func, s_dlsym_func *dlsym_func, s_dlclose_func *dlclose_func)
int simage_tiff_read_line(void *opendata, int y, unsigned char *buf)
void * s_dlsym_func(void *handle, const char *symbolname)
static int cnt_bits(int val, int *highbit)
s_image * s_image_load(const char *filename, s_image *prealloc)
static s_dlclose_func * dlclose
int simage_gdiplus_error(char *buffer, int buflen)
static void add_internal_loaders(void)
const char * simage_get_last_error(void)
s_image * s_image_open(const char *filename, int oktoreadall)
int simage_quicktime_error(char *cstr, int buflen)
unsigned char * simage_png_load(const char *filename, int *width, int *height, int *numComponents)
int simage_jasper_error(char *buffer, int bufferlen)
int simage_tga_identify(const char *filename, const unsigned char *header, int headerlen)
unsigned char * simage_gdiplus_load(const char *filename, int *width, int *height, int *numcomponents)
int simage_pic_error(char *buffer, int bufferlen)
int simage_gdiplus_read_line(void *opendata, int y, unsigned char *buf)
int simage_xwd_error(char *buffer, int bufferlen)
int simage_gdiplus_identify(const char *ptr, const unsigned char *header, int headerlen)
static loader_data * find_loader(const char *filename)
int simage_jasper_identify(const char *filename, const unsigned char *header, int headerlen)
struct _loader_data * next
static void * add_loader(loader_data *loader, unsigned char *(*load_func)(const char *, int *, int *, int *), int(*identify_func)(const char *, const unsigned char *, int headerlen), int(*error_func)(char *, int), int is_internal, int addbefore)
unsigned char *(* load_func)(const char *name, int *width, int *height, int *numcomponents)
void simage_clear_error(void)
unsigned char * simage_jasper_load(const char *filename, int *width, int *height, int *numComponents)
int simage_jpeg_error(char *textbuffer, int buffersize)
int simage_quicktime_identify(const char *file, const unsigned char *header, int headerlen)
void * simage_rgb_open(const char *filename, int *width, int *height, int *numcomponents)
unsigned char * simage_jpeg_load(const char *filename, int *width, int *height, int *numcomponents)
unsigned char * simage_read_image(const char *filename, int *width, int *height, int *numComponents)
void *(* open_func)(const char *filename, int *w, int *h, int *nc)
unsigned char * simage_cgimage_load(const char *file, int *width, int *height, int *numcomponents)
int simage_check_supported(const char *filename)
void simage_version(int *major, int *minor, int *micro)
int simage_tiff_identify(const char *filename, const unsigned char *header, int headerlen)
int(* error_func)(char *textbuffer, int bufferlen)