![]() |
![]() |
![]() |
HOME | DOWNLOAD | DOCS | DEVELOPMENT | LICENSE | CREDITS |
Master image class. More...
#include <iImage.h>
Public Member Functions | |
iImage () | |
Constructs a null image. | |
iImage (const iImage &img) | |
Copy constructor. | |
iImage (const iAbstractImage &img) | |
iAbstractImage copy constructor. | |
iImage (int w, int h, iImageFormat f) | |
Constructs an image with the given size and format. | |
iImage (Iubyte *d, int w, int h, iImageFormat f, int b) | |
Constructs an image using an existing memory buffer. | |
iImage (const char *filename) | |
Loads an image file from disk. | |
iImage (const char *filename, iImageType tp) | |
Loads an image file of the given type from disk. | |
iImage (Iubyte *buf, int len) | |
Loads an image from an existing memory buffer. | |
iImage (Iubyte *buf, int len, iImageType tp) | |
Loads an image of the given type from an existing memory buffer. | |
iImage (iDataStream *s) | |
Loads an image using an existing data stream. | |
iImage (iDataStream *s, iImageType tp) | |
Loads an image of the given type using an existing data stream. | |
~iImage () | |
Destructor. | |
bool | load (const char *filename) |
Loads an image file from disk. | |
bool | load (const char *filename, iImageType tp) |
Loads an image file with the given type from disk. | |
bool | load (Iubyte *buf, int len) |
Loads an image from an existing memory buffer. | |
bool | load (Iubyte *buf, int len, iImageType tp) |
Loads an image with the given type from an existing memory buffer. | |
bool | load (iDataStream *s) |
Loads an image using an existing data stream. | |
bool | load (iDataStream *s, iImageType tp) |
Loads an image using an existing data stream. | |
bool | save (const char *filename) |
Writes an image file to disk. | |
bool | save (const char *filename, iImageType tp) |
Writes an image file with the given type to disk. | |
bool | save (Iubyte *buf, int len) |
Writes an image to an existing memory buffer. | |
bool | save (Iubyte *buf, int len, iImageType tp) |
Writes an image with the given type to an existing memory buffer. | |
bool | save (iDataStream *s) |
Writes an image using an existing data stream. | |
bool | save (iDataStream *s, iImageType tp) |
Writes an image with the given type using an existing data stream. | |
void | clear () |
Detaches this image from the image data and resets all data members to their initial values. | |
bool | isFormatSupported (iImageFormat fmt) const |
Checks whether or not a given image color format is supported by this image type. | |
iImage & | operator= (const iAbstractImage &img) |
Protected Member Functions | |
void | init () |
bool | loadImage () |
bool | saveImage () |
Master image class.
iImage is capable of reading and writing all supported image types, and is most likely the class you will want to use in most cases.
The only shortcoming is that it can't offer any services specific to any particular image file format; if you need to manipulate data specific to a particular image file format, you should create an instance of class iTGA or iPNG, for example.
The standard load() and save() functions have been overloaded specifically for this class, and they behave a little differently than the way the other image classes use them:
Constructs a null image.
imagen::iImage::iImage | ( | const iImage & | img | ) |
Copy constructor.
This copies all image attributes, and attaches itself to img's shared data.
imagen::iImage::iImage | ( | const iAbstractImage & | img | ) |
iAbstractImage copy constructor.
imagen::iImage::iImage | ( | int | w, |
int | h, | ||
iImageFormat | f | ||
) |
Constructs an image with the given size and format.
The image data will be allocated, but not initialized.
w | : Image width. |
h | : Image height. |
f | : Image format. |
imagen::iImage::iImage | ( | Iubyte * | d, |
int | w, | ||
int | h, | ||
iImageFormat | f, | ||
int | b | ||
) |
Constructs an image using an existing memory buffer.
The memory buffer will not be deleted at destruction.
imagen::iImage::iImage | ( | const char * | filename | ) |
Loads an image file from disk.
imagen::iImage::iImage | ( | const char * | filename, |
iImageType | tp | ||
) |
Loads an image file of the given type from disk.
imagen::iImage::iImage | ( | Iubyte * | buf, |
int | len | ||
) |
Loads an image from an existing memory buffer.
imagen::iImage::iImage | ( | Iubyte * | buf, |
int | len, | ||
iImageType | tp | ||
) |
Loads an image of the given type from an existing memory buffer.
Loads an image using an existing data stream.
imagen::iImage::iImage | ( | iDataStream * | s, |
iImageType | tp | ||
) |
Loads an image of the given type using an existing data stream.
Destructor.
bool imagen::iImage::load | ( | const char * | filename | ) |
Loads an image file from disk.
An image reader will be chosen based on the extension given in filename.
For example, in "mygraphic.png", the extension is "png", which means the image type is iTypePNG, so an iPNG reader will be used.
filename | : The name of the image to load. |
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::load | ( | const char * | filename, |
iImageType | tp | ||
) |
Loads an image file with the given type from disk.
Just because image loading doesn't work, doesn't mean there's something wrong with the image; you may be trying to load it with the wrong type.
If you want the image type to be automatically determined based on the extension in filename, use load( const char *filename ).
filename | : The name of the image to load. |
tp | : Image type of the image to be read. |
bool imagen::iImage::load | ( | Iubyte * | buf, |
int | len | ||
) |
Loads an image from an existing memory buffer.
This function will attempt to read the image by arbitrarily calling the function isValid() for each supported image type. If the image type is recognizable, it will be loaded with the appropriate image reader.
buf | : Pointer to a memory buffer. |
len | : Size of the memory buffer. |
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::load | ( | Iubyte * | buf, |
int | len, | ||
iImageType | tp | ||
) |
Loads an image with the given type from an existing memory buffer.
This function won't attempt to identify the image type. It will load the buffer as the image type you specify, and give up if unsuccessful.
buf | : Pointer to a memory buffer. |
len | : Size of the memory buffer. |
tp | : Image type of the image to be read. |
bool imagen::iImage::load | ( | iDataStream * | s | ) |
Loads an image using an existing data stream.
This function will not open nor close the stream. It is the user's responsibility to make sure the stream is properly opened and closed.
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::load | ( | iDataStream * | s, |
iImageType | tp | ||
) |
Loads an image using an existing data stream.
This function will not open nor close the stream. It is the user's responsibility to make sure the stream is properly opened and closed.
bool imagen::iImage::save | ( | const char * | filename | ) |
Writes an image file to disk.
An image writer will be chosen based on the extension given in filename.
For example, in "mygraphic.tga", the extension is "tga", which means the image type is iTypeTGA, so an iTGA writer will be used.
filename | : The name to save the image as. |
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::save | ( | const char * | filename, |
iImageType | tp | ||
) |
Writes an image file with the given type to disk.
filename | : The name to save the image as. |
tp | : Image type to save the image as. |
bool imagen::iImage::save | ( | Iubyte * | buf, |
int | len | ||
) |
Writes an image to an existing memory buffer.
In this function, there is no way to determine what image type the user wants to save the image as. To avoid ambiguity, this function does nothing.
Use save( Iubyte *buf, int len, iImageType tp ) instead.
buf | : Pointer to a memory buffer. |
len | : Size of the memory buffer. |
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::save | ( | Iubyte * | buf, |
int | len, | ||
iImageType | tp | ||
) |
Writes an image with the given type to an existing memory buffer.
buf | : Pointer to a memory buffer. |
len | : Size of the memory buffer. |
tp | : Image type to save the image as. |
bool imagen::iImage::save | ( | iDataStream * | s | ) |
Writes an image using an existing data stream.
This function will not open nor close the stream. It is the user's responsibility to make sure the stream is properly opened and closed.
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::save | ( | iDataStream * | s, |
iImageType | tp | ||
) |
Writes an image with the given type using an existing data stream.
This function will not open nor close the stream. It is the user's responsibility to make sure the stream is properly opened and closed.
void imagen::iImage::clear | ( | ) | [virtual] |
Detaches this image from the image data and resets all data members to their initial values.
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::isFormatSupported | ( | iImageFormat | fmt | ) | const [inline, virtual] |
Checks whether or not a given image color format is supported by this image type.
Implements imagen::iAbstractImage.
iImage& imagen::iImage::operator= | ( | const iAbstractImage & | img | ) |
Reimplemented from imagen::iAbstractImage.
void imagen::iImage::init | ( | ) | [protected] |
Reimplemented from imagen::iAbstractImage.
bool imagen::iImage::loadImage | ( | ) | [protected, virtual] |
Implements imagen::iAbstractImage.
bool imagen::iImage::saveImage | ( | ) | [protected, virtual] |
Implements imagen::iAbstractImage.
![]() |
Generated by
![]() |