SDL++
C++wrapperfortheSDLlibrary.

sdl::video::Surface Class Reference

Represents a surface. More...

#include <Surface.h>

List of all members.

Public Member Functions

 Surface ()
 Surface (SDL_Surface *surface)
 Surface (const string &fileName)
 Surface (int height, int width, int bpp, unsigned int flags)
 Surface (Uint32 flags, const Rect &rect, int bpp, const Color &mask)
 Surface (void *pixels, const Rect &rect, int bpp, int pitch, const Color &mask)
 ~Surface ()
 Surface (const Surface &rhs)
Surfaceoperator= (const Surface &rhs)
Surfaceblit (Surface &surface, const Rect &srcRect, const Rect &dstRect)
int height ()
int width ()
int bpp ()
bool lock ()
void unlock ()
bool save (const string &fileName)
SDL_Surface *const to_c () const

Detailed Description

Represents a surface.

Definition at line 43 of file Surface.h.


Constructor & Destructor Documentation

sdl::video::Surface::Surface ( ) [inline]

Constructs a Surface from the current display surface.

Exceptions:
runtime_errorThrows a runtime_error if unable to get current system display.

Definition at line 50 of file Surface.h.

sdl::video::Surface::Surface ( SDL_Surface *  surface) [inline]

Constructs a Surface from a SDL_Surface structure.

Parameters:
TheSDL_Surface structure.
Exceptions:
runtime_errorThrows a runtime_error if surface is NULL.

Definition at line 62 of file Surface.h.

sdl::video::Surface::Surface ( const string &  fileName) [inline]

Constructs a Surface from a file.

Parameters:
fileNameThe name of the file.
Exceptions:
runtime_errorThrows a runtime_error if unable to load bitmap.

Definition at line 74 of file Surface.h.

sdl::video::Surface::Surface ( int  height,
int  width,
int  bpp,
unsigned int  flags 
) [inline]

Constructs a Surface.

Parameters:
heightThe height.
widthThe width.
bppThe bits per pixel.
flagsThe surface flags.
Exceptions:
runtime_errorThrows a runtime_error if unable to set video mode.

Definition at line 89 of file Surface.h.

sdl::video::Surface::Surface ( Uint32  flags,
const Rect rect,
int  bpp,
const Color mask 
) [inline]

Constructs a Surface.

Parameters:
flagsThe SDL Surface flags.
rectA rectangle with the height and width.
bppThe number of bits per pixel.
maskThe color mask.
Exceptions:
runtime_errorThrows a runtime_error if unable to create RGB surface.

Definition at line 105 of file Surface.h.

sdl::video::Surface::Surface ( void *  pixels,
const Rect rect,
int  bpp,
int  pitch,
const Color mask 
) [inline]

Constructs a Surface from the provided pixel data.

Parameters:
pixelsThe pixel data.
rectA rectangle with the height and width.
bppThe number of bits per pixel.
pitchThe size of the scanline in bytes, width in pixels * bytes per pixel.
maskThe color mask.
Exceptions:
runtime_errorThrows a runtime_error if unable to create RGB surface.

Definition at line 124 of file Surface.h.

sdl::video::Surface::~Surface ( ) [inline]

Destroys the Surface.

Definition at line 135 of file Surface.h.

sdl::video::Surface::Surface ( const Surface rhs) [inline]

Copy constructs a Surface.

Parameters:
rhsThe Surface to copy.

Definition at line 142 of file Surface.h.


Member Function Documentation

Surface& sdl::video::Surface::blit ( Surface surface,
const Rect srcRect,
const Rect dstRect 
) [inline]

Blits the source rectangle from one Surface onto the destination rectangle of this Surface.

Parameters:
surfaceThe Surface from which to blit.
srcRectThe source rectangle.
dstRectThe destination rectangle.
Returns:
A reference to this Surface.
Exceptions:
runtime_errorThrows a runtime_error if unable to blit.

Definition at line 168 of file Surface.h.

int sdl::video::Surface::bpp ( ) [inline]

Returns the number of bits per pixel.

Returns:
The number of bits per pixel.

Definition at line 203 of file Surface.h.

int sdl::video::Surface::height ( ) [inline]

Returns the height.

Returns:
The height.

Definition at line 189 of file Surface.h.

bool sdl::video::Surface::lock ( ) [inline]

Locks the Surface.

Returns:
True if successful, false otherwise.

Definition at line 210 of file Surface.h.

Surface& sdl::video::Surface::operator= ( const Surface rhs) [inline]

The assignment operator.

Parameters:
rhsThe Surface from which to assign.
Returns:
A reference to this Surface.

Definition at line 151 of file Surface.h.

bool sdl::video::Surface::save ( const string &  fileName) [inline]

Save the Surface to the named file.

Parameters:
fileNameThe name of the file.
Returns:
True if successful, false otherwise.

Definition at line 224 of file Surface.h.

SDL_Surface* const sdl::video::Surface::to_c ( ) const [inline]

Exposes the underlying SDL_Surface structure.

Returns:
The SDL_Surface structure.

Definition at line 231 of file Surface.h.

void sdl::video::Surface::unlock ( ) [inline]

Unlock the Surface.

Definition at line 215 of file Surface.h.

int sdl::video::Surface::width ( ) [inline]

Returns the width.

Returns:
The width.

Definition at line 196 of file Surface.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs