Wt::SDLSurface Class Reference

#include <sdlsurface.h>

Inherited by Wt::PixmapOf< Wt::SDLSurface >, and Wt::SDLDisplay.

List of all members.

Public Types

 IgnoreEndian
 BigEndian = SDL_BIG_ENDIAN
 LittleEndian = SDL_LIL_ENDIAN
 ScaleFree
 ScaleMin
 ScaleMax
enum  Endian { IgnoreEndian, BigEndian = SDL_BIG_ENDIAN, LittleEndian = SDL_LIL_ENDIAN }
enum  ScaleMode { ScaleFree, ScaleMin, ScaleMax }

Public Member Functions

 SDLSurface (int w, int h, int depth=-1, int flags=0)
 constructor for a sized surface
 SDLSurface (SDL_Surface *surface=0)
 constructor from SDL_Surface. we take over ownership
 SDLSurface (const std::string &filename)
 constructor from file
 operator const SDL_Surface * () const
 operator SDL_Surface * ()
int lock ()
int unlock ()
void detach ()
int pixel (int pixel_offset) const
SDLColor pixelColor (int pixel_offset) const
int pixel (int x, int y) const
SDLColor pixelColor (int x, int y) const
void setPixel (int pixel_offset, int pixel_value)
void setPixelColor (int pixel_offset, const SDLColor &color)
void setPixel (int x, int y, int pixel_value)
void setPixelColor (int x, int y, const SDLColor &color)
Informative methods
int flags () const
bool isSWSurface () const
bool isHWSurface () const
bool hasAsyncBlit () const
bool hasHWPalette () const
bool hasHWAcceleration () const
bool hasTransparentColor () const
bool hasRLEAccell () const
bool hasAlpha () const
bool isTransparent () const
bool isOpaque () const
bool isPreallocated () const
const SDLPixelFormat pixelFormat () const
int width () const
int height () const
int bytesPerLine () const
const void * pixels () const
int depth () const
void * pixels ()
void * bits ()
int pixelOffset (int x, int y) const
void * pixelAddress (int pixel_offset) const
void * pixelAddress (int x, int y) const
void * scanLine (int y)
size_t numBytes () const
int serialNumber () const
Clipping Methods
SDLRect clipRect () const
SDLRect setClipRect (const SDLRect &rect)
Colors and transparency methods
void setPalette (const std::vector< SDLColor > &ca, int offset, int flags=SDLPalette::Logical|SDLPalette::Physical)
SDLColor color (int index) const
void setColor (int i, const SDLColor &c)
int numColors () const
void setNumColors (int ncolors)
bool isGrayscale () const
void setTransparentColor (const SDLColor &color=SDLColor())
void clearTransparentColor ()
SDLColor transparentColor () const
void setAlpha (int alpha=SDLColor::Transparent)
void clearAlpha ()
int alpha () const
Painting and blitting methods
int fill (int v)
int fill (const SDLRect &dst, int v)
int blit (const SDLSurface &src)
 full blit
int blit (int x, int y, const SDLSurface &src)
 blit to
int blit (int x, int y, const SDLSurface &src, const SDLRect &src_rect)
 blit to from
int blitAlphaCopy (const SDLSurface &src)
 copy to from src
int blitAlphaCopy (int x, int y, const SDLSurface &src)
 copy to from src
int blitAlphaCopy (int x, int y, const SDLSurface &src, const SDLRect &src_rect)
 copy to from src rect
bool load (const std::string &fileName)
 load an image from a file
bool load (const void *p, size_t size)
 load an image from mem
Scaling methods
SDLSurface scale (int w, int h, ScaleMode mode=ScaleFree) const
SDLSurface smoothScale (int w, int h, ScaleMode mode=ScaleFree) const
SDLSurface scaleWidth (int w) const
SDLSurface scaleHeight (int h) const
Surface conversion methods
int convertTo (const SDLSurface src)
int convertToDisplay ()
int convertDepth (int new_depth)
void resize (int x, int y)

Static Public Member Functions

static int defaultDepth ()
static int systemByteOrder ()
 Determines the byte order of the display hardware.
static int systemBitOrder ()
 Determines the bit order of the display hardware.

Protected Member Functions

int readPixel8bpp (int pixel_offset) const
void writePixel8bpp (int pixel_offset, int pixel_value)
int readPixel16bpp (int pixel_offset) const
void writePixel16bpp (int pixel_offset, int pixel_value)
int readPixel24bpp (int pixel_offset) const
void writePixel24bpp (int pixel_offset, int pixel_value)
int readPixel32bpp (int pixel_offset) const
void writePixel32bpp (int pixel_offset, int pixel_value)
void onDepthChange ()
SDLSurface scale_surface (int w, int h, bool smooth, ScaleMode mode) const

Static Protected Attributes

static const FlagMap flagMap

Classes

class  Deleter
 boost smart pointers with it


Member Enumeration Documentation

enum Wt::SDLSurface::Endian

Enumerator:
IgnoreEndian 
BigEndian 
LittleEndian 

enum Wt::SDLSurface::ScaleMode

Enumerator:
ScaleFree 
ScaleMin 
ScaleMax 


Constructor & Destructor Documentation

Wt::SDLSurface::SDLSurface ( int  w,
int  h,
int  depth = -1,
int  flags = 0 
)

constructor for a sized surface

Wt::SDLSurface::SDLSurface ( SDL_Surface *  surface = 0  ) 

constructor from SDL_Surface. we take over ownership

Wt::SDLSurface::SDLSurface ( const std::string &  filename  ) 

constructor from file


Member Function Documentation

int Wt::SDLSurface::alpha (  )  const [inline]

void* Wt::SDLSurface::bits (  )  [inline]

int Wt::SDLSurface::blit ( int  x,
int  y,
const SDLSurface src,
const SDLRect src_rect 
)

blit to from

SDL breakage

int Wt::SDLSurface::blit ( int  x,
int  y,
const SDLSurface src 
)

blit to

int Wt::SDLSurface::blit ( const SDLSurface src  ) 

full blit

if (source surface has SDL_SRCALPHA set) { if (source surface has alpha channel (that is, format->Amask != 0)) blit using per-pixel alpha, ignoring any colour key else { if (source surface has SDL_SRCCOLORKEY set) blit using the colour key AND the per-surface alpha value else blit using the per-surface alpha value } } else { if (source surface has SDL_SRCCOLORKEY set) blit using the colour key else ordinary opaque rectangular blit }

Note: The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.

Alpha effects surface blitting in the following ways:

RGBA->RGB with SDL_SRCALPHA The source is alpha-blended with the destination, using the alpha channel. SDL_SRCCOLORKEY and the per-surface alpha are ignored.

RGBA->RGB without SDL_SRCALPHA The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored.

RGB->RGBA with SDL_SRCALPHA The source is alpha-blended with the destination using the per-surface alpha value. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. The alpha channel of the copied pixels is set to opaque.

RGB->RGBA without SDL_SRCALPHA The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGBA->RGBA with SDL_SRCALPHA The source is alpha-blended with the destination using the source alpha channel. The alpha channel in the destination surface is left untouched. SDL_SRCCOLORKEY is ignored.

RGBA->RGBA without SDL_SRCALPHA The RGBA data is copied to the destination surface. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGB->RGB with SDL_SRCALPHA The source is alpha-blended with the destination using the per-surface alpha value. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

RGB->RGB without SDL_SRCALPHA The RGB data is copied from the source. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

Note: Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.

Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available

int Wt::SDLSurface::blitAlphaCopy ( int  x,
int  y,
const SDLSurface src,
const SDLRect src_rect 
)

copy to from src rect

int Wt::SDLSurface::blitAlphaCopy ( int  x,
int  y,
const SDLSurface src 
)

copy to from src

int Wt::SDLSurface::blitAlphaCopy ( const SDLSurface src  ) 

copy to from src

int Wt::SDLSurface::bytesPerLine (  )  const [inline]

void Wt::SDLSurface::clearAlpha (  ) 

void Wt::SDLSurface::clearTransparentColor (  ) 

SDLRect Wt::SDLSurface::clipRect (  )  const

SDLColor Wt::SDLSurface::color ( int  index  )  const [inline]

int Wt::SDLSurface::convertDepth ( int  new_depth  ) 

int Wt::SDLSurface::convertTo ( const SDLSurface  src  ) 

int Wt::SDLSurface::convertToDisplay (  ) 

int Wt::SDLSurface::defaultDepth (  )  [static]

int Wt::SDLSurface::depth (  )  const [inline]

void Wt::SDLSurface::detach (  ) 

int Wt::SDLSurface::fill ( const SDLRect dst,
int  v 
)

int Wt::SDLSurface::fill ( int  v  ) 

int Wt::SDLSurface::flags (  )  const [inline]

bool Wt::SDLSurface::hasAlpha (  )  const [inline]

bool Wt::SDLSurface::hasAsyncBlit (  )  const [inline]

bool Wt::SDLSurface::hasHWAcceleration (  )  const [inline]

bool Wt::SDLSurface::hasHWPalette (  )  const [inline]

bool Wt::SDLSurface::hasRLEAccell (  )  const [inline]

bool Wt::SDLSurface::hasTransparentColor (  )  const [inline]

int Wt::SDLSurface::height (  )  const [inline]

bool Wt::SDLSurface::isGrayscale (  )  const

bool Wt::SDLSurface::isHWSurface (  )  const [inline]

bool Wt::SDLSurface::isOpaque (  )  const [inline]

bool Wt::SDLSurface::isPreallocated (  )  const [inline]

bool Wt::SDLSurface::isSWSurface (  )  const [inline]

bool Wt::SDLSurface::isTransparent (  )  const [inline]

There are 3 mechanisms of transparency

bool Wt::SDLSurface::load ( const void *  p,
size_t  size 
)

load an image from mem

bool Wt::SDLSurface::load ( const std::string &  fileName  ) 

load an image from a file

int Wt::SDLSurface::lock (  ) 

size_t Wt::SDLSurface::numBytes (  )  const [inline]

int Wt::SDLSurface::numColors (  )  const

void Wt::SDLSurface::onDepthChange (  )  [protected]

Wt::SDLSurface::operator const SDL_Surface * (  )  const [inline]

Wt::SDLSurface::operator SDL_Surface * (  )  [inline]

int Wt::SDLSurface::pixel ( int  x,
int  y 
) const [inline]

int Wt::SDLSurface::pixel ( int  pixel_offset  )  const [inline]

void* Wt::SDLSurface::pixelAddress ( int  x,
int  y 
) const [inline]

void* Wt::SDLSurface::pixelAddress ( int  pixel_offset  )  const [inline]

SDLColor Wt::SDLSurface::pixelColor ( int  x,
int  y 
) const [inline]

SDLColor Wt::SDLSurface::pixelColor ( int  pixel_offset  )  const [inline]

const SDLPixelFormat Wt::SDLSurface::pixelFormat (  )  const [inline]

int Wt::SDLSurface::pixelOffset ( int  x,
int  y 
) const [inline]

void* Wt::SDLSurface::pixels (  )  [inline]

const void* Wt::SDLSurface::pixels (  )  const [inline]

int Wt::SDLSurface::readPixel16bpp ( int  pixel_offset  )  const [protected]

int Wt::SDLSurface::readPixel24bpp ( int  pixel_offset  )  const [protected]

int Wt::SDLSurface::readPixel32bpp ( int  pixel_offset  )  const [protected]

int Wt::SDLSurface::readPixel8bpp ( int  pixel_offset  )  const [protected]

void Wt::SDLSurface::resize ( int  x,
int  y 
)

Reimplemented in Wt::SDLDisplay.

SDLSurface Wt::SDLSurface::scale ( int  w,
int  h,
ScaleMode  mode = ScaleFree 
) const

SDLSurface Wt::SDLSurface::scale_surface ( int  w,
int  h,
bool  smooth,
ScaleMode  mode 
) const [protected]

SDLSurface Wt::SDLSurface::scaleHeight ( int  h  )  const

SDLSurface Wt::SDLSurface::scaleWidth ( int  w  )  const

void* Wt::SDLSurface::scanLine ( int  y  )  [inline]

int Wt::SDLSurface::serialNumber (  )  const [inline]

void Wt::SDLSurface::setAlpha ( int  alpha = SDLColor::Transparent  ) 

SDLRect Wt::SDLSurface::setClipRect ( const SDLRect rect  ) 

void Wt::SDLSurface::setColor ( int  i,
const SDLColor c 
)

void Wt::SDLSurface::setNumColors ( int  ncolors  ) 

void Wt::SDLSurface::setPalette ( const std::vector< SDLColor > &  ca,
int  offset,
int  flags = SDLPalette::Logical|SDLPalette::Physical 
)

void Wt::SDLSurface::setPixel ( int  x,
int  y,
int  pixel_value 
) [inline]

void Wt::SDLSurface::setPixel ( int  pixel_offset,
int  pixel_value 
) [inline]

void Wt::SDLSurface::setPixelColor ( int  x,
int  y,
const SDLColor color 
) [inline]

void Wt::SDLSurface::setPixelColor ( int  pixel_offset,
const SDLColor color 
) [inline]

void Wt::SDLSurface::setTransparentColor ( const SDLColor color = SDLColor()  ) 

SDLSurface Wt::SDLSurface::smoothScale ( int  w,
int  h,
ScaleMode  mode = ScaleFree 
) const

static int Wt::SDLSurface::systemBitOrder (  )  [inline, static]

Determines the bit order of the display hardware.

static int Wt::SDLSurface::systemByteOrder (  )  [inline, static]

Determines the byte order of the display hardware.

SDLColor Wt::SDLSurface::transparentColor (  )  const [inline]

int Wt::SDLSurface::unlock (  ) 

int Wt::SDLSurface::width (  )  const [inline]

void Wt::SDLSurface::writePixel16bpp ( int  pixel_offset,
int  pixel_value 
) [protected]

void Wt::SDLSurface::writePixel24bpp ( int  pixel_offset,
int  pixel_value 
) [protected]

void Wt::SDLSurface::writePixel32bpp ( int  pixel_offset,
int  pixel_value 
) [protected]

void Wt::SDLSurface::writePixel8bpp ( int  pixel_offset,
int  pixel_value 
) [protected]


Member Data Documentation

const FlagMap Wt::SDLSurface::flagMap [static, protected]

Initial value:

 boost::assign::map_list_of
                                    (W::SWSurface, SDL_SWSURFACE)
                                    (W::HWSurface, SDL_HWSURFACE)
                                    (W::AsyncBlit, SDL_ASYNCBLIT)
                                    (W::HWPalette, SDL_HWPALETTE)
                                    (W::HWAccel, SDL_HWACCEL)
                                    (W::AnyFormat, SDL_ANYFORMAT)
                                    (W::DoubleBuffer, SDL_DOUBLEBUF)
                                    (W::FullScreen, SDL_FULLSCREEN)
                                    (W::OpenGL, SDL_OPENGL)
                                    (W::OpenGLBlit, SDL_OPENGLBLIT)
                                    (W::Resizable, SDL_RESIZABLE)
                                    (W::NoFrame, SDL_NOFRAME)


The documentation for this class was generated from the following files:

Generated Fri Jul 28 19:22:39 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.