simage  1.8.3
Coin3D texture image library
Loading...
Searching...
No Matches
simage_write.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include <simage.h>
#include <string.h>
#include <ctype.h>
#include <simage_jpeg.h>
#include <simage_png.h>
#include <simage_tiff.h>
#include <simage_rgb.h>
#include <simage_gif.h>
#include <simage_eps.h>

Data Structures

struct  _saver_data
 

Macros

#define SIMAGE_ERROR_BUFSIZE   512 /* hack warning. Must match define in simage.c */
 

Typedefs

typedef struct _saver_data saver_data
 

Functions

static void add_internal_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)
 
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)
 
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 saver_datafind_saver (const char *filenameextension)
 
static char * safe_strdup (const char *str)
 
static void safe_strfree (char *str)
 
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)
 
int simage_check_save_supported (const char *filenameextension)
 
int simage_get_num_savers (void)
 
const char * simage_get_saver_description (void *handle)
 
const char * simage_get_saver_extensions (void *handle)
 
const char * simage_get_saver_fullname (void *handle)
 
void * simage_get_saver_handle (int idx)
 
void simage_remove_saver (void *handle)
 
int simage_save_image (const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *filenameextension)
 
static int simage_strcasecmp (const char *str1, const char *str2)
 
static void str_tolower (char *str)
 

Variables

static saver_data eps_saver
 
static char epsext [] = "eps,ps"
 
static const char epsfull [] ="Encapsulated postscript"
 
static saver_datafirst_saver = NULL
 
static saver_data gif_saver
 
static char gifext [] = "gif"
 
static const char giffull [] = "The Graphics Interchange Format"
 
static saver_data jpeg_saver
 
static char jpegext [] = "jpg,jpeg"
 
static const char jpegfull [] = "The Independent JPEG Group file format"
 
static saver_datalast_saver = NULL
 
static saver_data png_saver
 
static char pngext [] = "png"
 
static const char pngfull [] = "The PNG file format"
 
static saver_data rgb_saver
 
static char rgbext [] = "rgb,rgba,bw,inta,int"
 
static const char rgbfull [] ="The SGI RGB file format"
 
char simage_error_msg []
 
static saver_data tiff_saver
 
static char tiffext [] = "tiff,tif"
 
static const char tifffull [] = "The Tag Image File Format"
 

Macro Definition Documentation

◆ SIMAGE_ERROR_BUFSIZE

#define SIMAGE_ERROR_BUFSIZE   512 /* hack warning. Must match define in simage.c */

Typedef Documentation

◆ saver_data

typedef struct _saver_data saver_data

Function Documentation

◆ add_internal_savers()

static void add_internal_savers ( void )
static

◆ add_saver()

static void * add_saver ( saver_data * saver,
int(*)(const char *, const unsigned char *, int, int, int) save_func,
int(*)(char *, int) error_func,
const char * extensions,
const char * fullname,
const char * description,
int is_internal,
int addbefore )
static

◆ add_saver_data()

static void add_saver_data ( saver_data * saver,
int(*)(char *, int) error_func,
const char * extensions,
const char * fullname,
const char * description,
int is_internal,
int addbefore )
static

◆ add_saver_ext()

static void * add_saver_ext ( saver_data * saver,
int(*)(const char *, const unsigned char *, int, int, int, const char *) save_func,
int(*)(char *, int) error_func,
const char * extensions,
const char * fullname,
const char * description,
int is_internal,
int addbefore )
static

◆ find_saver()

static saver_data * find_saver ( const char * filenameextension)
static

◆ safe_strdup()

static char * safe_strdup ( const char * str)
static

◆ safe_strfree()

static void safe_strfree ( char * str)
static

◆ simage_add_saver()

void * simage_add_saver ( int(*)(const char *name, const unsigned char *bytes, int width, int height, int nc) save_func,
int(*)(char *textbuffer, int bufferlen) error_func,
const char * extensions,
const char * fullname,
const char * description,
int addbefore )

◆ simage_check_save_supported()

int simage_check_save_supported ( const char * filenameextension)

Checks if export is available for a file type. Returns 1 if a saver of type filenameextension is supported, 0 otherwise. The built-in savers are gif, jpg/jpeg, png, tif/tiff and rgb.

◆ simage_get_num_savers()

int simage_get_num_savers ( void )

◆ simage_get_saver_description()

const char * simage_get_saver_description ( void * handle)

◆ simage_get_saver_extensions()

const char * simage_get_saver_extensions ( void * handle)

◆ simage_get_saver_fullname()

const char * simage_get_saver_fullname ( void * handle)

◆ simage_get_saver_handle()

void * simage_get_saver_handle ( int idx)

◆ simage_remove_saver()

void simage_remove_saver ( void * handle)

◆ simage_save_image()

int simage_save_image ( const char * filename,
const unsigned char * bytes,
int w,
int h,
int numcomponents,
const char * filenameextension )

Saves image in the format specified in filenameextension. Use simage_check_write_supported first to verify that the file format is supported.

◆ simage_strcasecmp()

static int simage_strcasecmp ( const char * str1,
const char * str2 )
static

◆ str_tolower()

static void str_tolower ( char * str)
static

Variable Documentation

◆ eps_saver

saver_data eps_saver
static

◆ epsext

char epsext[] = "eps,ps"
static

◆ epsfull

const char epsfull[] ="Encapsulated postscript"
static

◆ first_saver

saver_data* first_saver = NULL
static

◆ gif_saver

saver_data gif_saver
static

◆ gifext

char gifext[] = "gif"
static

◆ giffull

const char giffull[] = "The Graphics Interchange Format"
static

◆ jpeg_saver

saver_data jpeg_saver
static

◆ jpegext

char jpegext[] = "jpg,jpeg"
static

◆ jpegfull

const char jpegfull[] = "The Independent JPEG Group file format"
static

◆ last_saver

saver_data* last_saver = NULL
static

◆ png_saver

saver_data png_saver
static

◆ pngext

char pngext[] = "png"
static

◆ pngfull

const char pngfull[] = "The PNG file format"
static

◆ rgb_saver

saver_data rgb_saver
static

◆ rgbext

char rgbext[] = "rgb,rgba,bw,inta,int"
static

◆ rgbfull

const char rgbfull[] ="The SGI RGB file format"
static

◆ simage_error_msg

char simage_error_msg[]
extern

◆ tiff_saver

saver_data tiff_saver
static

◆ tiffext

char tiffext[] = "tiff,tif"
static

◆ tifffull

const char tifffull[] = "The Tag Image File Format"
static