Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

gcn::OpenGLImageLoader Class Reference

#include <openglimageloader.hpp>

Inheritance diagram for gcn::OpenGLImageLoader:

gcn::ImageLoader List of all members.

Detailed Description

OpenGL implementation of ImageLoader.

This ImageLoader cannot load images by itself. It requires another imageloader, such as for example the SDLImageLoader, to be able to load images.

Todo:
Flags for transperancy.

Definition at line 72 of file openglimageloader.hpp.

Public Member Functions

 OpenGLImageLoader ()
 Constructor.
 OpenGLImageLoader (ImageLoader *imageLoader)
 Constructor.
virtual void setHostImageLoader (ImageLoader *imageLoader)
 Set the host ImageLoader.
virtual void prepare (const std::string &filename)
 Prepares an image for reading.
virtual void free (Image *image)
 This function frees an image.
virtual void * getRawData ()
 Rreturns a pointer of raw data of an image.
virtual void * finalize ()
 Finalizes an image meaning it will return the image data.
virtual void discard ()
 Discards a prepared image.
virtual int getHeight () const
 Gets the height if the image.
virtual int getWidth () const
 Gets the width of an image.
virtual Color getPixel (int x, int y)
 Gets the color of a pixel at coordinate x and y.
virtual void putPixel (int x, int y, const Color &color)
 Puts a pixel with a certain color at coordinate x and y.

Protected Attributes

ImageLoadermImageLoader


Constructor & Destructor Documentation

gcn::OpenGLImageLoader::OpenGLImageLoader ImageLoader imageLoader  ) 
 

Constructor.

Parameters:
imageLoader the ImageLoader to use.

Definition at line 81 of file openglimageloader.cpp.


Member Function Documentation

void gcn::OpenGLImageLoader::discard  )  [virtual]
 

Discards a prepared image.

Exceptions:
Exception when no image has been prepared.

Implements gcn::ImageLoader.

Definition at line 215 of file openglimageloader.cpp.

References gcn::ImageLoader::discard().

void * gcn::OpenGLImageLoader::finalize  )  [virtual]
 

Finalizes an image meaning it will return the image data.

If the image contains pixels with "magic pink" (0xff00ff) they will be treated as transparent pixels.

Returns:
a pointer to the image data.
Exceptions:
Exception when no image has been prepared.

Implements gcn::ImageLoader.

Definition at line 111 of file openglimageloader.cpp.

References gcn::ImageLoader::discard(), gcn::ImageLoader::getHeight(), gcn::ImageLoader::getRawData(), and gcn::ImageLoader::getWidth().

void gcn::OpenGLImageLoader::free Image image  )  [virtual]
 

This function frees an image.

NOTE: There is generally no reason to call this function as it is called upon by the Image object when destroying an Image.

Parameters:
filename the file to be freed and removed.
Exceptions:
Exception when image points to NULL.

Implements gcn::ImageLoader.

Definition at line 225 of file openglimageloader.cpp.

int gcn::OpenGLImageLoader::getHeight  )  const [virtual]
 

Gets the height if the image.

Returns:
the height of the image.
Exceptions:
Exception if no image have been prepared.

Implements gcn::ImageLoader.

Definition at line 242 of file openglimageloader.cpp.

References gcn::ImageLoader::getHeight().

Color gcn::OpenGLImageLoader::getPixel int  x,
int  y
[virtual]
 

Gets the color of a pixel at coordinate x and y.

Parameters:
x the x coordinate.
y the y coordinate.
Returns:
the color of the pixel.

Implements gcn::ImageLoader.

Definition at line 252 of file openglimageloader.cpp.

References gcn::ImageLoader::getPixel().

void * gcn::OpenGLImageLoader::getRawData  )  [virtual]
 

Rreturns a pointer of raw data of an image.

The raw data is in 32 bit RGBA format. The funcion will not free a prepared image, so finalize or discard should be used afterwards.

Returns:
a pointer to the raw image data.

Implements gcn::ImageLoader.

Definition at line 101 of file openglimageloader.cpp.

References gcn::ImageLoader::getRawData().

int gcn::OpenGLImageLoader::getWidth  )  const [virtual]
 

Gets the width of an image.

Returns:
the width of the image.
Exceptions:
Exception if no image have been prepared.

Implements gcn::ImageLoader.

Definition at line 232 of file openglimageloader.cpp.

References gcn::ImageLoader::getWidth().

void gcn::OpenGLImageLoader::prepare const std::string &  filename  )  [virtual]
 

Prepares an image for reading.

After you have called this function you can retrieve information about it and edit it.

Parameters:
filename the image file to prepare.
Exceptions:
Exception when called without having finalized or disposed to last image or when unable to load the image.

Implements gcn::ImageLoader.

Definition at line 91 of file openglimageloader.cpp.

References gcn::ImageLoader::prepare().

void gcn::OpenGLImageLoader::putPixel int  x,
int  y,
const Color color
[virtual]
 

Puts a pixel with a certain color at coordinate x and y.

Parameters:
x the x coordinate.
y the y coordinate.
color the color of the pixel to put.

Implements gcn::ImageLoader.

Definition at line 262 of file openglimageloader.cpp.

References gcn::ImageLoader::putPixel().

void gcn::OpenGLImageLoader::setHostImageLoader ImageLoader imageLoader  )  [virtual]
 

Set the host ImageLoader.

Parameters:
imageLoader the ImageLoader to use.

Definition at line 86 of file openglimageloader.cpp.


The documentation for this class was generated from the following files:
Generated on Tue May 17 21:23:26 2005 for Guichan by  doxygen 1.4.1