#include <sdlsurface.h>
Inheritance diagram for SdlSurface:

Public Member Functions | |
| DECLSPEC | SdlSurface (const char *name) |
| DECLSPEC | SdlSurface (SDL_Surface *surf, const char *name) |
| DECLSPEC | SdlSurface (Uint32 w, Uint32 h, const char *name=(char *)-1, Uint32 flags=SDL_HWSURFACE) |
| void DECLSPEC | rename (const char *newname) |
| const char * | getName () const |
| |
| DECLSPEC bool | fastBlit (SdlSurface *src_surf, Sint16 xDst, Sint16 yDst, SDL_Rect *src) |
| DECLSPEC bool | fill (SDL_Rect *r, Uint32 color) |
| DECLSPEC bool | zoomBlit (SdlSurface *src_surf, Sint16 xDst, Sint16 yDst, double xZoom, double yZoom, bool smooth=false) |
| DECLSPEC bool | stretchBlit (SdlSurface *src_surf, SDL_Rect *dst, bool smooth=false) |
| DECLSPEC bool | rotozoomBlit (SdlSurface *src_surf, Sint16 xDst, Sint16 yDst, double angle, double zoom, bool smooth=false) |
| SDL_Surface * | surf () |
| |
| void | getSize (int &w, int &h) |
| void | getSize (Uint16 &w, Uint16 &h) |
| Uint32 | getWidth () const |
| |
| Uint32 | getHeight () const |
| |
| void | setClip (const SDL_Rect &r) |
| void | setNoClip () |
| const SDL_Rect & | getClip () const |
| DECLSPEC void | setColorKey (Uint32 color) |
| DECLSPEC void | setAlphaValue (int a) |
| bool | lock () |
| void | unlock () |
| virtual DECLSPEC bool | saveToFile (const char *fn) |
Protected Member Functions | |
| virtual DECLSPEC void | onRefresh () |
| DECLSPEC void | failed () |
| sets the fail-state of the resource | |
Protected Attributes | |
| SDL_Surface * | surface |
| pointer to the surface buffer | |
This class contains methods for painting/drawing on a surface resource and to get and set information concerning the surface.
| SdlSurface::SdlSurface | ( | const char * | name | ) |
Constructor. Registers itself in SdlManager with the given name. After the construction, it cannot be used for drawing, because there is no surface buffer created or assigned.
| name | the resource's name |
| SdlSurface::SdlSurface | ( | SDL_Surface * | surf, | |
| const char * | name | |||
| ) |
Constructor. Registers itself in SdlManager with the given name. After the construction, the given surface buffer is used.
| surf | the surface buffer to use; if NULL, this constructor does the same as SdlSurface( const char *name ) | |
| name | the resource's name |
| SdlSurface::SdlSurface | ( | Uint32 | w, | |
| Uint32 | h, | |||
| const char * | name = (char *)-1, |
|||
| Uint32 | flags = SDL_HWSURFACE | |||
| ) |
Constructor. Registers itself in SdlManager with the given name. After the construction, a surface buffer with the given size and flags is availible for usage.
| w | the width in pixels of the surface buffer to create | |
| h | the height in pixels of the surface buffer to create | |
| name | the resource's name | |
| flags | the flags of the surface, for details, have a look at the SDL documentation; usually SDL_HWSURFACE is the best value. |
| void SdlSurface::rename | ( | const char * | newname | ) |
Changes the resource's name.
| newname | the new name of the surface |
| bool SdlSurface::fastBlit | ( | SdlSurface * | src_surf, | |
| Sint16 | xDst, | |||
| Sint16 | yDst, | |||
| SDL_Rect * | src | |||
| ) |
Draws the content of another surface onto this surface, using the color key and alpha value of the source surface. This method is (much) faster, than the other blit-functions. When using a transparent alpha value, it will take longer.
| src_surf | the source surface, its content will be used to draw | |
| xDst | the coordinate of the left border, where it will be drawn | |
| yDst | the coordinate of the top border, where it will be drawn | |
| src | the rect in src_surf, to draw; if NULL, the whole content of src_surf will be drawn |
| bool SdlSurface::fill | ( | SDL_Rect * | r, | |
| Uint32 | color | |||
| ) |
Fills a rect with the specified color. This method is usually similar fast as fastBlit() without transparency.
| r | pointer to the rect to fill; if NULL, the whole surface will be filled. | |
| color | the color to use for filling |
| bool SdlSurface::zoomBlit | ( | SdlSurface * | src_surf, | |
| Sint16 | xDst, | |||
| Sint16 | yDst, | |||
| double | xZoom, | |||
| double | yZoom, | |||
| bool | smooth = false | |||
| ) |
Draws another surface zoomed onto this surface.
| src_surf | the source surface, its content will be used to draw | |
| xDst | the coordinate of the left border, where it will be drawn | |
| yDst | the coordinate of the top border, where it will be drawn | |
| xZoom | stretch factor to use in x direction i.e. 2 = double size | |
| yZoom | stretch factor to use in y direction i.e. 2 = double size | |
| smooth | if true, anti aliasing will be used (takes much time) |
| bool SdlSurface::stretchBlit | ( | SdlSurface * | src_surf, | |
| SDL_Rect * | dst, | |||
| bool | smooth = false | |||
| ) |
Draws another surface stretched into a rect of this surface.
| src_surf | the source surface, its content will be used to draw | |
| dst | the rect to draw it in | |
| smooth | if true, anti aliasing will be used (takes much time) |
| bool SdlSurface::rotozoomBlit | ( | SdlSurface * | src_surf, | |
| Sint16 | xDst, | |||
| Sint16 | yDst, | |||
| double | angle, | |||
| double | zoom, | |||
| bool | smooth = false | |||
| ) |
Draws another surface zoomed and rotated onto this surface.
| src_surf | the source surface, its content will be used to draw | |
| xDst | the x-coordinate of the center, where it will be drawn | |
| yDst | the y-coordinate of the center, where it will be drawn | |
| angle | the angle in degrees (clockwise rotation) | |
| zoom | stretch factor to use in both directions (x and y) | |
| smooth | if true, anti aliasing will be used (takes much time) |
| void SdlSurface::getSize | ( | int & | w, | |
| int & | h | |||
| ) | [inline] |
| w | the surface's width will be stored here | |
| h | the surface's height will be stored here |
| void SdlSurface::getSize | ( | Uint16 & | w, | |
| Uint16 & | h | |||
| ) | [inline] |
| w | the surface's width will be stored here | |
| h | the surface's height will be stored here |
| void SdlSurface::setClip | ( | const SDL_Rect & | r | ) | [inline] |
Changes the clip rect. When blitting/filling, nothing will be drawn beyond its borders.
| r | the new clipping rect |
| void SdlSurface::setNoClip | ( | ) | [inline] |
Changes the clip rect to the whole area of the surface.
| const SDL_Rect& SdlSurface::getClip | ( | ) | const [inline] |
| void SdlSurface::setColorKey | ( | Uint32 | color | ) |
Sets the color, that will be fully transparent when drawing.
| color | the color to set transparent |
| void SdlSurface::setAlphaValue | ( | int | a | ) |
Changes the transparency for blits.
| a | the new intensity of transparency; range: 0 to 254; if 255 or bigger no transparency will be used (will be drawn with full intensity |
| bool SdlSurface::lock | ( | ) | [inline] |
Locks the surface. When locked, the surface cannot be used for blitting/filling.
| void SdlSurface::unlock | ( | ) | [inline] |
Unlocks the surface.
| bool SdlSurface::saveToFile | ( | const char * | fn | ) | [virtual] |
Saves the surface to a bitmap file (BMP format).
| virtual DECLSPEC void SdlSurface::onRefresh | ( | ) | [inline, protected, virtual] |
Should refresh the surface in a derived class. In this base class, nothing is done.
Reimplemented in SdlFileSurface.
1.5.1