class ffw::ImageWriter
Class List > ffw :: ImageWriter
Base class for all image writers. More...
Inherits the following classes: ffw::ImageFormat
Inherited by the following classes: ffw::BmpSaver, ffw::DdsSaver, ffw::JpgSaver, ffw::PbmSaver, ffw::PngSaver, ffw::TgaSaver, ffw::TifSaver
Protected Attributes
Type | Name |
---|---|
bool | loaded |
int | row |
int | mipmapOffset |
int | mipmaps |
Public Functions
Type | Name |
---|---|
ImageWriter () | |
virtual | ~ImageWriter () |
virtual void | close () = 0 |
virtual size_t | writeRow (const void * src) = 0 Writes a row of pixels. |
bool | writeAll (const unsigned char * src) Writes the entire image from a single array. |
bool | writeAll (const ffw::ImageBuffer & buffer) Writes the entire image from an image buffer. |
virtual bool | setMipMap (int level) |
virtual bool | writeFooter () = 0 Writes the footer. |
bool | eof () const Returns true if we are at the end of the file. |
operator bool () const Same as isOpen() | |
int | getRowOffset () const Returns the number of rows already written. |
bool | isOpen () const Returns true if the file is open and ready for writing. |
int | getNumOfMipMaps () const Returns the number of mipmaps the image contains. |
int | getMipMapOffset () const Returns the number of mipmaps already written. |
size_t | getAllocationSize () const Returns the number of bytes needed to allocate an array of pixels. |
Detailed Description
This is an abstract class. Please use one of the specific image writers, such as a PngWriter.
Protected Attributes Documentation
variable loaded
bool ffw::ImageWriter::loaded;
variable row
int ffw::ImageWriter::row;
variable mipmapOffset
int ffw::ImageWriter::mipmapOffset;
variable mipmaps
int ffw::ImageWriter::mipmaps;
Public Functions Documentation
function ImageWriter
ffw::ImageWriter::ImageWriter ()
function ~ImageWriter
virtual ffw::ImageWriter::~ImageWriter ()
function close
virtual void ffw::ImageWriter::close () = 0
function writeRow
virtual size_t ffw::ImageWriter::writeRow (
const void * src
) = 0
Writes a row of pixels.
Parameters:
- src Where to read pixels from
The src must contain an entire row of pixels. Use writer->getStrideSize() to determine the size of the row needed in number of bytes.
function writeAll (1/2)
bool ffw::ImageWriter::writeAll (
const unsigned char * src
)
Writes the entire image from a single array.
Parameters:
- src The destination where to read the pixels from
The src parameter must be large enough to contain all pixels. Use writer->getStrideSize() multiplied by writer->getHeight() to get the number of bytes needed for the source array.
Note:
This method also calls the writeFooter()
function writeAll (2/2)
bool ffw::ImageWriter::writeAll (
const ffw::ImageBuffer & buffer
)
Writes the entire image from an image buffer.
Note:
This method also calls the writeFooter()
function setMipMap
virtual bool ffw::ImageWriter::setMipMap (
int level
)
function writeFooter
virtual bool ffw::ImageWriter::writeFooter () = 0
Writes the footer.
Note:
This is needed to be called at the end of writing all pixels. Not doing so could lead to invalid image file.
function eof
bool ffw::ImageWriter::eof () const
Returns true if we are at the end of the file.
function operator bool
ffw::ImageWriter::operator bool () const
Same as isOpen()
function getRowOffset
int ffw::ImageWriter::getRowOffset () const
Returns the number of rows already written.
function isOpen
bool ffw::ImageWriter::isOpen () const
Returns true if the file is open and ready for writing.
function getNumOfMipMaps
int ffw::ImageWriter::getNumOfMipMaps () const
Returns the number of mipmaps the image contains.
This is usually exactly one unless you are writing a DDS file.
function getMipMapOffset
int ffw::ImageWriter::getMipMapOffset () const
Returns the number of mipmaps already written.
function getAllocationSize
size_t ffw::ImageWriter::getAllocationSize () const
Returns the number of bytes needed to allocate an array of pixels.
The documentation for this class was generated from the following file: include/ffw/media/imagesaver.h