31 unsigned char * prealloc )
39 image->
data = prealloc;
40 if (image->
data == NULL) {
42 image->
data = (
unsigned char *) malloc((
size_t)w*h*components);
74 if (image)
return image->
width;
81 if (image)
return image->
height;
96 int oldorder = image->
order;
115 for (i = 0; i < image->
height; i++) {
127 unsigned char * data,
int copydata)
133 image->
data = (
unsigned char*) malloc((
size_t)w*h*components);
136 memcpy(image->
data, data, (
size_t)w*h*components);
150 image->
data = (
unsigned char *) malloc((
size_t)w*h*components);
152 memcpy(image->
data, data, (
size_t)w*h*components);
165 unsigned char * data;
169 if (data == NULL)
return NULL;
170 if (prealloc == NULL ||
171 prealloc->
width != w ||
179 memcpy(prealloc->
data, data, (
size_t)w*h*nc);
185 prealloc->
openfilename = (
char*) malloc(strlen(filename) + 1);
195 if (params != NULL) {
201 ext = (
char*) strrchr(filename,
'.');
202 if (ext == NULL)
return 0;
int s_image_set_component_order(s_image *image, int order)
int s_params_get(s_params *params,...)
s_image * s_image_create(int w, int h, int components, unsigned char *prealloc)
void s_image_destroy(s_image *image)
void simage_free_image(unsigned char *imagedata)
int s_image_get_component_order(s_image *image)
int s_image_components(s_image *image)
void s_image_set(s_image *image, int w, int h, int components, unsigned char *data, int copydata)
struct simage_open_funcs openfuncs
int s_image_width(s_image *image)
Windows specific information.
int s_image_read_line(s_image *image, int line, unsigned char *buf)
void(* close_func)(void *opendata)
unsigned char * s_image_data(s_image *image)
s_image * s_image_load(const char *filename, s_image *prealloc)
int simage_save_image(const char *filename, const unsigned char *bytes, int width, int height, int numcomponents, const char *filenameextension)
int s_image_save(const char *filename, s_image *image, s_params *params)
int s_image_height(s_image *image)
unsigned char * simage_read_image(const char *filename, int *width, int *height, int *numComponents)