simage
1.8.3
Coin3D texture image library
|
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include <simage.h>
#include <simage_private.h>
#include <string.h>
#include <simage_jpeg.h>
#include <simage_png.h>
#include <simage_tga.h>
#include <simage_tiff.h>
#include <simage_pic.h>
#include <simage_rgb.h>
#include <simage_gif.h>
Data Structures | |
struct | _loader_data |
Macros | |
#define | SIMAGE_ERROR_BUFSIZE 512 |
Typedefs | |
typedef struct _loader_data | loader_data |
Functions | |
static void | add_internal_loaders (void) |
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) |
static int | cnt_bits (int val, int *highbit) |
static loader_data * | find_loader (const char *filename) |
s_image * | s_image_open (const char *filename, int oktoreadall) |
int | s_image_read_line (s_image *image, int line, unsigned char *buf) |
void | s_set_dynamic_loader_interface (s_dlopen_func *dlopen_func, s_dlsym_func *dlsym_func, s_dlclose_func *dlclose_func) |
void * | simage_add_loader (const struct simage_plugin *plugin, int addbefore) |
int | simage_check_supported (const char *filename) |
void | simage_clear_error (void) |
void | simage_free_image (unsigned char *imagedata) |
const char * | simage_get_last_error (void) |
int | simage_next_power_of_two (int val) |
unsigned char * | simage_read_image (const char *filename, int *width, int *height, int *numComponents) |
void | simage_remove_loader (void *handle) |
void | simage_version (int *major, int *minor, int *micro) |
Variables | |
static s_dlclose_func * | dlclose = NULL |
static s_dlopen_func * | dlopen = NULL |
static s_dlsym_func * | dlsym = NULL |
static loader_data * | first_loader = NULL |
static loader_data | gif_loader |
static loader_data | jpeg_loader |
static loader_data * | last_loader = NULL |
static loader_data | pic_loader |
static loader_data | png_loader |
static loader_data | rgb_loader |
char | simage_error_msg [512+1] |
static loader_data | targa_loader |
static loader_data | tiff_loader |
#define SIMAGE_ERROR_BUFSIZE 512 |
typedef struct _loader_data loader_data |
|
static |
|
static |
|
static |
|
static |
s_image * s_image_open | ( | const char * | filename, |
int | oktoreadall ) |
int s_image_read_line | ( | s_image * | image, |
int | line, | ||
unsigned char * | buf ) |
void s_set_dynamic_loader_interface | ( | s_dlopen_func * | dlopen_func, |
s_dlsym_func * | dlsym_func, | ||
s_dlclose_func * | dlclose_func ) |
void * simage_add_loader | ( | const struct simage_plugin * | plugin, |
int | addbefore ) |
int simage_check_supported | ( | const char * | filename | ) |
Checks if image file format is supported. Returns 1 if filename can be loaded, 0 otherwise.
void simage_clear_error | ( | void | ) |
void simage_free_image | ( | unsigned char * | imagedata | ) |
Free resources allocated by either simage_read_image() or simage_resize() (Windows goes berzerk if you call free() from the client application)
const char * simage_get_last_error | ( | void | ) |
Returns error message, which is set when simage_read_image returned NULL or simage_write_image returns 0.
int simage_next_power_of_two | ( | int | val | ) |
Returns the first 2^n bigger or equal to val. If simage_next_power_of_two(size) != size, you'll typically need to resize your image to be able to use it in an OpenGL app.
unsigned char * simage_read_image | ( | const char * | filename, |
int * | width, | ||
int * | height, | ||
int * | numcomponents ) |
Attempts to read filename, and return a pointer to the image data. NULL is returned if the image could not be loaded. The memory is allocated using malloc(), and it is the callers responsibility to free the memory (using free()) width and height contains the width and height of the image, and numcomponents is a number indicating the following:
1 : Grayscale image (GL_LUMINANCE) 2 : Grayscale with alpha channel (GL_LUMINANCE_ALPHA) 3 : RGB data (GL_RGB) 4 : RGB data with alpha component (GL_RGBA)
Returned image buffer must be freed by simage_free_image()
void simage_remove_loader | ( | void * | handle | ) |
void simage_version | ( | int * | major, |
int * | minor, | ||
int * | micro ) |
Note specifically for Microsoft Windows that by leaving out the APIENTRY keyword for the function definitions, we default to the __cdecl calling convention. This is important to take into consideration when explicitly linking to the library at runtime: when using the wrong calling convention, obscure errors due to stack corruption can occur under certain (possibly rare) conditions.
Returns runtime version for simage.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
char simage_error_msg[512+1] |
|
static |
|
static |