Coin3D is Free Software, published under the BSD 3-clause license. |
https://bitbucket.org/Coin3D/ http://www.kongsberg.com/kogt/ |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <config.h>
#include <simage.h>
#include <simage_private.h>
#include <string.h>
#include <simage_gdiplus.h>
#include <simage_tga.h>
#include <simage_pic.h>
#include <simage_rgb.h>
Data Structures | |
struct | _loader_data |
Macros | |
#define | SIMAGE_ERROR_BUFSIZE 512 |
Typedefs | |
typedef struct _loader_data | loader_data |
Functions | |
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 loader_data * | find_loader (const char *filename) |
static void | add_internal_loaders (void) |
unsigned char * | simage_read_image (const char *filename, int *width, int *height, int *numComponents) |
const char * | simage_get_last_error (void) |
void | simage_clear_error (void) |
int | simage_check_supported (const char *filename) |
void * | simage_add_loader (const struct simage_plugin *plugin, int addbefore) |
void | simage_remove_loader (void *handle) |
static int | cnt_bits (int val, int *highbit) |
int | simage_next_power_of_two (int val) |
void | simage_version (int *major, int *minor, int *micro) |
void | simage_free_image (unsigned char *imagedata) |
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, s_dlsym_func *dlsym, s_dlclose_func *dlclose) |
Variables | |
static loader_data | gdiplus_loader |
static loader_data | targa_loader |
static loader_data | pic_loader |
static loader_data | rgb_loader |
static loader_data * | first_loader = NULL |
static loader_data * | last_loader = NULL |
char | simage_error_msg [512+1] |
static s_dlopen_func * | dlopen = NULL |
static s_dlsym_func * | dlsym = NULL |
static s_dlclose_func * | dlclose = NULL |
#define SIMAGE_ERROR_BUFSIZE 512 |
typedef struct _loader_data loader_data |
|
static |
|
static |
|
static |
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()
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.
void simage_clear_error | ( | void | ) |
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_add_loader | ( | const struct simage_plugin * | plugin, |
int | addbefore | ||
) |
void simage_remove_loader | ( | void * | handle | ) |
|
static |
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.
void simage_version | ( | int * | major, |
int * | minor, | ||
int * | micro | ||
) |
Note specifically for MSWindows 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 run-time: when using the wrong calling convention, obscure errors due to stack corruption can occur under certain (possibly rare) conditions.
Returns run-time version for simage.
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)
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, |
s_dlsym_func * | dlsym, | ||
s_dlclose_func * | dlclose | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
char simage_error_msg[512+1] |
|
static |
|
static |
|
static |