last update 20 Sep 2009 |
#include <cvrIOPNG.h>
Classes | |
class | parameters |
Parameter class of the ioBMP class. More... | |
Public Member Functions | |
ioPNG () | |
ioPNG (const parameters &par) | |
ioPNG (const ioPNG &other) | |
virtual | ~ioPNG () |
const parameters & | getParameters () const |
virtual const std::string & | name () const |
virtual ioPNG * | clone () const |
virtual ioPNG * | newInstance () const |
virtual bool | load (const std::string &filename, image &theImage) |
virtual bool | load (const std::string &filename, matrix< ubyte > &theImage, palette &colors) |
virtual bool | load (const std::string &filename, matrix< ubyte > &chnl) |
virtual bool | load (const std::string &filename, matrix< float > &chnl) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl, palette &pal) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl) |
virtual bool | checkHeader (const std::string &filename, headerInformation &info) |
bool | save (const std::string &filename, const image &theImage) |
bool | save (const std::string &filename, const matrix< ubyte > &theChannel, const cvr::palette &colors) |
bool | save (const std::string &filename, const matrix< ubyte > &theChannel) |
virtual bool | save (const std::string &filename, const matrix< float > &chnl) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl, const palette &pal) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl) |
It is NOT thread save, this means, the SAME instance can not be used from different threads or processes at the same time. If this occurs an unpredictible behaviour must be expected!. If this is required, just use a different instance of the functor for each thread, or use mutexes to avoid parallel accesses.
There are two implementations of this functor.
We recomend to use the libpng, it is more robust against not 100% correct PNG-files, and it is faster. Mianos' implementation is mainly for windows users that do not want to install the pnglib.
Example:
cvr::image anImg; // an image cvr::ioPNG loader; // the load functor loader.load("~/tmp/theFile.png",img); // load the image.
Example:
cvr::image anImg; // an image ... [ initialize you image data here ] cvr::ioPNG saveImg; // the save functor saveImg.save("~/tmp/theFile.png",img); // save the image.
BadPngStream | is thrown when the Stream is corrupted. |
cvr::ioPNG::ioPNG | ( | ) |
Default constructor.
cvr::ioPNG::ioPNG | ( | const parameters & | par | ) |
Constructor with parameters.
cvr::ioPNG::ioPNG | ( | const ioPNG & | other | ) |
Copy constructor.
virtual cvr::ioPNG::~ioPNG | ( | ) | [virtual] |
Destructor.
virtual bool cvr::ioPNG::checkHeader | ( | const std::string & | filename, | |
headerInformation & | info | |||
) | [virtual] |
Check the data of the PNG header.
filename | name of the PNG file to be tested | |
info | header information. |
Implements cvr::ioImageInterface.
virtual ioPNG* cvr::ioPNG::clone | ( | ) | const [virtual] |
const parameters& cvr::ioPNG::getParameters | ( | ) | const |
Load the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioPNG::load | ( | const std::string & | filename, | |
matrix< int32 > & | chnl, | |||
palette & | pal | |||
) | [virtual] |
Load the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioPNG::load | ( | const std::string & | filename, | |
matrix< float > & | chnl | |||
) | [virtual] |
Load a floating point channel.
Not many file formats support floating point channels, so the default implementation just casts a channel8 into the float.
Reimplemented from cvr::ioImageInterface.
Load the contents as a gray channel.
Default implementation just discards the palette of load(const std::string&,matrix<ubyte>&,palette&)
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioPNG::load | ( | const std::string & | filename, | |
image & | theImage | |||
) | [virtual] |
virtual const std::string& cvr::ioPNG::name | ( | ) | const [virtual] |
virtual ioPNG* cvr::ioPNG::newInstance | ( | ) | const [virtual] |
virtual bool cvr::ioPNG::save | ( | const std::string & | filename, | |
const matrix< int32 > & | chnl | |||
) | [virtual] |
Save the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioPNG::save | ( | const std::string & | filename, | |
const matrix< int32 > & | chnl, | |||
const palette & | pal | |||
) | [virtual] |
Save the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioPNG::save | ( | const std::string & | filename, | |
const matrix< float > & | chnl | |||
) | [virtual] |
bool cvr::ioPNG::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | theChannel, | |||
const cvr::palette & | colors | |||
) | [virtual] |
Save an "indexed" image contained in the given channel8 (indices) and the given color palette.
Implements cvr::ioImageInterface.
bool cvr::ioPNG::save | ( | const std::string & | filename, | |
const image & | theImage | |||
) | [virtual] |