LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::loadPNG Class Reference

Functor to read a Portable Network Graphic (PNG) file. More...

#include <ltiPNGFunctor.h>

Inheritance diagram for lti::loadPNG:
Inheritance graph
[legend]
Collaboration diagram for lti::loadPNG:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 loadPNG ()
 ~loadPNG ()
virtual const char * getTypeName () const
bool apply (image &theImage)
bool apply (channel8 &theChannel, lti::palette &colors)
bool load (const std::string &filename, image &theImage)
bool load (std::ifstream &file, image &theImage)
bool load (const std::string &filename, channel8 &theImage, lti::palette &colors)
virtual functorclone () const
bool checkHeader (const std::string &filename, point &imageSize, int &bitsPerPixel, int &imageType)

Detailed Description

Functor to read a Portable Network Graphic (PNG) file.

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!

Example:

 lti::image anImg;                      // an image
 ...
 lti::loadPNG myImg;                    // the load functor
 lti::loadPNG::parameters param;        // functor parameters
 param.filename = "~/tmp/theFile.png";  // name of the PNG file
 myImg.setParameters(param);            // set the functor parameters
 myImg.apply(anImg);                    // load the file

You can also use the more confortable shortcut:

 lti::image anImg;                      // an image
 ...
 lti::loadPNG loadImg;                  // the load functor
 loadImg.load("~/tmp/theFile.png",img); // load the image.
Exceptions:
BadPngStream is thrown when the Stream is corrupted.
See also:
savePNG
image
loadPNG::parameters

For more information on implementation issues see ioPNG


Constructor & Destructor Documentation

lti::loadPNG::loadPNG (  ) 

default constructor

lti::loadPNG::~loadPNG (  ) 

destructor


Member Function Documentation

bool lti::loadPNG::apply ( channel8 theChannel,
lti::palette colors 
) [virtual]

load Image.

Exceptions:
BadPngStream is thrown when the Stream is corrupted.

Reimplemented from lti::ioFunctor.

bool lti::loadPNG::apply ( image theImage  )  [virtual]

load Image.

Exceptions:
BadPngStream is thrown when the Stream is corrupted.

Reimplemented from lti::ioFunctor.

bool lti::loadPNG::checkHeader ( const std::string &  filename,
point imageSize,
int &  bitsPerPixel,
int &  imageType 
)

check the data of the PNG header

Parameters:
filename name of the PNG file to be tested
imageSize returns the size of the PNG: imageSize.x is the number of columns and imageSize.y the numbeer of rows.
bitsPerPixel number of bits per pixel
imageType For color types 0 (gray) and 4 (gray-alpha), the mappings apply to the gray sample values (but not to the alpha sample). For color types 2 (RGB), 3 (indexed RGB), and 6 (RGBA), the mappings apply independently to each of the red, green, and blue sample values (but not the alpha sample). In the case of color type 3 (indexed RGB), the mapping refers to the RGB samples and not to the index values.
Returns:
true if file is ok
virtual functor* lti::loadPNG::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements lti::functor.

virtual const char* lti::loadPNG::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::ioPNG.

bool lti::loadPNG::load ( const std::string &  filename,
channel8 theImage,
lti::palette colors 
) [virtual]

shortcut for load PNG

Reimplemented from lti::ioFunctor.

bool lti::loadPNG::load ( std::ifstream &  file,
image theImage 
)

method for loading a PNG image from an already opened stream.

bool lti::loadPNG::load ( const std::string &  filename,
image theImage 
) [virtual]

shortcut for load PNG

Reimplemented from lti::ioFunctor.


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:06 2010 for LTI-Lib by Doxygen 1.6.1