_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <video.h>
Classes | |
struct | frame_pos_t |
Public Member Functions | |
bool | IsLoaded (bool flipped=false) const |
virtual void * | _getData () const |
virtual int | getWidth () const |
virtual int | getHeight () const |
![]() | |
Image (void *data, int width, int height) | |
Image (const std::string &filename) | |
virtual | ~Image () |
virtual bool | isDirty () const |
Public Attributes | |
std::string | File |
std::string | HashFile |
Filename. More... | |
SDL_Surface * | Surface |
Filename used in hash. More... | |
SDL_Surface * | SurfaceFlip |
Surface. More... | |
frame_pos_t * | frame_map |
Flipped surface. More... | |
frame_pos_t * | frameFlip_map |
int | Width |
int | Height |
Width of a frame. More... | |
int | NumFrames |
Height of a frame. More... | |
int | GraphicWidth |
Number of frames. More... | |
int | GraphicHeight |
Original graphic width. More... | |
int | Refs |
Original graphic height. More... | |
bool | Resized |
Uses of this graphic. More... | |
Protected Member Functions | |
CGraphic () | |
~CGraphic () | |
![]() | |
Image () | |
Friends | |
class | CFont |
Image has been resized. More... | |
graphic.cpp - The general graphic functions. | |
void | DrawClip (int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawSub (int gx, int gy, int w, int h, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawSubCustomMod (int gx, int gy, int w, int h, int x, int y, pixelModifier modifier, const uint32_t param, SDL_Surface *surface=TheScreen) const |
void | DrawSubClip (int gx, int gy, int w, int h, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawSubTrans (int gx, int gy, int w, int h, int x, int y, unsigned char alpha, SDL_Surface *surface=TheScreen) const |
void | DrawSubClipTrans (int gx, int gy, int w, int h, int x, int y, unsigned char alpha, SDL_Surface *surface=TheScreen) const |
void | DrawSubClipCustomMod (int gx, int gy, int w, int h, int x, int y, pixelModifier modifier, const uint32_t param, SDL_Surface *surface=TheScreen) const |
void | DrawFrame (unsigned frame, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawFrameClip (unsigned frame, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawFrameTrans (unsigned frame, int x, int y, int alpha, SDL_Surface *surface=TheScreen) const |
void | DrawFrameClipTrans (unsigned frame, int x, int y, int alpha, SDL_Surface *surface=TheScreen) const |
void | DrawFrameClipCustomMod (unsigned frame, int x, int y, pixelModifier modifier, const uint32_t param, SDL_Surface *surface=TheScreen) const |
void | DrawFrameX (unsigned frame, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawFrameClipX (unsigned frame, int x, int y, SDL_Surface *surface=TheScreen) const |
void | DrawFrameTransX (unsigned frame, int x, int y, int alpha, SDL_Surface *surface=TheScreen) const |
void | DrawFrameClipTransX (unsigned frame, int x, int y, int alpha, SDL_Surface *surface=TheScreen) const |
void | Load (bool grayscale=false) |
void | Flip () |
void | Resize (int w, int h) |
void | SetOriginalSize () |
bool | TransparentPixel (int x, int y) |
void | SetPaletteColor (int idx, int r, int g, int b) |
void | MakeShadow (int xOffset, int yOffset) |
void | OverlayGraphic (CGraphic *other, bool mask=false) |
void | GenFramesMap () |
static CGraphic * | New (const std::string &file, int w=0, int h=0) |
static CGraphic * | ForceNew (const std::string &file, int w=0, int h=0) |
static CGraphic * | Get (const std::string &file) |
static void | Free (CGraphic *g) |
Additional Inherited Members | |
![]() | |
static ImageLoader * | _getImageLoader () |
static void | setImageLoader (ImageLoader *imageLoader) |
![]() | |
void * | mData |
int | mWidth |
int | mHeight |
bool | mLoadedWithImageLoader |
![]() | |
static ImageLoader * | mImageLoader = NULL |
|
inlineprotected |
|
inlineprotected |
|
inlinevirtual |
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 from gcn::Image.
Video draw the graphic clipped.
x | X position on the target surface |
y | Y position on the target surface |
surface | target surface |
Draw graphic object unclipped.
frame | number of frame (object index) |
x | x coordinate on the target surface |
y | y coordinate on the target surface |
surface | target surface |
void CGraphic::DrawFrameClip | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Draw graphic object clipped.
frame | number of frame (object index) |
x | x coordinate on the target surface |
y | y coordinate on the target surface |
surface | target surface |
void CGraphic::DrawFrameClipCustomMod | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
pixelModifier | modifier, | ||
const uint32_t | param, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
void CGraphic::DrawFrameClipTrans | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
int | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
void CGraphic::DrawFrameClipTransX | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
int | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
void CGraphic::DrawFrameClipX | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Draw graphic object clipped and flipped in X direction.
frame | number of frame (object index) |
x | x coordinate on the target surface |
y | y coordinate on the target surface |
surface | target surface |
void CGraphic::DrawFrameTrans | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
int | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
void CGraphic::DrawFrameTransX | ( | unsigned | frame, |
int | x, | ||
int | y, | ||
int | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Draw graphic object unclipped and flipped in X direction.
frame | number of frame (object index) |
x | x coordinate on the target surface |
y | y coordinate on the target surface |
surface | target surface |
void CGraphic::DrawSub | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw part of graphic.
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
surface | target surface |
void CGraphic::DrawSubClip | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw part of graphic clipped.
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
surface | target surface |
void CGraphic::DrawSubClipCustomMod | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
pixelModifier | modifier, | ||
const uint32_t | param, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw clipped part of graphic by custom pixel modifier. 32bpp only (yet?)
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
modifier | method used to draw pixels instead of SDL_BlitSurface |
param | parameter for modifier |
surface | target surface |
void CGraphic::DrawSubClipTrans | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
unsigned char | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw part of graphic with alpha and clipped.
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
alpha | Alpha |
surface | target surface |
void CGraphic::DrawSubCustomMod | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
pixelModifier | modifier, | ||
const uint32_t | param, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw part of graphic by custom pixel modifier. 32bpp only (yet?)
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
modifier | method used to draw pixels instead of SDL_BlitSurface |
param | parameter for modifier |
surface | target surface |
void CGraphic::DrawSubTrans | ( | int | gx, |
int | gy, | ||
int | w, | ||
int | h, | ||
int | x, | ||
int | y, | ||
unsigned char | alpha, | ||
SDL_Surface * | surface = TheScreen |
||
) | const |
Video draw part of graphic with alpha.
gx | X offset into object |
gy | Y offset into object |
w | width to display |
h | height to display |
x | X position on the target surface |
y | Y position on the target surface |
alpha | Alpha |
surface | target surface |
void CGraphic::Flip | ( | ) |
Flip graphic and store in graphic->SurfaceFlip
|
static |
Make a new graphic object. Don't reuse a graphic from the hash table.
file | Filename |
w | Width of a frame (optional) |
h | Height of a frame (optional) |
void CGraphic::GenFramesMap | ( | ) |
|
static |
Get a graphic object.
filename | Filename |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
void CGraphic::Load | ( | bool | grayscale = false | ) |
Load a graphic
grayscale | Make a grayscale surface |
|
static |
Make a new graphic object.
filename | Filename |
w | Width of a frame (optional) |
h | Height of a frame (optional) |
void CGraphic::Resize | ( | int | w, |
int | h | ||
) |
Resize a graphic
w | New width of graphic. |
h | New height of graphic. |
void CGraphic::SetOriginalSize | ( | ) |
Sets the original size for a graphic
void CGraphic::SetPaletteColor | ( | int | idx, |
int | r, | ||
int | g, | ||
int | b | ||
) |
Change a palette color.
bool CGraphic::TransparentPixel | ( | int | x, |
int | y | ||
) |
Check if a pixel is transparent
x | X coordinate |
y | Y coordinate |
std::string CGraphic::File |
frame_pos_t* CGraphic::frame_map |
Flipped surface.
frame_pos_t* CGraphic::frameFlip_map |
int CGraphic::GraphicHeight |
Original graphic width.
int CGraphic::GraphicWidth |
Number of frames.
std::string CGraphic::HashFile |
Filename.
int CGraphic::Height |
Width of a frame.
int CGraphic::NumFrames |
Height of a frame.
int CGraphic::Refs |
Original graphic height.
bool CGraphic::Resized |
Uses of this graphic.
SDL_Surface* CGraphic::Surface |
Filename used in hash.
SDL_Surface* CGraphic::SurfaceFlip |
Surface.
int CGraphic::Width |