_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Public Member Functions | List of all members
gcn::ImageLoader Class Referenceabstract

#include <imageloader.h>

Inheritance diagram for gcn::ImageLoader:
gcn::SDLImageLoader

Public Member Functions

virtual ~ImageLoader ()
 
virtual void prepare (const std::string &filename)=0
 
virtual void free (Image *image)=0
 
virtual voidgetRawData ()=0
 
virtual voidfinalize ()=0
 
virtual void discard ()=0
 
virtual int getHeight () const =0
 
virtual int getWidth () const =0
 
virtual Color getPixel (int x, int y)=0
 
virtual void putPixel (int x, int y, const Color &color)=0
 

Detailed Description

ImageLoaders base class. Contains basic image loading functions every image loader should have. Image loaders should inherit from this class and impements it's functions.

Constructor & Destructor Documentation

◆ ~ImageLoader()

virtual gcn::ImageLoader::~ImageLoader ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ discard()

virtual void gcn::ImageLoader::discard ( )
pure virtual

Discards a prepared image.

Exceptions
Exceptionwhen no image has been prepared.

Implemented in gcn::SDLImageLoader.

◆ finalize()

virtual void* gcn::ImageLoader::finalize ( )
pure 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
Exceptionwhen no image has been prepared.

Implemented in gcn::SDLImageLoader.

◆ free()

virtual void gcn::ImageLoader::free ( Image image)
pure 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
imagethe image to be freed and removed.
Exceptions
Exceptionwhen image points to NULL.

Implemented in gcn::SDLImageLoader.

◆ getHeight()

virtual int gcn::ImageLoader::getHeight ( ) const
pure virtual

Gets the height if the image.

Returns
the height of the image.
Exceptions
Exceptionif no image have been prepared.

Implemented in gcn::SDLImageLoader.

◆ getPixel()

virtual Color gcn::ImageLoader::getPixel ( int  x,
int  y 
)
pure virtual

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

Parameters
xthe x coordinate.
ythe y coordinate.
Returns
the color of the pixel.

Implemented in gcn::SDLImageLoader.

◆ getRawData()

virtual void* gcn::ImageLoader::getRawData ( )
pure 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.

Implemented in gcn::SDLImageLoader.

◆ getWidth()

virtual int gcn::ImageLoader::getWidth ( ) const
pure virtual

Gets the width of an image.

Returns
the width of the image.
Exceptions
Exceptionif no image have been prepared.

Implemented in gcn::SDLImageLoader.

◆ prepare()

virtual void gcn::ImageLoader::prepare ( const std::string &  filename)
pure virtual

Prepares an image for reading. After you have called this function you can retrieve information about it and edit it.

Parameters
filenamethe image file to prepare.
Exceptions
Exceptionwhen called without having finalized or disposed to last image or when unable to load the image.

Implemented in gcn::SDLImageLoader.

◆ putPixel()

virtual void gcn::ImageLoader::putPixel ( int  x,
int  y,
const Color color 
)
pure virtual

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

Parameters
xthe x coordinate.
ythe y coordinate.
colorthe color of the pixel to put.

Implemented in gcn::SDLImageLoader.


The documentation for this class was generated from the following file:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.