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

Public Member Functions | Protected Attributes | List of all members
gcn::SDLImageLoader Class Reference

#include <sdlimageloader.h>

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

Public Member Functions

 SDLImageLoader ()
 
virtual void prepare (const std::string &filename)
 
virtual void free (Image *image)
 
virtual voidgetRawData ()
 
virtual voidfinalize ()
 
virtual void discard ()
 
virtual int getHeight () const
 
virtual int getWidth () const
 
virtual Color getPixel (int x, int y)
 
virtual void putPixel (int x, int y, const Color &color)
 
- Public Member Functions inherited from gcn::ImageLoader
virtual ~ImageLoader ()
 

Protected Attributes

SDL_Surface * mCurrentImage
 

Detailed Description

SDL implementation of ImageLoader.

Constructor & Destructor Documentation

◆ SDLImageLoader()

gcn::SDLImageLoader::SDLImageLoader ( )

Constructor.

Member Function Documentation

◆ discard()

virtual void gcn::SDLImageLoader::discard ( )
virtual

Discards a prepared image.

Exceptions
Exceptionwhen no image has been prepared.

Implements gcn::ImageLoader.

◆ finalize()

virtual void* gcn::SDLImageLoader::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
Exceptionwhen no image has been prepared.

Implements gcn::ImageLoader.

◆ free()

virtual void gcn::SDLImageLoader::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
imagethe image to be freed and removed.
Exceptions
Exceptionwhen image points to NULL.

Implements gcn::ImageLoader.

◆ getHeight()

virtual int gcn::SDLImageLoader::getHeight ( ) const
virtual

Gets the height if the image.

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

Implements gcn::ImageLoader.

◆ getPixel()

virtual Color gcn::SDLImageLoader::getPixel ( int  x,
int  y 
)
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.

Implements gcn::ImageLoader.

◆ getRawData()

virtual void* gcn::SDLImageLoader::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.

◆ getWidth()

virtual int gcn::SDLImageLoader::getWidth ( ) const
virtual

Gets the width of an image.

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

Implements gcn::ImageLoader.

◆ prepare()

virtual void gcn::SDLImageLoader::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
filenamethe image file to prepare.
Exceptions
Exceptionwhen called without having finalized or disposed to last image or when unable to load the image.

Implements gcn::ImageLoader.

◆ putPixel()

virtual void gcn::SDLImageLoader::putPixel ( int  x,
int  y,
const Color color 
)
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.

Implements gcn::ImageLoader.

Member Data Documentation

◆ mCurrentImage

SDL_Surface* gcn::SDLImageLoader::mCurrentImage
protected

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.