OSDL::Video::TwoDimensional::Image Class Reference

Provides an encapsulation for any picture instance that can be loaded as resource. More...

#include <OSDLImage.h>

Collaboration diagram for OSDL::Video::TwoDimensional::Image:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Image (const std::string &imageFilename, bool preload=true, bool convertToDisplayFormat=true, bool convertWithAlpha=true)
 This Image constructor uses given filename to load the picture from the corresponding file.
virtual ~Image () throw ()
 Basic overridable destructor, so that it remains virtual.
virtual bool load ()
 Loads the image from file.
virtual bool unload ()
 Unloads the image that may be contained by this instance.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static SurfaceLoadIcon (const std::string &filename, Pixels::ColorElement **mask)
 Loads specified icon, and returns the corresponding surface, while updating specified mask so that it selects only icon pixels that should remain visible.
static void Load (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads an image, whose format will be auto-detected, from specified file into target surface.
static void LoadJPG (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a JPEG image from specified file into target surface.
static void LoadPNG (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a PNG image from specified file into target surface.
static void LoadBMP (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a BMP image from specified file into target surface.
static void LoadGIF (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a GIF image from specified file into target surface.
static void LoadLBM (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a LBM image from specified file into target surface.
static void LoadPCX (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a PCX image from specified file into target surface.
static void LoadPNM (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a PNM image from specified file into target surface.
static void LoadTGA (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a TGA image from specified file into target surface.
static void LoadXPM (Surface &targetSurface, const std::string &filename, bool blitOnly=false, bool convertToDisplay=true, bool convertWithAlpha=true)
 Loads a XPM image from specified file into target surface.
static void SavePNG (Surface &targetSurface, const std::string &filename, bool overwrite=true)
 Saves specified surface on file, with specified filename, in PNG format.
static void SaveBMP (Surface &targetSurface, const std::string &filename, bool overwrite=true)
 Saves specified surface on file, with specified filename, in BMP format.

Protected Attributes

bool _convertToDisplayFormat
 Tells whether when loaded this image should be converted to screen format.
bool _convertWithAlpha
 Tells whether when loaded this image should have an alpha channel when converted to screen format.

Private Member Functions

 Image (const Image &source)
 Copy constructor made private to ensure that it will never be called.
Imageoperator= (const Image &source)
 Assignment operator made private to ensure that it will never be called.

Static Private Attributes

static const std::string JPGTag = "JPG"
 Tag for JPG images, one of the recommended formats.
static const std::string PNGTag = "PNG"
 Tag for PNG images, one of the recommended formats.
static const std::string BMPTag = "BMP"
 Tag for BMP images, a supported but not recommended format.
static const std::string GIFTag = "GIF"
 Tag for GIF images, a supported but not recommended format.
static const std::string LBMTag = "LBM"
 Tag for LBM images, a supported but not recommended format.
static const std::string PCXTag = "PCX"
 Tag for PCX images, a supported but not recommended format.
static const std::string PNMTag = "PNM"
 Tag for PNM images, a supported but not recommended format.
static const std::string TGATag = "TGA"
 Tag for TGA images, a supported but not recommended format.
static const std::string XPMTag = "XPM"
 Tag for XPM images, a supported but not recommended format.

Detailed Description

Provides an encapsulation for any picture instance that can be loaded as resource.

The Image interface provides also a set of related functions (static methods), including factories.

See also:
Surface::LoadImage

Supported images formats are:

Our belief is however that the fewer formats you use, the simpler it will be for everyone.

We therefore recommend using two of them, which moreover are patent-less standards and should cover most if not all needs:

Definition at line 121 of file OSDLImage.h.


Constructor & Destructor Documentation

Image::Image ( const std::string &  imageFilename,
bool  preload = true,
bool  convertToDisplayFormat = true,
bool  convertWithAlpha = true 
) [explicit]

This Image constructor uses given filename to load the picture from the corresponding file.

Actual picture format is guessed, based on the file content (and not on the filename).

Parameters:
imageFilename the name of the file containing the targeted image, whose format (PNG, JPEG, etc.) will be auto-detected from content. On all PC-like platforms (including Windows and most UNIX), the supported formats are BMP, PNM (PPM/PGM/PBM), XPM, LBM, PCX, GIF, JPEG, PNG, and TIFF formats. JPEG and PNG are the two strongly recommended formats.
preload the image will be loaded directly by this constructor iff true, otherwise only its path will be stored to allow for later loading.
convertToDisplayFormat tells whether this image, when loaded (now or later) should have its format converted to the screen's format, in order to offer faster blits if ever its surface was to be blitted multiple times to the screen (one-time-for-all conversion).
convertWithAlpha if the conversion to screen format is selected (convertToDisplayFormat is true), tells whether the converted surface should also have an alpha channel.
Exceptions:
ImageException if the operation failed or is not supported.
See also:
http://jcatki.no-ip.org/SDL_image/SDL_image.html

Definition at line 126 of file OSDLImage.cc.

References load().

Image::~Image (  )  throw () [virtual]

Basic overridable destructor, so that it remains virtual.

Definition at line 156 of file OSDLImage.cc.

References unload().

OSDL::Video::TwoDimensional::Image::Image ( const Image source  )  [explicit, private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void Image::Load ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads an image, whose format will be auto-detected, from specified file into target surface.

Parameters:
targetSurface the surface that should contain eventually the loaded image.
filename the name of the image file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.

Definition at line 384 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadImage().

bool Image::load (  )  [virtual]

Loads the image from file.

Returns:
true iff the image had to be actually loaded (otherwise it was already loaded and nothing was done).
Exceptions:
Ceylan::LoadableException whenever the loading fails.

Definition at line 185 of file OSDLImage.cc.

References _convertToDisplayFormat, _convertWithAlpha, and OSDL::Video::Surface::LoadImage().

Referenced by Image().

void Image::LoadBMP ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a BMP image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the BMP file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadBMP

Definition at line 928 of file OSDLImage.cc.

References BMPTag, OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadBMP().

void Image::LoadGIF ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a GIF image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the GIF file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadGIF

Definition at line 1091 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), GIFTag, OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadGIF().

Surface & Image::LoadIcon ( const std::string &  filename,
Pixels::ColorElement **  mask 
) [static]

Loads specified icon, and returns the corresponding surface, while updating specified mask so that it selects only icon pixels that should remain visible.

Note:
Ownership of the surface and the mask is transferred to the caller, which has to deallocate them when necessary.
The icon must have a palette, and its size should be 32 * 32 pixels.
Icon format, if supported, will be auto-detected.
See also:
VideoModule::setWindowIcon

Definition at line 266 of file OSDLImage.cc.

References OSDL::Video::Surface::ColorkeyBlit, OSDL::Video::Surface::getHeight(), OSDL::Video::Surface::getPitch(), OSDL::Video::Surface::getPixelFormat(), OSDL::Video::Surface::getPixels(), OSDL::Video::Surface::getWidth(), OSDL::Video::Surface::LoadImage(), OSDL::Video::Surface::setColorKey(), OSDL::Video::Pixels::toString(), and OSDL::Video::Surface::toString().

Referenced by OSDL::Video::VideoModule::setWindowIcon().

void Image::LoadJPG ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a JPEG image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the JPEG file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadJPG

Definition at line 591 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), JPGTag, and OSDL::Video::Surface::setSDLSurface().

void Image::LoadLBM ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a LBM image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the LBM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadLBM

Definition at line 1254 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), LBMTag, and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadLBM().

void Image::LoadPCX ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a PCX image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the PCX file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadPCX

Definition at line 1419 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), PCXTag, and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadPCX().

void Image::LoadPNG ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a PNG image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the PNG file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadPNG

Definition at line 760 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), PNGTag, and OSDL::Video::Surface::setSDLSurface().

void Image::LoadPNM ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a PNM image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the PNM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadPNM

Definition at line 1584 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), PNMTag, and OSDL::Video::Surface::setSDLSurface().

Referenced by OSDL::Video::Surface::loadPNM().

void Image::LoadTGA ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a TGA image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the TGA file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadTGA

Definition at line 1747 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), OSDL::Video::Surface::setSDLSurface(), and TGATag.

Referenced by OSDL::Video::Surface::loadTGA().

void Image::LoadXPM ( Surface targetSurface,
const std::string &  filename,
bool  blitOnly = false,
bool  convertToDisplay = true,
bool  convertWithAlpha = true 
) [static]

Loads a XPM image from specified file into target surface.

Parameters:
targetSurface the surface that should contain the loaded image.
filename the name of the XPM file.
blitOnly tells whether the loaded image surface should only be blitted into the supposed already existing internal surface and then be deallocated (if flag is true, notably useful to load an image into the screen surface), or if this loaded surface should simply replace the former one (if flag is false, usual case for shadow surfaces).
convertToDisplay tells whether this loaded image should have its pixel format converted to the screen's format, in order to allow for faster blits if ever that surface was to be blitted multiple times to the screen (one-time-for-all conversion). Beware: setMode must have been called before convertToDisplay is chosen.
convertWithAlpha if the conversion to screen format is selected (convertToDisplay is true), tells whether the converted surface should also have an alpha channel.
Note:
The auto-detected format must be of course a supported image format.
Specifying a blitOnly option set to true is especially convenient when specifying the screen's surface as target surface, since this surface is special and should not be deallocated as the others may be.
See also:
Surface::loadXPM

Definition at line 1912 of file OSDLImage.cc.

References OSDL::Utils::createDataStreamFrom(), OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getSDLSurface(), OSDL::Data::image, OSDL::Video::VideoModule::IsDisplayInitialized(), OSDL::Video::Surface::isInternalSurfaceAvailable(), OSDL::Video::Surface::setSDLSurface(), and XPMTag.

Referenced by OSDL::Video::Surface::loadXPM().

Image& OSDL::Video::TwoDimensional::Image::operator= ( const Image source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void Image::SaveBMP ( Surface targetSurface,
const std::string &  filename,
bool  overwrite = true 
) [static]

Saves specified surface on file, with specified filename, in BMP format.

Parameters:
targetSurface the surface that should be saved on file. This parameter cannot be 'const' since the surface may have to be locked to read its pixels, so that they can be stored in the image file.
filename the name of the BMP file.
overwrite tells whether an already existing file should be overwritten. The default is true, if false an exception will be raised should a corresponding file be found.
Note:
This method is especially convenient for screenshots.
The PNG format is to be preferred to the BMP one.
See also:
Surface::saveBMP

Definition at line 2280 of file OSDLImage.cc.

References OSDL::Utils::getBackendLastError(), and OSDL::Video::Surface::getSDLSurface().

void Image::SavePNG ( Surface targetSurface,
const std::string &  filename,
bool  overwrite = true 
) [static]

Saves specified surface on file, with specified filename, in PNG format.

Parameters:
targetSurface the surface that should be saved on file. This parameter cannot be 'const' since the surface may have to be locked to read its pixels, so that they can be stored in the image file.
filename the name of the PNG file.
overwrite tells whether any already existing file should be overwritten. The default is true, if false an exception will be raised should a corresponding file be found.
Note:
This method is especially convenient for screenshots.

Transparency is managed.

Note:
The PNG format is to be preferred to the BMP one.
See also:
Surface::savePNG

Definition at line 2078 of file OSDLImage.cc.

References OSDL::Video::Surface::getColorDefinitionAt(), OSDL::Video::Surface::getHeight(), and OSDL::Video::Surface::getWidth().

Referenced by OSDL::Video::Surface::savePNG().

const std::string Image::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 230 of file OSDLImage.cc.

References _convertToDisplayFormat, and _convertWithAlpha.

bool Image::unload (  )  [virtual]

Unloads the image that may be contained by this instance.

Returns:
true iff the image had to be actually unloaded (otherwise it was not already available and nothing was done).
Exceptions:
Ceylan::LoadableException whenever the unloading fails.

Definition at line 213 of file OSDLImage.cc.

Referenced by ~Image().


Member Data Documentation

Tells whether when loaded this image should be converted to screen format.

Definition at line 863 of file OSDLImage.h.

Referenced by load(), and toString().

Tells whether when loaded this image should have an alpha channel when converted to screen format.

Note:
Ignored if _convertToDisplayFormat is false.

Definition at line 874 of file OSDLImage.h.

Referenced by load(), and toString().

const string Image::BMPTag = "BMP" [static, private]

Tag for BMP images, a supported but not recommended format.

Other supported formats are:

Definition at line 930 of file OSDLImage.h.

Referenced by LoadBMP().

const string Image::GIFTag = "GIF" [static, private]

Tag for GIF images, a supported but not recommended format.

Definition at line 939 of file OSDLImage.h.

Referenced by LoadGIF().

const string Image::JPGTag = "JPG" [static, private]

Tag for JPG images, one of the recommended formats.

JPG and PNG are the two recommended formats:

Definition at line 913 of file OSDLImage.h.

Referenced by LoadJPG().

const string Image::LBMTag = "LBM" [static, private]

Tag for LBM images, a supported but not recommended format.

Definition at line 948 of file OSDLImage.h.

Referenced by LoadLBM().

const string Image::PCXTag = "PCX" [static, private]

Tag for PCX images, a supported but not recommended format.

Definition at line 957 of file OSDLImage.h.

Referenced by LoadPCX().

const string Image::PNGTag = "PNG" [static, private]

Tag for PNG images, one of the recommended formats.

Definition at line 921 of file OSDLImage.h.

Referenced by LoadPNG().

const string Image::PNMTag = "PNM" [static, private]

Tag for PNM images, a supported but not recommended format.

Definition at line 965 of file OSDLImage.h.

Referenced by LoadPNM().

const string Image::TGATag = "TGA" [static, private]

Tag for TGA images, a supported but not recommended format.

Definition at line 974 of file OSDLImage.h.

Referenced by LoadTGA().

const string Image::XPMTag = "XPM" [static, private]

Tag for XPM images, a supported but not recommended format.

Definition at line 983 of file OSDLImage.h.

Referenced by LoadXPM().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:06:15 2010 for OSDL by  doxygen 1.6.3