____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"#include <image.h>

Public Member Functions | |
| Image (void *data, int width, int height) | |
| Image (const std::string &filename) | |
| virtual | ~Image () |
| virtual int | getWidth () const |
| virtual int | getHeight () const |
| virtual void * | _getData () const |
Static Public Member Functions | |
| static ImageLoader * | _getImageLoader () |
| static void | setImageLoader (ImageLoader *imageLoader) |
Protected Member Functions | |
| Image () | |
Protected Attributes | |
| void * | mData |
| int | mWidth |
| int | mHeight |
| bool | mLoadedWithImageLoader |
Static Protected Attributes | |
| static ImageLoader * | mImageLoader = NULL |
Image::setImageLoader(myImageLoader)
EXAMPLE: If you use SDLGraphics you should use SDLImageLoader. Otherwise your program will crash in a most bizarre way.
Definition at line 76 of file image.h.
| gcn::Image::Image | ( | void * | data, | |
| int | width, | |||
| int | height | |||
| ) |
| gcn::Image::Image | ( | const std::string & | filename | ) |
Constructor.
| filename | the filename of the image. |
| Exception | when no ImageLoader exists. |
Definition at line 80 of file image.cpp.
References gcn::ImageLoader::finalize(), GCN_EXCEPTION, gcn::ImageLoader::getHeight(), gcn::ImageLoader::getWidth(), mData, mHeight, mImageLoader, mLoadedWithImageLoader, mWidth, and gcn::ImageLoader::prepare().
| gcn::Image::~Image | ( | ) | [virtual] |
Destructor. Unloads the image with the ImageLoader, if it was loaded with it.
Definition at line 94 of file image.cpp.
References gcn::ImageLoader::free(), mImageLoader, and mLoadedWithImageLoader.
| gcn::Image::Image | ( | ) | [protected] |
Default constructor. It is protected so you can inherit from this class.
Definition at line 67 of file image.cpp.
References mLoadedWithImageLoader.
| int gcn::Image::getWidth | ( | ) | const [virtual] |
Gets the width of the Image.
Reimplemented in CGraphic.
Definition at line 102 of file image.cpp.
References mWidth.
Referenced by ImageCheckBox::adjustSize(), ImageRadioButton::adjustSize(), ImageButton::adjustSize(), ImageSlider::draw(), ImageCheckBox::draw(), ImageRadioButton::draw(), ImageButton::draw(), ImageCheckBox::drawBox(), ImageRadioButton::drawBox(), gcn::Graphics::drawImage(), ImageSlider::drawMarker(), gcn::Icon::Icon(), and ImageSlider::setMarkerImage().
| int gcn::Image::getHeight | ( | ) | const [virtual] |
Gets the height of the Image.
Reimplemented in CGraphic.
Definition at line 107 of file image.cpp.
References mHeight.
Referenced by ImageCheckBox::adjustSize(), ImageRadioButton::adjustSize(), ImageButton::adjustSize(), ImageSlider::draw(), ImageButton::draw(), ImageCheckBox::drawBox(), ImageRadioButton::drawBox(), gcn::Graphics::drawImage(), ImageSlider::drawMarker(), and gcn::Icon::Icon().
| void * gcn::Image::_getData | ( | ) | const [virtual] |
Gets the data of the Image. Image data can be different things depending on what ImageLoader you use. If you for instance use the SDLImageLoader then an SDL_Surface will be returned.
Reimplemented in CGraphic.
Definition at line 112 of file image.cpp.
References mData.
Referenced by gcn::SDLGraphics::drawImage().
| ImageLoader * gcn::Image::_getImageLoader | ( | ) | [static] |
Gets the ImageLoader used for loading Images.
Definition at line 122 of file image.cpp.
References mImageLoader.
Referenced by gcn::ImageFont::addGlyph(), gcn::ImageFont::ImageFont(), and gcn::ImageFont::~ImageFont().
| void gcn::Image::setImageLoader | ( | ImageLoader * | imageLoader | ) | [static] |
Sets the ImageLoader to be used for loading images.
IMPORTANT: The ImageLoader is static and MUST be set before loading images!
| imageLoader | the ImageLoader to be used for loading images. |
Definition at line 117 of file image.cpp.
References mImageLoader.
void* gcn::Image::mData [protected] |
int gcn::Image::mWidth [protected] |
int gcn::Image::mHeight [protected] |
bool gcn::Image::mLoadedWithImageLoader [protected] |
ImageLoader * gcn::Image::mImageLoader = NULL [static, protected] |
Definition at line 156 of file image.h.
Referenced by _getImageLoader(), Image(), setImageLoader(), and ~Image().
1.5.6