GATE
Loading...
Searching...
No Matches
imageformats.h File Reference

Generic image file format loading and saving utilities. More...

Macros

#define GATE_IMAGEFORMAT_UNKNOWN   0
 
#define GATE_IMAGEFORMAT_BITMAP   1
 
#define GATE_IMAGEFORMAT_PIXMAP   2
 
#define GATE_IMAGEFORMAT_JPEG   3
 
#define GATE_IMAGEFORMAT_PNG   4
 
#define GATE_IMAGEFORMAT_GIF   5
 

Functions

GATE_GRAPHICS_API gate_enumint_t gate_imageformat_parse_file_extension (gate_string_t const *file_ext)
 Checks the filename extension and returns a matching file format identifier.
 
GATE_GRAPHICS_API char const * gate_imageformat_get_file_extension (gate_enumint_t image_format)
 Returns the default file extension of the given image file format.
 
GATE_GRAPHICS_API gate_result_t gate_imageformat_load (gate_enumint_t image_format, gate_stream_t *srcstream, gate_rasterimage_t *image, gate_enumint_t flags)
 Loads the specific image format from a byte stream and creates a rasterimage.
 
GATE_GRAPHICS_API gate_result_t gate_imageformat_save (gate_enumint_t image_format, gate_rasterimage_t const *image, gate_stream_t *deststream, gate_enumint_t flags)
 Saves a rasterimage in the specified format into an output stream.
 
GATE_GRAPHICS_API gate_result_t gate_imageformat_load_file (gate_string_t const *file_path, gate_rasterimage_t *image, gate_enumint_t flags)
 Loads an image file and initializes a rasterimage.
 
GATE_GRAPHICS_API gate_result_t gate_imageformat_save_file (gate_string_t const *file_path, gate_rasterimage_t const *image, gate_enumint_t flags)
 Save a rasterimage to a file.
 

Detailed Description

Generic image file format loading and saving utilities.

Macro Definition Documentation

◆ GATE_IMAGEFORMAT_UNKNOWN

#define GATE_IMAGEFORMAT_UNKNOWN   0

Unknown image file format

◆ GATE_IMAGEFORMAT_BITMAP

#define GATE_IMAGEFORMAT_BITMAP   1

Windows Bitmap BMP image file format

◆ GATE_IMAGEFORMAT_PIXMAP

#define GATE_IMAGEFORMAT_PIXMAP   2

X11 Pixmap XPM image file format

◆ GATE_IMAGEFORMAT_JPEG

#define GATE_IMAGEFORMAT_JPEG   3

JPEG JPG image file format

◆ GATE_IMAGEFORMAT_PNG

#define GATE_IMAGEFORMAT_PNG   4

PNG image file format

◆ GATE_IMAGEFORMAT_GIF

#define GATE_IMAGEFORMAT_GIF   5

GIF image file format

Function Documentation

◆ gate_imageformat_parse_file_extension()

GATE_GRAPHICS_API gate_enumint_t gate_imageformat_parse_file_extension ( gate_string_t const * file_ext)

Checks the filename extension and returns a matching file format identifier.

Parameters
[in]file_extstring with path, filename or '.EXT' extension-token of image file
Returns
GATE_IMAGEFORMAT_* format identifier

◆ gate_imageformat_get_file_extension()

GATE_GRAPHICS_API char const * gate_imageformat_get_file_extension ( gate_enumint_t image_format)

Returns the default file extension of the given image file format.

Parameters
[in]image_formatGATE_IMAGEFORMAT_* file format identifier
Returns
static string token with file extension

◆ gate_imageformat_load()

GATE_GRAPHICS_API gate_result_t gate_imageformat_load ( gate_enumint_t image_format,
gate_stream_t * srcstream,
gate_rasterimage_t * image,
gate_enumint_t flags )

Loads the specific image format from a byte stream and creates a rasterimage.

Parameters
[in]image_formatGATE_IMAGEFORMAT_* image format identifier
[in]srcstreaminput stream containing image date
[out]imagepointer to rasterimage to be initialized
[in]flagsimage-format specific loader-flags (0: default-loader)
Returns
GATE_RESULT_* result code

◆ gate_imageformat_save()

GATE_GRAPHICS_API gate_result_t gate_imageformat_save ( gate_enumint_t image_format,
gate_rasterimage_t const * image,
gate_stream_t * deststream,
gate_enumint_t flags )

Saves a rasterimage in the specified format into an output stream.

Parameters
[in]image_formatGATE_IMAGEFORMAT_* image format identifier
[in]imagepointer to rasterimage to be saved
[out]deststreamoutput stream that receives formated image data
[in]flagsimage-format specific writer-flags (0: default-writer)
Returns
GATE_RESULT_* result code

◆ gate_imageformat_load_file()

GATE_GRAPHICS_API gate_result_t gate_imageformat_load_file ( gate_string_t const * file_path,
gate_rasterimage_t * image,
gate_enumint_t flags )

Loads an image file and initializes a rasterimage.

Parameters
[in]file_pathstring with input image file path
[out]imagepointer to rasterimage to be loaded
[in]flagsimage-format specific loader-flags (0: default-loader)
Returns
GATE_RESULT_* result code

◆ gate_imageformat_save_file()

GATE_GRAPHICS_API gate_result_t gate_imageformat_save_file ( gate_string_t const * file_path,
gate_rasterimage_t const * image,
gate_enumint_t flags )

Save a rasterimage to a file.

Parameters
[in]file_pathstring with output image file path
[in]imagepointer to rasterimage thats data is saved
[in]flagsimage-format specific writer-flags (0: default-writer)
Returns
GATE_RESULT_* result code