#include <uimageio.hpp>
Inheritance diagram for ufo::UImageIO:
Public Types | |
typedef std::istream | IStream |
typedef std::ostream | OStream |
typedef unsigned char *(* | LoadFuncPointer )(UImageIO *imageIOA, IStream &streamA, std::string *commentA, int *widthA, int *heightA, int *componentsA) |
typedef bool(* | SaveFuncPointer )(UImageIO *imageIO, OStream &streamA) |
enum | FilterRule { NoFilterRule = 0, AlphaLayer = 1, ColorTypeRGB = 2, ColorTypeRGBA = ColorTypeRGB | AlphaLayer, ColorTypeGray = 4, ColorTypeGrayAlpha = ColorTypeGray | AlphaLayer, FlipX = 8, FlipY = 16 } |
Public Member Functions | |
UImageIO () | |
UImageIO (const std::string &fileNameA) | |
UImageIO (IStream &streamA, const std::string &extensionA) | |
UImageIO (unsigned char *dataA, int widthA, int heightA, int componentsA) | |
UImageIO (int widthA, int heightA, int componentsA) | |
unsigned char * | getPixels () |
int | getWidth () |
int | getHeight () |
const UDimension & | getSize () |
std::string | getComment () |
int | getImageComponents () |
bool | load (const std::string &fileNameA) |
bool | loadFromArchive (const std::string &fileNameA) |
bool | load (UImageIO::IStream &streamA, const std::string &extensionA) |
bool | save (const std::string &fileNameA) |
bool | save (UImageIO::OStream &streamA, const std::string &extensionA) |
Static Public Member Functions | |
std::vector< std::string > | getAvailableLoadingExtensions () |
UImageIO::LoadFuncPointer | registerLoader (UImageIO::LoadFuncPointer loaderA, const std::string &extensionA) |
void | unregisterLoader (UImageIO::LoadFuncPointer saverA, const std::string &extensionA) |
std::vector< std::string > | getAvailableSavingExtensions () |
UImageIO::SaveFuncPointer | registerSaver (UImageIO::SaveFuncPointer saverA, const std::string &extensionA) |
void | unregisterSaver (UImageIO::SaveFuncPointer saverA, const std::string &extensionA) |
void | init () |
Static Public Attributes | |
const int | ALPHA_LAYER |
const int | COLOR_TYPE_RGB |
const int | COLOR_TYPE_RGB_ALPHA |
const int | COLOR_TYPE_GRAY |
const int | COLOR_TYPE_GRAY_ALPHA |
const int | FLIP_X |
const int | FLIP_Y |
Protected Member Functions | |
virtual std::ostream & | paramString (std::ostream &os) const |
It loads given images from files of streams. The loaded pixels will be freed when the image is destroyed. Currently, only pnm and tga files are supported. But you can add you own image load and save functions by registering them with registerLoader
resp. registerSaver
|
Filter rules. Used at loading time. |
|
Creates an empty image io object. |
|
Creates an image io object and tries to load an image from the given file name.
|
|
|
|
Creates a UImageIO object with already decoded image data. |
|
Creates an empty UImageIO object. The image data may be manipulated via getPixels(). |
|
Returns the possible extensions (and file formats) which can be decoded by UImageIO |
|
Returns the possible extensions (and file formats) which can be decoded by UImageIO |
|
the comments is either a file comment or the file name itsself |
|
Returns the bytes used for the given image.
|
|
returns the raw pixels with one of these layouts:
|
|
Initializes UImageIO. This means, registering png and bmp support. You must call this function just once. |
|
|
|
Loads the given image file
|
|
Searches the file archive for a file with the given file name and uses an appropriate image plugin for loading.
|
|
Prints some useful internal data to the ostream os. This method is meant only for debugging purposes. Reimplemented from ufo::UObject.
|
|
Registers a new image loader function and returns the old registered image loader (or NULL). You can pass a NULL pointer as image saving functions to get the current image saving functions for the given extension.
|
|
Registers a new image saving function and returns the old registered image saver (or NULL). You can pass a NULL pointer as image saving functions to get the current image saving functions for the given extension.
|
|
|
|
Saves to currently loaded byte array to the given image. The file name must have an extension returned by
|
|
Unregisters an image loader. This method checks whether the current image load functions matches the given one (on the same extension) and removes it. |
|
Unregisters an image saver. This method checks whether the current image save functions matches the given one (on the same extension) and removes it. |
|
gray alpha is equal COLOR_TYPE_GRAY | ALPHA_LAYER |
|
rgba is equal COLOR_TYPE_RGB | ALPHA_LAYER |