31 int (*
save_func)(
const char * name,
const unsigned char * bytes,
32 int width,
int height,
int numcomponents);
34 int width,
int height,
int numcomponents,
const char * ext);
46 #ifdef SIMAGE_GDIPLUS_SUPPORT
61 #ifdef SIMAGE_RGB_SUPPORT
69 #ifdef SIMAGE_EPS_SUPPORT
73 #ifdef SIMAGE_QIMAGE_SUPPORT
76 #ifdef SIMAGE_QUICKTIME_SUPPORT
79 #ifdef SIMAGE_CGIMAGE_SUPPORT
93 newstr = (
char *) malloc(strlen(str) + 1);
102 if (str != NULL) free(str);
112 if (str1 == NULL && str2 != NULL)
return 1;
113 if (str1 != NULL && str2 == NULL)
return -1;
114 while (*str1 && *str2) {
115 int tst = tolower(*str1) - tolower(*str2);
120 return *str1 - *str2;
153 if (first_saver == NULL) first_saver = last_saver = saver;
160 last_saver->
next = saver;
170 const unsigned char *,
183 description, is_internal, addbefore);
190 const unsigned char *,
191 int,
int,
int,
const char *),
203 description, is_internal, addbefore);
221 str = strchr(ext,
',');
229 if (cmp == 0)
return saver;
231 str = strchr(ext,
',');
241 static const char jpegfull[] =
"The Independent JPEG Group file format";
243 static const char pngfull[] =
"The PNG file format";
245 static const char tifffull[] =
"The Tag Image File Format";
246 static char rgbext[] =
"rgb,rgba,bw,inta,int";
247 static const char rgbfull[] =
"The SGI RGB file format";
249 static const char giffull[] =
"The Graphics Interchange Format";
251 static const char epsfull[] =
"Encapsulated postscript";
257 *str = tolower(*str);
265 static int first = 1;
267 #if defined(SIMAGE_GDIPLUS_SUPPORT) || defined(SIMAGE_QIMAGE_SUPPORT) || \
268 defined(SIMAGE_QUICKTIME_SUPPORT) || defined(SIMAGE_CGIMAGE_SUPPORT)
300 #ifdef SIMAGE_RGB_SUPPORT
319 #ifdef SIMAGE_EPS_SUPPORT
329 #ifdef SIMAGE_GDIPLUS_SUPPORT
336 str = strchr(ext,
',');
348 if (str) ext = str + 1;
353 #ifdef SIMAGE_QIMAGE_SUPPORT
360 str = strchr(ext,
',');
372 if (str) ext = str + 1;
377 #ifdef SIMAGE_QUICKTIME_SUPPORT
384 str = strchr(ext,
',');
395 if (str) ext = str + 1;
401 #ifdef SIMAGE_CGIMAGE_SUPPORT
408 str = strchr(ext,
',');
419 if (str) ext = str + 1;
428 #define SIMAGE_ERROR_BUFSIZE 512
434 const unsigned char * bytes,
435 int width,
int height,
int numcomponents,
436 const char * filenameextension)
440 simage_error_msg[0] = 0;
450 height, numcomponents,
454 ret = saver->
save_func(filename, bytes, width,
455 height, numcomponents);
463 strcpy(simage_error_msg,
"Unsupported image format.");
470 const unsigned char * bytes,
471 int width,
int height,
int nc),
472 int (*
error_func)(
char * textbuffer,
int bufferlen),
494 while (saver && saver != (
saver_data*)handle) {
500 if (last_saver == saver) {
504 else first_saver = saver->
next;
520 return saver != NULL ? 1 : 0;
545 while (saver && idx) {
549 return (
void*) saver;
int simage_tiff_error(char *buffer, int bufferlen)
const char * simage_get_saver_fullname(void *handle)
void * simage_get_saver_handle(int idx)
static void add_saver_data(saver_data *saver, int(*error_func)(char *, int), const char *extensions, const char *fullname, const char *description, int is_internal, int addbefore)
int simage_rgb_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)
int simage_png_error(char *buffer, int bufferlen)
#define SIMAGE_ERROR_BUFSIZE
const char * simage_get_saver_extensions(void *handle)
int simage_tiff_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)
int simage_rgb_error(char *buffer, int bufferlen)
int simage_gif_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)
char * simage_qimage_get_savers(void)
static const char tifffull[]
const char * simage_get_saver_description(void *handle)
struct _saver_data * next
int simage_gif_error(char *buffer, int bufferlen)
int simage_eps_error(char *buffer, int bufferlen)
static void str_tolower(char *str)
int(* error_func)(char *textbuffer, int bufferlen)
int simage_cgimage_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *ext)
static int simage_strcasecmp(const char *str1, const char *str2)
int(* save_func)(const char *name, const unsigned char *bytes, int width, int height, int numcomponents)
static saver_data * first_saver
char * simage_quicktime_get_savers(void)
static const char rgbfull[]
static void add_internal_savers(void)
static const char epsfull[]
int simage_quicktime_save(const char *filename, const unsigned char *px, int width, int height, int numcomponents, const char *filetypeext)
int simage_qimage_error(char *buffer, int buflen)
int simage_eps_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)
static char * safe_strdup(const char *str)
static saver_data * last_saver
Windows specific information.
static const char pngfull[]
int simage_cgimage_error(char *cstr, int buflen)
static const char jpegfull[]
char * simage_cgimage_get_savers(void)
static void * add_saver(saver_data *saver, int(*save_func)(const char *, const unsigned char *, int, int, int), int(*error_func)(char *, int), const char *extensions, const char *fullname, const char *description, int is_internal, int addbefore)
int simage_gdiplus_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *filetypeext)
int simage_check_save_supported(const char *filenameextension)
int simage_get_num_savers(void)
int simage_gdiplus_error(char *buffer, int buflen)
static void safe_strfree(char *str)
void simage_remove_saver(void *handle)
static saver_data * find_saver(const char *filenameextension)
int simage_quicktime_error(char *cstr, int buflen)
int simage_qimage_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *filetypeext)
int simage_save_image(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *filenameextension)
int(* save_func_ext)(const char *name, const unsigned char *bytes, int width, int height, int numcomponents, const char *ext)
static void * add_saver_ext(saver_data *saver, int(*save_func)(const char *, const unsigned char *, int, int, int, const char *), int(*error_func)(char *, int), const char *extensions, const char *fullname, const char *description, int is_internal, int addbefore)
static const char giffull[]
int simage_jpeg_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)
int simage_jpeg_error(char *textbuffer, int buffersize)
void * simage_add_saver(int(*save_func)(const char *name, const unsigned char *bytes, int width, int height, int nc), int(*error_func)(char *textbuffer, int bufferlen), const char *extensions, const char *fullname, const char *description, int addbefore)
char * simage_gdiplus_get_savers(void)
int simage_png_save(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents)