#include <nglImage.h>
Inheritance diagram for nglImage:

A nglImage object is a container for image buffer data (using various pixel formats), and also provides a plugin framework (the nglImageCodec codecs) to import from and export to various file formats. Codecs can load data from a stream, making progressive image loading possible. NGL is compiled with classic codecs (PNG, JPEG, TGA) as a default, but you can choose to load them at run time, add your own codec, and so on.
Public Member Functions | |
Life cycle | |
| nglImage (nglIStream *pInput, nglImageCodec *pCodec=NULL) | |
| nglImage (const nglPath &rPath, nglImageCodec *pCodec=NULL) | |
| nglImage (nglImageInfo &rInfo, bool Clone=true) | |
| nglImage (const nglImage &rImage) | |
| virtual | ~nglImage () |
Image description (info & data) | |
| bool | GetInfo (nglImageInfo &rInfo) const |
| nglImageBufferFormat | GetBufferFormat () const |
| nglImagePixelFormat | GetPixelFormat () const |
| uint | GetWidth () const |
| uint | GetHeight () const |
| uint | GetBitDepth () const |
| uint | GetPixelSize () const |
| uint | GetBytesPerLine () const |
| char * | GetBuffer () const |
| nglImageCodec * | GetCodec () const |
Export (save) | |
| bool | Save (nglOStream *pOutput, nglImageCodec *pCodec) |
| bool | Save (const nglPath &rPath, nglImageCodec *pCodec) |
User callbacks | |
| virtual void | OnInfo (nglImageInfo &rInfo) |
| virtual void | OnData (float Completion) |
| virtual bool | OnError () |
Static Public Member Functions | |
Global codec registry | |
| static bool | AddCodec (nglImageCodecInfo *pCodecInfo) |
| static bool | DelCodec (nglImageCodecInfo *pCodecInfo) |
| static nglImageCodec * | CreateCodec (int Index) |
| static nglImageCodec * | CreateCodec (const nglString &rName) |
Protected Member Functions | |
| void | OnCodecInfo (nglImageInfo &rInfo) |
| void | OnCodecData (float Completion) |
| bool | OnCodecError () |
| virtual const nglChar * | OnError (uint &rError) const |
Static Protected Member Functions | |
| static void | Init () |
| static void | Exit () |
Protected Attributes | |
| nglImageInfo | mInfo |
| nglImageCodec * | mpCodec |
| bool | mOwnCodec |
| float | mCompletion |
Friends | |
| class | nglImageCodec |
|
||||||||||||
|
Create an image from a stream
If pCodec is a valid codec instance, it won't be managed, ie. it won't be destroy along the destruction of the nglImage object. When a matching codec is found, as soon as the header information is parsed, the OnInfo() callback will be invoked with valid data (image size, pixel format, etc). Then, OnData() and OnError() will be called respectively when more data was decoded or an error occured (interrupted stream or codec complaint for instance). |
|
||||||||||||
|
Create an image from a file
If pCodec is a valid codec instance, it won't be managed, ie. it won't be destroy along the destruction of the nglImage object. To provide a compatible behaviour with the streaming constructor of nglImage, OnInfo() and OnData() callbacks will be called (once, in this order). OnError() might be invoked as well if an error occurs. |
|
||||||||||||
|
Create an image from a user given description
If Clone is true, nglImage makes a copy of rInfo.mpBuffer image data and owns it (ie. release this data memory when the nglImage object is destroyed). If Clone is false, nglImage only copies the rInfo.mpBuffer reference, and do not manage this memory (ie. it won't be released when the nglImage object is destroyed). |
|
|
Create an image copy from another image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pixel bit depth (sum of pixel components bit count). Returns 0 if the info is not available.
|
|
|
Image buffer data. Returns NULL if the info is not available.
|
|
|
Internal buffer format. Returns eImageFormatNone if the info is not available.
|
|
|
Pixel row allocation size in bytes (>= pixel size * image width). Returns 0 if the info is not available.
|
|
|
Fetch current codec
|
|
|
Image height in pixels. Returns 0 if the info is not available.
|
|
|
Fetch image description
|
|
|
Internal pixel format. Returns eImagePixelNone if the info is not available.
|
|
|
Pixel allocation size in bytes (>= pixel bit depth). Returns 0 if the info is not available.
|
|
|
Image width in pixels. Returns 0 if the info is not available.
|
|
|
|
|
|
The codec invoke this method whenever more data has been decoded to image buffer.
|
|
|
The codec invoke this method when an error occurs while encoding/decoding.
|
|
|
The codec invoke this method as soon as all the image metadata is available.
|
|
|
More data decoded
|
|
|
const nglChar** ChildErrorTable = {_T("no error"), _T("Bad luck"), NULL}; const nglChar* Child::OnError (uint& rError) const { return FetchError(ChildErrorTable, Parent::OnError(rError), rError); } Implements nglError. |
|
|
|
|
|
Image description available
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
In between 0.0 and 1.0.
|
|
|
The image info.
|
|
|
false if the codec is supplied by user
|
|
|
The codec currently in use to load or save the image.
|
1.4.1