|
latest version v1.9 - last update 10 Apr 2010 |
|
Functor to save a bitmap (BMP) file. More...
#include <ltiBMPFunctor.h>


Public Member Functions | |
| saveBMP () | |
| ~saveBMP () | |
| virtual const char * | getTypeName () const |
| bool | apply (const image &theImage) |
| bool | apply (const channel &theChannel) |
| bool | apply (const channel8 &theChannel, const lti::palette &colors=emptyPalette) |
| bool | save (const std::string &filename, const image &theImage) |
| bool | save (const std::string &filename, const channel8 &theChannel, const lti::palette &colors=emptyPalette) |
| bool | save (const std::string &filename, const channel &theChannel, const lti::palette &colors=emptyPalette) |
| virtual functor * | clone () const |
Functor to save a bitmap (BMP) file.
To save a BMP image just initialize the parameters of the "%saveBMP" object and call the apply member, or use one of the shortcuts.
Example:
lti::image anImg; // an image lti::channel8 aChnl; // an 8-bit Channel ... lti::saveBMP saveImg; // the save functor // save the image as a 24 bit bitmap file: saveImg.save("/tmp/theFile.bmp",anImg); // save the channel as a 8 bit bitmap file: saveImg.save("/the/theChnl8.bmp",aChnl); // save the channel as a 24 bit bitmap file: lti::saveBMP::parameters param; // functor parameters param.filename = "~/tmp/theChnl24.bmp"; // name of the BMP file param.bitsPerPixel = 24; // use 24 bits! saveImg.setParameters(param); // set the functor parameters saveImg.apply(aChnl); // save the channel
| lti::saveBMP::saveBMP | ( | ) |
default constructor
| lti::saveBMP::~saveBMP | ( | ) | [inline] |
destructor
| bool lti::saveBMP::apply | ( | const channel8 & | theChannel, | |
| const lti::palette & | colors = emptyPalette | |||
| ) | [virtual] |
save 8-bit channel as a bitmap.
| theChannel | the channel to be saved | |
| colors | if a color palette is given, theChannel will be considered to contain indices to this palette. If nothing (or an empty palette) is given, theChannel will be considered as a gray valued channel. See ioBMP::parameters for more options |
Reimplemented from lti::ioFunctor.
| bool lti::saveBMP::apply | ( | const channel & | theChannel | ) | [virtual] |
save float channel
| theChannel | channel to be stored. This channel must contain values between 0.0f and 1.0f. |
Reimplemented from lti::ioFunctor.
| bool lti::saveBMP::apply | ( | const image & | theImage | ) | [virtual] |
save image as BMP.
Note that if the parameters contain a number of bits per pixels less than 24 (this means 8, 4 or 1)(see lti::ioBMP::parameters), this method will apply a quantization algorithm, which will reduce the number of used colors as requested. This is very time consuming! For 24 images this method is relativly fast.
For a faster 8-bit BMP use the method apply(const channel8&,const lti::palette).
| theImage | the image to be stored. |
Reimplemented from lti::ioFunctor.
| virtual functor* lti::saveBMP::clone | ( | ) | const [virtual] |
returns a pointer to a clone of the functor.
Implements lti::functor.
| virtual const char* lti::saveBMP::getTypeName | ( | ) | const [virtual] |
returns the name of this type
Reimplemented from lti::ioBMP.
| bool lti::saveBMP::save | ( | const std::string & | filename, | |
| const channel & | theChannel, | |||
| const lti::palette & | colors = emptyPalette | |||
| ) |
| bool lti::saveBMP::save | ( | const std::string & | filename, | |
| const channel8 & | theChannel, | |||
| const lti::palette & | colors = emptyPalette | |||
| ) | [virtual] |
this will save a channel8 as an 8 bit RGB bitmap image
| filename | name of the destination file | |
| theChannel | the channel to be save | |
| colors | the palette to be used (see apply(const channel& theChannel) for details) |
Reimplemented from lti::ioFunctor.
| bool lti::saveBMP::save | ( | const std::string & | filename, | |
| const image & | theImage | |||
| ) | [virtual] |
this will save an image as a 24 bit RGB bitmap image
Reimplemented from lti::ioFunctor.