Wt::SDLDisplay Class Reference

interface to the underlying SDL_VideoSurface More...

#include <sdldisplay.h>

Inheritance diagram for Wt::SDLDisplay:

Inheritance graph
[legend]
Collaboration diagram for Wt::SDLDisplay:

Collaboration graph
[legend]
List of all members.

Public Types

 defaultWidth = 640
 defaultHeight = 480
 defaultDepth = 32
enum  DefaultSurface { defaultWidth = 640, defaultHeight = 480, defaultDepth = 32 }
 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

 SDLDisplay (int w=defaultWidth, int h=defaultHeight, int depth=defaultDepth, int flags=0)
 Initialize the target screen surface.
 operator const SDL_Surface * () const
 operator SDL_Surface * ()
int lock ()
int unlock ()
void detach ()
int pixel (int pixel_offset) const
int pixel (int x, int y) const
SDLColor pixelColor (int pixel_offset) const
SDLColor pixelColor (int x, int y) const
void setPixel (int pixel_offset, int pixel_value)
void setPixel (int x, int y, int pixel_value)
void setPixelColor (int pixel_offset, const SDLColor &color)
void setPixelColor (int x, int y, const SDLColor &color)
Informative methods
bool isAnyFormat () const
bool hasDoubleBuffer () const
bool isFullScreen () const
bool hasOpenGL () const
bool hasOpenGLBlit () const
bool isResizable () const
bool hasFrame () const
update methods
void update ()
 Update the surface.
void update (const SDLRect &rect)
 Update a rectangle on the surface.
void update (const std::vector< SDLRect > &rects)
 Update a region on the surface.
void flip ()
 If doublebuffered(), flip the surface and its buffer, otherwise update().
Gamma methods
int setGamma (float red, float green, float blue)
int setGammaRamp (const std::vector< Uint16 > &red, const std::vector< Uint16 > &green, const std::vector< Uint16 > &blue)
 ???
resize methods
int toggleFullScreen ()
 returns true if the surface is full screen
void resize (int w, int h)
 resize the SDL window
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
void * pixels ()
int depth () const
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)

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.
static DERIVED * instance ()
template<class GRANDCHILD>
static DERIVED * instance ()
 instantiates the pointer compatible child of DERIVED aka grandchild
static DERIVED * existingInstance ()
static void init ()
static void quit ()

Protected Member Functions

 SDLDisplay (SDLSurface &src)
 copy constructor takes ownership. It is called from load()
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 Member Functions

static SDLDisplayload (int w=defaultWidth, int h=defaultHeight, int depth=defaultDepth, int flags=0)
static DERIVED * load ()
 try to load the instance

Static Protected Attributes

static const FlagMap flagMap
static DERIVED * instance_ = 0

Private Member Functions

 SDLDisplay (const SDLDisplay &)
SDLDisplayoperator= (const SDLDisplay &)

Friends

class Singleton< SDLDisplay >

Detailed Description

interface to the underlying SDL_VideoSurface

Definition at line 31 of file sdldisplay.h.


Member Enumeration Documentation

enum Wt::SDLDisplay::DefaultSurface

Enumerator:
defaultWidth 
defaultHeight 
defaultDepth 

Definition at line 35 of file sdldisplay.h.

00035                  {
00036         defaultWidth = 640,
00037         defaultHeight = 480,
00038         defaultDepth = 32,
00039     } DefaultSurface;

enum Wt::SDLSurface::Endian [inherited]

Enumerator:
IgnoreEndian 
BigEndian 
LittleEndian 

Definition at line 44 of file sdlsurface.h.

00044                  {
00045         IgnoreEndian,
00046         BigEndian = SDL_BIG_ENDIAN,
00047         LittleEndian = SDL_LIL_ENDIAN
00048     } Endian;

enum Wt::SDLSurface::ScaleMode [inherited]

Enumerator:
ScaleFree 
ScaleMin 
ScaleMax 

Definition at line 50 of file sdlsurface.h.

00050                  {
00051         ScaleFree,
00052         ScaleMin,
00053         ScaleMax
00054     } ScaleMode;


Constructor & Destructor Documentation

Wt::SDLDisplay::SDLDisplay ( int  w = defaultWidth,
int  h = defaultHeight,
int  depth = defaultDepth,
int  flags = 0 
)

Initialize the target screen surface.

Definition at line 35 of file sdldisplay.cpp.

Referenced by load().

00036         : SDLSurface(SDL_SetVideoMode(w, h, depth,
00037                                       flagMap.state(
00038                                           flags ? flags
00039                                           : static_cast<int>(W::DefaultDisplayPixmapFlags)))),
00040 Singleton<SDLDisplay>(this) {}

Wt::SDLDisplay::SDLDisplay ( SDLSurface src  )  [protected]

copy constructor takes ownership. It is called from load()

Definition at line 42 of file sdldisplay.cpp.

00043 : SDLSurface(src),
00044 Singleton<SDLDisplay>(this) {}

Wt::SDLDisplay::SDLDisplay ( const SDLDisplay  )  [private]


Member Function Documentation

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

Definition at line 224 of file sdlsurface.h.

References Wt::SDLPixelFormat::alpha(), and Wt::SDLSurface::pixelFormat().

Referenced by Wt::SDLSurface::blitAlphaCopy(), Wt::SDLSurface::isTransparent(), and Wt::SDLSurface::setAlpha().

00224                       {
00225         return pixelFormat().alpha();
00226     }

Here is the call graph for this function:

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

Definition at line 162 of file sdlsurface.h.

References Wt::SDLSurface::pixels().

00162                  {
00163         return pixels();
00164     }

Here is the call graph for this function:

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

blit to from

SDL breakage

Definition at line 300 of file sdlsurface.cpp.

References Wt::deconst(), Wt::SDLSurface::detach(), and Wt::safe_blit().

00301                                                                      {
00302     ///SDL breakage
00303     SDLRect s = src_rect;
00304     SDLRect dst(x, y, 0, 0);
00305     detach();
00306     return safe_blit(deconst(src), s, *this, dst);
00307 }

Here is the call graph for this function:

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

blit to

Definition at line 294 of file sdlsurface.cpp.

References Wt::deconst(), Wt::SDLSurface::detach(), and Wt::safe_blit().

00294                                                         {
00295     SDLRect dst(x, y, 0, 0);
00296     detach();
00297     return safe_blit(deconst(src), 0, *this, dst);
00298 }

Here is the call graph for this function:

int Wt::SDLSurface::blit ( const SDLSurface src  )  [inherited]

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

Definition at line 289 of file sdlsurface.cpp.

References Wt::deconst(), Wt::SDLSurface::detach(), and Wt::safe_blit().

Referenced by Wt::SDLSurface::blitAlphaCopy(), and Wt::SDLSurface::convertDepth().

00289                                           {
00290     detach();
00291     return safe_blit(deconst(src), 0, *this, 0);
00292 }

Here is the call graph for this function:

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

copy to from src rect

Definition at line 377 of file sdlsurface.cpp.

References Wt::SDLSurface::alpha(), Wt::SDLSurface::blit(), Wt::deconst(), Wt::SDLSurface::depth(), Wt::SDLSurface::hasAlpha(), Wt::SDLSurface::hasTransparentColor(), Wt::SDLColor::Opaque, Wt::SDLSurface::pixelFormat(), and Wt::SDLPixelFormat::transparentPixelValue().

00378                                                        {
00379     assert(depth() == src.depth());
00380 
00381     bool has_alpha = src.hasAlpha();
00382     bool has_colorkey = src.hasTransparentColor();
00383     int alpha = 0, pv = 0;
00384 
00385     // note: we can't use set/clearAlpha beacuse of detach
00386     if (has_alpha) {
00387         alpha = src.alpha();
00388         SDL_SetAlpha(deconst(src), 0, SDLColor::Opaque);
00389     }
00390 
00391     if (has_colorkey) {
00392         pv = src.pixelFormat().transparentPixelValue();
00393         SDL_SetColorKey(deconst(src), 0, 0);
00394     }
00395 
00396     int status = blit(x, y, src, src_rect);
00397 
00398     if (has_alpha) {
00399         SDL_SetAlpha(deconst(src), SDL_SRCALPHA, alpha);
00400     }
00401 
00402     if (has_colorkey) {
00403         SDL_SetColorKey(deconst(src), SDL_SRCCOLORKEY | SDL_RLEACCEL, pv);
00404     }
00405     return status;
00406 }

Here is the call graph for this function:

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

copy to from src

Definition at line 412 of file sdlsurface.cpp.

References Wt::SDLSurface::blitAlphaCopy(), Wt::SDLSurface::height(), and Wt::SDLSurface::width().

00412                                                                  {
00413     return blitAlphaCopy(x, y, src, SDLRect(0, 0, src.width(), src.height()));
00414 }

Here is the call graph for this function:

int Wt::SDLSurface::blitAlphaCopy ( const SDLSurface src  )  [inherited]

copy to from src

Definition at line 408 of file sdlsurface.cpp.

References Wt::SDLSurface::height(), and Wt::SDLSurface::width().

Referenced by Wt::SDLSurface::blitAlphaCopy().

00408                                                    {
00409     return blitAlphaCopy(0, 0, src, SDLRect(0, 0, src.width(), src.height()));
00410 }

Here is the call graph for this function:

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

Definition at line 146 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::numBytes(), Wt::SDLSurface::pixelOffset(), and Wt::SDLSurface::scanLine().

00146                              {
00147         return sdl_surface->pitch;
00148     }

void Wt::SDLSurface::clearAlpha (  )  [inherited]

Definition at line 192 of file sdlsurface.cpp.

References Wt::SDLSurface::detach(), and Wt::SDLColor::Opaque.

00192                             {
00193     detach();
00194     SDL_SetAlpha(*this, 0, SDLColor::Opaque);
00195 }

Here is the call graph for this function:

void Wt::SDLSurface::clearTransparentColor (  )  [inherited]

Definition at line 182 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00182                                        {
00183     detach();
00184     SDL_SetColorKey(*this, 0, 0);
00185 }

Here is the call graph for this function:

SDLRect Wt::SDLSurface::clipRect (  )  const [inherited]

Definition at line 112 of file sdlsurface.cpp.

References Wt::deconst(), and Wt::SDLSurface::sdl_surface.

00112                                    {
00113     SDLRect r;
00114     SDL_GetClipRect(deconst(*this), r);
00115     assert(r == sdl_surface->clip_rect);
00116     return r;
00117 }

Here is the call graph for this function:

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

Definition at line 205 of file sdlsurface.h.

References Wt::SDLPixelFormat::palette(), and Wt::SDLSurface::pixelFormat().

Referenced by Wt::SDLSurface::setPixelColor(), and Wt::SDLSurface::setTransparentColor().

00205                                     {
00206         return pixelFormat().palette()[index];
00207     }

Here is the call graph for this function:

int Wt::SDLSurface::convertDepth ( int  new_depth  )  [inherited]

Definition at line 354 of file sdlsurface.cpp.

References Wt::SDLSurface::blit(), Wt::SDLSurface::height(), Wt::SDLSurface::sdl_surface, Wt::SDLSurface::SDLSurface(), and Wt::SDLSurface::width().

00354                                           {
00355     SDLSurface dst = SDLSurface(width(), height(), new_depth);
00356     if (dst) {
00357         dst.blit(*this);
00358         sdl_surface = dst;
00359         return 0;
00360     }
00361     return -1;
00362 }

Here is the call graph for this function:

int Wt::SDLSurface::convertTo ( const SDLSurface  src  )  [inherited]

Definition at line 329 of file sdlsurface.cpp.

References Wt::SDLSurface::flags(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::sdl_surface.

00329                                               {
00330     if (*this == src)
00331         return 0;
00332     /// \bug GCC bug. does not enfoce constness
00333     SDLPixelFormat f = src.pixelFormat();
00334     SDLSurface dst = SDL_ConvertSurface(*this, f, src.flags());
00335 
00336     if (dst) {
00337         sdl_surface = dst;
00338         return 0;
00339     }
00340 
00341     return -1;
00342 }

Here is the call graph for this function:

int Wt::SDLSurface::convertToDisplay (  )  [inherited]

Definition at line 344 of file sdlsurface.cpp.

References Wt::SDLSurface::sdl_surface.

00344                                  {
00345     SDLSurface dst = SDL_DisplayFormatAlpha(*this);
00346     if (dst) {
00347         sdl_surface = dst;
00348         return 0;
00349     }
00350 
00351     return -1;
00352 }

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

Definition at line 373 of file sdlsurface.cpp.

References Wt::Singleton< DERIVED >::instance().

00373                              {
00374     return SDLDisplay::instance()->depth();
00375 }

Here is the call graph for this function:

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

Definition at line 154 of file sdlsurface.h.

References Wt::SDLPixelFormat::bitsPerPixel(), and Wt::SDLSurface::pixelFormat().

Referenced by Wt::SDLSurface::blitAlphaCopy(), load(), and Wt::SDLSurface::onDepthChange().

00154                       {
00155         return pixelFormat().bitsPerPixel();
00156     }

Here is the call graph for this function:

void Wt::SDLSurface::detach (  )  [inherited]

Definition at line 51 of file sdlsurface.cpp.

References Wt::SDLSurface::flags(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::blit(), Wt::SDLSurface::clearAlpha(), Wt::SDLSurface::clearTransparentColor(), Wt::SDLSurface::fill(), Wt::SDLSurface::lock(), Wt::SDLSurface::setAlpha(), Wt::SDLSurface::setClipRect(), Wt::SDLSurface::setPalette(), Wt::SDLSurface::setTransparentColor(), and Wt::SDLSurface::unlock().

00051                         {
00052     //avoid detaching if we are the only client for this surface
00053     if (!sdl_surface.unique()) {
00054         /// \bug GCC bug. does not enfoce constness
00055         SDLPixelFormat f = pixelFormat();
00056         sdl_surface.reset(SDL_ConvertSurface(*this, f, flags()), Deleter());
00057     }
00058 }

Here is the call graph for this function:

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::existingInstance (  )  [inline, static, inherited]

Definition at line 36 of file singleton.h.

Referenced by Wt::Application::exit(), Wt::Application::postEvent(), Wt::Application::sendEvent(), and Wt::Application::sendPostedEvents().

00036                                        {
00037         return instance_;
00038     }

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

Definition at line 202 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00202                                               {
00203     SDLRect r = dst;
00204     detach();
00205     return SDL_FillRect(*this, r, v);
00206 }

Here is the call graph for this function:

int Wt::SDLSurface::fill ( int  v  )  [inherited]

Definition at line 197 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00197                           {
00198     detach();
00199     return SDL_FillRect(*this, 0, v);
00200 }

Here is the call graph for this function:

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

Definition at line 77 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::convertTo(), Wt::SDLSurface::detach(), hasDoubleBuffer(), hasFrame(), hasOpenGL(), hasOpenGLBlit(), isAnyFormat(), isFullScreen(), isResizable(), load(), Wt::SDLSurface::resize(), resize(), and Wt::SDLSurface::setPalette().

00077                       {
00078         return sdl_surface->flags;
00079     }

void Wt::SDLDisplay::flip (  ) 

If doublebuffered(), flip the surface and its buffer, otherwise update().

Definition at line 63 of file sdldisplay.cpp.

00063                       {
00064     SDL_Flip(*this);
00065 }

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

Definition at line 109 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::blitAlphaCopy(), and Wt::SDLSurface::isTransparent().

00109                           {
00110         return sdl_surface->flags & SDL_SRCALPHA;
00111     }

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

Definition at line 89 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00089                               {
00090         return sdl_surface->flags & SDL_ASYNCBLIT;
00091     }

bool Wt::SDLDisplay::hasDoubleBuffer (  )  const [inline]

Definition at line 52 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00052                                  {
00053         return flags() & SDL_DOUBLEBUF;
00054     }

Here is the call graph for this function:

bool Wt::SDLDisplay::hasFrame (  )  const [inline]

Definition at line 72 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00072                           {
00073         return !(flags() & SDL_NOFRAME);
00074     }

Here is the call graph for this function:

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

Definition at line 97 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00097                                    {
00098         return sdl_surface->flags & SDL_HWACCEL;
00099     }

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

Definition at line 93 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00093                               {
00094         return sdl_surface->flags & SDL_HWPALETTE;
00095     }

bool Wt::SDLDisplay::hasOpenGL (  )  const [inline]

Definition at line 60 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00060                            {
00061         return flags() & SDL_OPENGL;
00062     }

Here is the call graph for this function:

bool Wt::SDLDisplay::hasOpenGLBlit (  )  const [inline]

Definition at line 64 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00064                                {
00065         return flags() & SDL_OPENGLBLIT;
00066     }

Here is the call graph for this function:

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

Definition at line 105 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00105                               {
00106         return sdl_surface->flags & SDL_RLEACCEL;
00107     }

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

Definition at line 101 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::blitAlphaCopy(), and Wt::SDLSurface::isTransparent().

00101                                      {
00102         return sdl_surface->flags & SDL_SRCCOLORKEY;
00103     }

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

Definition at line 142 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::blitAlphaCopy(), Wt::SDLSurface::convertDepth(), Wt::SDLSurface::numBytes(), resize(), Wt::SDLSurface::scale_surface(), Wt::SDLSurface::scaleWidth(), and Wt::SDLSurface::SDLSurface().

00142                        {
00143         return sdl_surface->h;
00144     }

template<class DERIVED>
static void Wt::Singleton< DERIVED >::init (  )  [inline, static, inherited]

Note:
cannot fail

Reimplemented in Wt::Application.

Definition at line 49 of file singleton.h.

Referenced by Wt::Application::Application().

00049                        {
00050         if (!instance()) {
00051             assert(0);
00052         }
00053     }

template<class DERIVED>
template<class GRANDCHILD>
static DERIVED* Wt::Singleton< DERIVED >::instance (  )  [inline, static, inherited]

instantiates the pointer compatible child of DERIVED aka grandchild

it is handy in driver like situations

Definition at line 43 of file singleton.h.

00043                                {
00044         return (instance_) ? instance_ : GRANDCHILD::load();
00045     }

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::instance (  )  [inline, static, inherited]

Definition at line 32 of file singleton.h.

Referenced by Wt::Audio::Audio(), Wt::Sound::available(), Wt::SDLMixer::Chunk::channel(), Wt::NullAudio::Chunk::channel(), Wt::SDLSurface::defaultDepth(), Wt::SDLInput::EventInfo::EventInfo(), Wt::Dialog::exec(), Wt::Widget::grabKeyboard(), Wt::Widget::grabMouse(), Wt::Audio::handleAudioEvent(), Wt::SDLInput::handleKeyEvent(), Wt::Singleton< Wt::Audio >::init(), Wt::SDLTimer::init(), Wt::Sound::isAvailable(), Wt::Widget::keyboardGrabber(), Wt::Audio::load(), Wt::Widget::mouseGrabber(), Wt::SDLMixer::onChannelFinish(), Wt::Audio::onChannelFinish(), Wt::Sound::play(), Wt::Singleton< Wt::Audio >::quit(), Wt::Widget::releaseKeyboard(), Wt::Widget::releaseMouse(), Wt::SDLInput::SDLInput(), Wt::SDLMixer::setMusicVolume(), Wt::SDLMixer::Channel::setVolume(), and Wt::SDLMixer::Chunk::setVolume().

00032                                {
00033         return (instance_) ? instance_ : DERIVED::load();
00034     }

bool Wt::SDLDisplay::isAnyFormat (  )  const [inline]

Definition at line 48 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00048                              {
00049         return flags() & SDL_ANYFORMAT ;
00050     }

Here is the call graph for this function:

bool Wt::SDLDisplay::isFullScreen (  )  const [inline]

Definition at line 56 of file sdldisplay.h.

References Wt::SDLSurface::flags().

00056                               {
00057         return flags() & SDL_FULLSCREEN;
00058     }

Here is the call graph for this function:

bool Wt::SDLSurface::isGrayscale (  )  const [inherited]

Definition at line 161 of file sdlsurface.cpp.

References Wt::SDLSurface::numColors(), Wt::SDLPixelFormat::palette(), and Wt::SDLSurface::pixelFormat().

00161                                    {
00162     SDLPalette pal = pixelFormat().palette();
00163     if (pal) {
00164         int n = numColors();
00165         for (int i = 0; i < n; i++) {
00166             SDLColor c = pal[i];
00167             if (c.red() != c.green() || c.green() != c.blue())
00168                 return false;
00169         }
00170         return true;
00171     } else {}
00172 
00173     return false;
00174 }

Here is the call graph for this function:

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

Definition at line 85 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00085                              {
00086         return sdl_surface->flags & SDL_HWSURFACE;
00087     }

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

Definition at line 126 of file sdlsurface.h.

References Wt::SDLSurface::isTransparent().

00126                           {
00127         return !isTransparent();
00128     }

Here is the call graph for this function:

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

Definition at line 130 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00130                                 {
00131         return sdl_surface->flags & SDL_PREALLOC;
00132     }

bool Wt::SDLDisplay::isResizable (  )  const [inline]

Definition at line 68 of file sdldisplay.h.

References Wt::SDLSurface::flags().

Referenced by resize().

00068                              {
00069         return flags() & SDL_RESIZABLE;
00070     }

Here is the call graph for this function:

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

Definition at line 81 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00081                              {
00082         return sdl_surface->flags & SDL_SWSURFACE;
00083     }

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

There are 3 mechanisms of transparency

Definition at line 120 of file sdlsurface.h.

References Wt::SDLSurface::alpha(), Wt::SDLSurface::hasAlpha(), Wt::SDLSurface::hasTransparentColor(), Wt::SDLColor::Opaque, and Wt::SDLSurface::pixelFormat().

Referenced by Wt::SDLSurface::isOpaque().

00120                                {
00121         return (hasTransparentColor() ||
00122                 (hasAlpha() &&
00123                  (pixelFormat().alphaMask() || alpha() != SDLColor::Opaque)));
00124     }

Here is the call graph for this function:

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::load (  )  [inline, static, protected, inherited]

try to load the instance

if it fails return NULL if it succeeds must return the newly created object

Reimplemented in Wt::Audio, Wt::NullAudio, and Wt::SDLMixer.

Definition at line 86 of file singleton.h.

00086                            {
00087         instance_ = new DERIVED;
00088         return  instance_;
00089     }

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

load an image from mem

Definition at line 319 of file sdlsurface.cpp.

References Wt::SDLSurface::sdl_surface.

00319                                                 {
00320     SDLSurface dst = IMG_Load_RW(SDL_RWFromConstMem(p, size), 1);
00321 
00322     if (dst) {
00323         sdl_surface = dst;
00324         return true;
00325     }
00326     return false;
00327 }

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

load an image from a file

Definition at line 309 of file sdlsurface.cpp.

References Wt::SDLSurface::sdl_surface.

00309                                                {
00310     SDLSurface dst = IMG_Load_RW(SDL_RWFromFile(filename.c_str(), "rb"), 1);
00311 
00312     if (dst) {
00313         sdl_surface = dst;
00314         return true;
00315     }
00316     return false;
00317 }

SDLDisplay * Wt::SDLDisplay::load ( int  w = defaultWidth,
int  h = defaultHeight,
int  depth = defaultDepth,
int  flags = 0 
) [static, protected]

Definition at line 27 of file sdldisplay.cpp.

References Wt::W::DefaultDisplayPixmapFlags, Wt::SDLSurface::depth(), Wt::SDLSurface::flagMap, Wt::SDLSurface::flags(), Wt::Singleton< DERIVED >::instance_, SDLDisplay(), and Wt::FlagMap::state().

00027                                                                {
00028     SDLSurface s = SDL_SetVideoMode(w, h, depth,
00029                                     flagMap.state(flags ? flags
00030                                               : static_cast<int>(W::DefaultDisplayPixmapFlags)));
00031     instance_ = (s) ? new SDLDisplay(s) : 0;
00032     return instance_;
00033 }

Here is the call graph for this function:

int Wt::SDLSurface::lock (  )  [inherited]

Definition at line 100 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00100                      {
00101     detach()
00102     ;
00103     return SDL_LockSurface(*this);
00104 }

Here is the call graph for this function:

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

Definition at line 182 of file sdlsurface.h.

References Wt::SDLSurface::bytesPerLine(), Wt::SDLPixelFormat::bytesPerPixel(), Wt::SDLSurface::height(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::width().

00182                             {
00183         //return height() * pitch();
00184         return (height() - 1) * bytesPerLine() +
00185                width() * pixelFormat().bytesPerPixel();
00186     }

Here is the call graph for this function:

int Wt::SDLSurface::numColors (  )  const [inherited]

Definition at line 140 of file sdlsurface.cpp.

References Wt::SDLPixelFormat::palette(), Wt::SDLSurface::pixelFormat(), and Wt::SDLPalette::size().

Referenced by Wt::SDLSurface::isGrayscale(), and Wt::SDLSurface::setNumColors().

00140                                 {
00141     SDLPalette pal = pixelFormat().palette();
00142     return (pal) ? pal.size() :  0;
00143 }

Here is the call graph for this function:

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

Definition at line 469 of file sdlsurface.cpp.

References Wt::SDLSurface::depth(), Wt::SDLSurface::read_pixel, Wt::SDLSurface::readPixel16bpp(), Wt::SDLSurface::readPixel24bpp(), Wt::SDLSurface::readPixel32bpp(), Wt::SDLSurface::readPixel8bpp(), Wt::SDLSurface::write_pixel, Wt::SDLSurface::writePixel16bpp(), Wt::SDLSurface::writePixel24bpp(), Wt::SDLSurface::writePixel32bpp(), and Wt::SDLSurface::writePixel8bpp().

Referenced by Wt::SDLSurface::SDLSurface().

00469                                {
00470     // don't crash on NULL surfaces
00471     if (!*this)
00472         return;
00473     switch (depth()) {
00474     case 0:
00475         read_pixel = 0;
00476         write_pixel = 0;
00477         assert(0);
00478         break;
00479     case 8:
00480         read_pixel = &SDLSurface::readPixel8bpp;
00481         write_pixel = &SDLSurface::writePixel8bpp;
00482         break;
00483     case 16:
00484         read_pixel = &SDLSurface::readPixel16bpp;
00485         write_pixel = &SDLSurface::writePixel16bpp;
00486         break;
00487     case 24:
00488         read_pixel = &SDLSurface::readPixel24bpp;
00489         write_pixel = &SDLSurface::writePixel24bpp;
00490         break;
00491     case 32:
00492         read_pixel = &SDLSurface::readPixel32bpp;
00493         write_pixel = &SDLSurface::writePixel32bpp;
00494         break;
00495     default:
00496         assert(0);
00497         break;
00498     }
00499 }

Here is the call graph for this function:

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

Definition at line 67 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00067                                          {
00068         return sdl_surface.get();
00069     }

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

Definition at line 71 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00071                               {
00072         return sdl_surface.get();
00073     }

SDLDisplay& Wt::SDLDisplay::operator= ( const SDLDisplay  )  [private]

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

Definition at line 286 of file sdlsurface.h.

References Wt::SDLSurface::pixel(), and Wt::SDLSurface::pixelOffset().

00286                                   {
00287         return pixel(pixelOffset(x, y));
00288     }

Here is the call graph for this function:

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

Definition at line 278 of file sdlsurface.h.

References Wt::SDLSurface::read_pixel.

Referenced by Wt::SDLSurface::pixel(), Wt::SDLSurface::pixelColor(), and Wt::SDLSurface::readPixel24bpp().

00278                                       {
00279         return (this->*read_pixel)(pixel_offset);
00280     }

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

Definition at line 174 of file sdlsurface.h.

References Wt::SDLSurface::pixelOffset(), and Wt::SDLSurface::pixels().

00174                                            {
00175         return (Uint8 *) pixels() + pixelOffset(x, y);
00176     }

Here is the call graph for this function:

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

Definition at line 170 of file sdlsurface.h.

References Wt::SDLSurface::pixels().

Referenced by Wt::SDLSurface::readPixel16bpp(), Wt::SDLSurface::readPixel24bpp(), Wt::SDLSurface::readPixel32bpp(), Wt::SDLSurface::readPixel8bpp(), Wt::SDLSurface::scanLine(), Wt::SDLSurface::writePixel16bpp(), Wt::SDLSurface::writePixel24bpp(), Wt::SDLSurface::writePixel32bpp(), and Wt::SDLSurface::writePixel8bpp().

00170                                                {
00171         return (Uint8 *) pixels() + pixel_offset;
00172     }

Here is the call graph for this function:

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

Definition at line 290 of file sdlsurface.h.

References Wt::SDLPixelFormat::mapToColor(), Wt::SDLSurface::pixel(), and Wt::SDLSurface::pixelFormat().

00290                                             {
00291         return pixelFormat().mapToColor((pixel(x, y)));
00292     }

Here is the call graph for this function:

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

Definition at line 282 of file sdlsurface.h.

References Wt::SDLPixelFormat::mapToColor(), Wt::SDLSurface::pixel(), and Wt::SDLSurface::pixelFormat().

00282                                                 {
00283         return pixelFormat().mapToColor((pixel(pixel_offset)));
00284     }

Here is the call graph for this function:

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

Definition at line 134 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::alpha(), Wt::SDLSurface::blitAlphaCopy(), Wt::SDLSurface::color(), Wt::SDLSurface::convertTo(), Wt::SDLSurface::depth(), Wt::SDLSurface::detach(), Wt::SDLSurface::isGrayscale(), Wt::SDLSurface::isTransparent(), Wt::SDLSurface::numBytes(), Wt::SDLSurface::numColors(), Wt::SDLSurface::pixelColor(), Wt::SDLSurface::pixelOffset(), Wt::SDLSurface::readPixel24bpp(), Wt::SDLSurface::resize(), resize(), Wt::SDLSurface::setNumColors(), Wt::SDLSurface::setPixelColor(), Wt::SDLSurface::setTransparentColor(), Wt::SDLSurface::transparentColor(), and Wt::SDLSurface::writePixel24bpp().

00134                                              {
00135         return sdl_surface->format;
00136     }

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

Definition at line 166 of file sdlsurface.h.

References Wt::SDLSurface::bytesPerLine(), Wt::SDLPixelFormat::bytesPerPixel(), and Wt::SDLSurface::pixelFormat().

Referenced by Wt::SDLSurface::pixel(), Wt::SDLSurface::pixelAddress(), and Wt::SDLSurface::setPixel().

00166                                         {
00167         return y * bytesPerLine() + x * pixelFormat().bytesPerPixel();
00168     }

Here is the call graph for this function:

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

Definition at line 158 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

00158                    {
00159         return sdl_surface->pixels;
00160     }

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

Definition at line 150 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::bits(), and Wt::SDLSurface::pixelAddress().

00150                                {
00151         return sdl_surface->pixels;
00152     }

template<class DERIVED>
static void Wt::Singleton< DERIVED >::quit (  )  [inline, static, inherited]

Reimplemented in Wt::Application.

Definition at line 55 of file singleton.h.

Referenced by Wt::Application::~Application().

00055                        {
00056         delete instance();
00057     }

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

Definition at line 424 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00424                                                      {
00425     return * (Uint16 *) pixelAddress(pixel_offset);
00426 }

Here is the call graph for this function:

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

Definition at line 432 of file sdlsurface.cpp.

References Wt::SDLPixelFormat::blueShift(), Wt::SDLPixelFormat::greenShift(), Wt::SDLSurface::pixel(), Wt::SDLSurface::pixelAddress(), Wt::SDLSurface::pixelFormat(), and Wt::SDLPixelFormat::redShift().

Referenced by Wt::SDLSurface::onDepthChange().

00432                                                      {
00433     Uint8* screen_loc = (Uint8 *) pixelAddress(pixel_offset);
00434     const SDLPixelFormat f = pixelFormat();
00435     Uint32 pixel = 0;
00436     int shift;
00437 
00438     // I´m not sure on this, Karsten 01/1999
00439     shift = f.redShift();
00440     pixel = *(screen_loc + shift / 8) << shift;
00441     shift = f.greenShift();
00442     pixel |= *(screen_loc + shift / 8) << shift;
00443     shift = f.blueShift();
00444     pixel |= *(screen_loc + shift / 8) << shift;
00445     return pixel;
00446 }

Here is the call graph for this function:

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

Definition at line 461 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00461                                                      {
00462     return * (Uint32 *) pixelAddress(pixel_offset);
00463 }

Here is the call graph for this function:

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

Definition at line 416 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00416                                                     {
00417     return * (Uint8 *) pixelAddress(pixel_offset);
00418 }

Here is the call graph for this function:

void Wt::SDLDisplay::resize ( int  w,
int  h 
)

resize the SDL window

Note:
first we delete our reference to VideoSurface before SDL frees it under our feet SDL proctects us from deleting the Display surface and auto deletes it in case we call SDL_SetVideoMode, However SDL does not protect against deletion of the previous VideoSurface.

Reimplemented from Wt::SDLSurface.

Definition at line 82 of file sdldisplay.cpp.

References Wt::SDLPixelFormat::bitsPerPixel(), Wt::SDLSurface::flags(), Wt::SDLSurface::height(), isResizable(), Wt::SDLSurface::pixelFormat(), Wt::SDLSurface::SDLSurface(), trace, and Wt::SDLSurface::width().

00082                                     {
00083     if(!isResizable() || (w == width() && h == height()) || (!w && !h))
00084         return;
00085     SDLSurface& self = *this;
00086     trace("sdlsurface", "Resizing %p to %d x %d\n",
00087           static_cast<SDL_Surface *>(self), w, h);
00088 
00089     /*!\note first we delete our reference to VideoSurface
00090     before SDL frees it under our feet 
00091     SDL proctects us from deleting the Display surface and
00092     auto deletes it in case we call SDL_SetVideoMode, However
00093     SDL does not protect against deletion of the previous
00094     VideoSurface.
00095     */
00096     // first save intersting parameters
00097     int bpp = pixelFormat().bitsPerPixel();
00098     int fl = flags();
00099     self = SDLSurface();
00100     // now set it the resized surface
00101     self = SDL_SetVideoMode(w, h, bpp, fl);
00102 }

Here is the call graph for this function:

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

Definition at line 519 of file sdlsurface.cpp.

References Wt::SDLSurface::scale_surface().

00519                                                                {
00520     return scale_surface(w, h, false, mode);
00521 }

Here is the call graph for this function:

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

Definition at line 501 of file sdlsurface.cpp.

References Wt::deconst(), Wt::SDLSurface::height(), Wt::SDLSurface::ScaleFree, Wt::SDLSurface::ScaleMax, Wt::SDLSurface::ScaleMin, Wt::SDLSurface::SDLSurface(), and Wt::SDLSurface::width().

Referenced by Wt::SDLSurface::scale(), Wt::SDLSurface::scaleHeight(), Wt::SDLSurface::scaleWidth(), and Wt::SDLSurface::smoothScale().

00502                                                                         {
00503     if (mode != ScaleFree && (width() * h != height() * w)) {
00504         double r1 = static_cast<double>(width()) /
00505                     static_cast<double>(height());
00506         double r2 = static_cast<double>(w) /
00507                     static_cast<double>(h);
00508         if ( (mode == ScaleMin & (r2 > r1)) || (mode == ScaleMax & (r2 < r1)) )
00509             w = static_cast<int>(h * r1);
00510         if ( (mode == ScaleMin & (r2 < r1)) || (mode == ScaleMax & (r2 > r1)) )
00511             h = static_cast<int>(w / r1);
00512     }
00513     double zx =  static_cast<double>(w) / static_cast<double>(width());
00514     double zy =  static_cast<double>(h) / static_cast<double>(height());
00515 
00516     return SDLSurface(zoomSurface(deconst(*this), zx, zy, smooth));
00517 }

Here is the call graph for this function:

SDLSurface Wt::SDLSurface::scaleHeight ( int  h  )  const [inherited]

Definition at line 531 of file sdlsurface.cpp.

References Wt::SDLSurface::scale_surface(), Wt::SDLSurface::ScaleFree, and Wt::SDLSurface::width().

00531                                               {
00532     return scale_surface(width(), h, false, ScaleFree);
00533 }

Here is the call graph for this function:

SDLSurface Wt::SDLSurface::scaleWidth ( int  w  )  const [inherited]

Definition at line 527 of file sdlsurface.cpp.

References Wt::SDLSurface::height(), Wt::SDLSurface::scale_surface(), and Wt::SDLSurface::ScaleFree.

00527                                              {
00528     return scale_surface(w, height(), false, ScaleFree);
00529 }

Here is the call graph for this function:

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

Definition at line 178 of file sdlsurface.h.

References Wt::SDLSurface::bytesPerLine(), and Wt::SDLSurface::pixelAddress().

00178                           {
00179         return pixelAddress(y * bytesPerLine());
00180     }

Here is the call graph for this function:

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

Definition at line 188 of file sdlsurface.h.

00188                              {
00189         return reinterpret_cast<int>(
00190                    static_cast<const SDL_Surface *>(*this));
00191     }

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

Definition at line 187 of file sdlsurface.cpp.

References Wt::SDLSurface::alpha(), and Wt::SDLSurface::detach().

00187                                    {
00188     detach();
00189     SDL_SetAlpha(*this, SDL_SRCALPHA, alpha);
00190 }

Here is the call graph for this function:

SDLRect Wt::SDLSurface::setClipRect ( const SDLRect rect  )  [inherited]

Definition at line 119 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00119                                                    {
00120     SDLRect r = rect;
00121     detach();
00122     SDL_SetClipRect(*this, r);
00123     return r;
00124 }

Here is the call graph for this function:

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

Definition at line 135 of file sdlsurface.cpp.

References Wt::SDLSurface::setPalette().

00135                                                   {
00136     std::vector<SDLColor> ca(1, c);
00137     setPalette(ca, i);
00138 }

Here is the call graph for this function:

int Wt::SDLDisplay::setGamma ( float  red,
float  green,
float  blue 
)

Definition at line 67 of file sdldisplay.cpp.

00067                                                   {
00068     return SDL_SetGamma(r, g, b);
00069 }

int Wt::SDLDisplay::setGammaRamp ( const std::vector< Uint16 > &  red,
const std::vector< Uint16 > &  green,
const std::vector< Uint16 > &  blue 
)

???

Definition at line 71 of file sdldisplay.cpp.

00073                                                             {
00074 
00075     return SDL_SetGammaRamp(&red[0], &green[0], &blue[0]);
00076 }

void Wt::SDLSurface::setNumColors ( int  ncolors  )  [inherited]

Definition at line 145 of file sdlsurface.cpp.

References Wt::SDLSurface::numColors(), Wt::SDLPixelFormat::palette(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::setPalette().

00145                                          {
00146     int old = numColors();
00147 
00148     if (ncolors < old) {
00149         SDLPalette pal = pixelFormat().palette();
00150         std::vector<SDLColor> ca;
00151         ca.reserve(ncolors);
00152         for (int i = 0; i < ncolors; i++)
00153             ca[i] = pal[i];
00154         setPalette(ca, 0);
00155     } else if (ncolors > old) {
00156         std::vector<SDLColor> ca(ncolors - old, SDLColor());
00157         setPalette(ca, old);
00158     }
00159 }

Here is the call graph for this function:

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

Definition at line 126 of file sdlsurface.cpp.

References Wt::SDLSurface::detach(), and Wt::SDLSurface::flags().

Referenced by Wt::SDLSurface::setColor(), and Wt::SDLSurface::setNumColors().

00127                                                    {
00128     //SDL breakage
00129     SDL_Color *colors = const_cast<SDL_Color *>(
00130                             reinterpret_cast<const SDL_Color *>(&ca[0]));
00131     detach();
00132     SDL_SetPalette(*this, flags, colors, offset, ca.size());
00133 }

Here is the call graph for this function:

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

Definition at line 302 of file sdlsurface.h.

References Wt::SDLSurface::pixelOffset(), and Wt::SDLSurface::setPixel().

00302                                                  {
00303         setPixel(pixelOffset(x, y), pixel_value);
00304     }

Here is the call graph for this function:

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

Definition at line 294 of file sdlsurface.h.

References Wt::SDLSurface::write_pixel.

Referenced by Wt::SDLSurface::setPixel(), and Wt::SDLSurface::setPixelColor().

00294                                                      {
00295         (this->*write_pixel)(pixel_offset, pixel_value);
00296     }

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

Definition at line 306 of file sdlsurface.h.

References Wt::SDLSurface::color(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::setPixel().

00306                                                             {
00307         setPixel(x, y, pixelFormat().mapToPixelValue(color));
00308     }

Here is the call graph for this function:

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

Definition at line 298 of file sdlsurface.h.

References Wt::SDLSurface::color(), Wt::SDLSurface::pixelFormat(), and Wt::SDLSurface::setPixel().

00298                                                                 {
00299         setPixel(pixel_offset, pixelFormat().mapToPixelValue(color));
00300     }

Here is the call graph for this function:

void Wt::SDLSurface::setTransparentColor ( const SDLColor color = SDLColor()  )  [inherited]

Definition at line 176 of file sdlsurface.cpp.

References Wt::SDLSurface::color(), Wt::SDLSurface::detach(), and Wt::SDLSurface::pixelFormat().

00176                                                           {
00177     detach();
00178     SDL_SetColorKey(*this, SDL_SRCCOLORKEY | SDL_RLEACCEL,
00179                     pixelFormat().mapToPixelValue(color));
00180 }

Here is the call graph for this function:

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

Definition at line 523 of file sdlsurface.cpp.

References Wt::SDLSurface::scale_surface().

00523                                                                      {
00524     return scale_surface(w, h, true, mode);
00525 }

Here is the call graph for this function:

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

Determines the bit order of the display hardware.

Definition at line 318 of file sdlsurface.h.

00318                                 {
00319         return SDL_BYTEORDER;
00320     }

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

Determines the byte order of the display hardware.

Definition at line 313 of file sdlsurface.h.

00313                                  {
00314         return SDL_BYTEORDER;
00315     }

int Wt::SDLDisplay::toggleFullScreen (  ) 

returns true if the surface is full screen

Definition at line 78 of file sdldisplay.cpp.

00078                                  {
00079     return SDL_WM_ToggleFullScreen(*this);
00080 }

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

Definition at line 218 of file sdlsurface.h.

References Wt::SDLSurface::pixelFormat(), and Wt::SDLPixelFormat::transparentColor().

00218                                       {
00219         return pixelFormat().transparentColor();
00220     }

Here is the call graph for this function:

int Wt::SDLSurface::unlock (  )  [inherited]

Definition at line 106 of file sdlsurface.cpp.

References Wt::SDLSurface::detach().

00106                        {
00107     detach();
00108     SDL_UnlockSurface(*this);
00109     return 0;
00110 }

Here is the call graph for this function:

void Wt::SDLDisplay::update ( const std::vector< SDLRect > &  rects  ) 

Update a region on the surface.

Definition at line 54 of file sdldisplay.cpp.

00054                                                        {
00055     if (!rects.size()) // could cause a problem with zero size array
00056         return;
00057 
00058     const SDL_Rect *rc = rects[0];
00059     SDL_Rect *r = const_cast<SDL_Rect *>(rc);
00060     SDL_UpdateRects(*this, rects.size(), r);
00061 }

void Wt::SDLDisplay::update ( const SDLRect rect  ) 

Update a rectangle on the surface.

Definition at line 50 of file sdldisplay.cpp.

References Wt::SDLRect::height(), Wt::SDLRect::width(), Wt::SDLRect::x(), and Wt::SDLRect::y().

00050                                         {
00051     SDL_UpdateRect(*this, r.x(), r.y(), r.width(), r.height());
00052 }

Here is the call graph for this function:

void Wt::SDLDisplay::update (  ) 

Update the surface.

Definition at line 46 of file sdldisplay.cpp.

00046                         {
00047     SDL_UpdateRect(*this, 0, 0, 0, 0);
00048 }

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

Definition at line 138 of file sdlsurface.h.

References Wt::SDLSurface::sdl_surface.

Referenced by Wt::SDLSurface::blitAlphaCopy(), Wt::SDLSurface::convertDepth(), Wt::SDLSurface::numBytes(), resize(), Wt::SDLSurface::scale_surface(), Wt::SDLSurface::scaleHeight(), and Wt::SDLSurface::SDLSurface().

00138                       {
00139         return sdl_surface->w;
00140     }

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

Definition at line 428 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00428                                                                   {
00429     * (Uint16 *) pixelAddress(pixel_offset) = pixel_value;
00430 }

Here is the call graph for this function:

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

Definition at line 448 of file sdlsurface.cpp.

References Wt::SDLPixelFormat::blueShift(), Wt::SDLPixelFormat::greenShift(), Wt::SDLSurface::pixelAddress(), Wt::SDLSurface::pixelFormat(), and Wt::SDLPixelFormat::redShift().

Referenced by Wt::SDLSurface::onDepthChange().

00448                                                                   {
00449     Uint8* screen_loc = (Uint8 *) pixelAddress(pixel_offset);
00450     int shift;
00451     const SDLPixelFormat f = pixelFormat();
00452 
00453     shift = f.redShift();
00454     *(screen_loc + shift / 8) =  pixel_value >> shift;
00455     shift = f.greenShift();
00456     *(screen_loc + shift / 8) =  pixel_value >> shift;
00457     shift = f.blueShift();
00458     *(screen_loc + shift / 8) =  pixel_value >> shift;
00459 }

Here is the call graph for this function:

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

Definition at line 465 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00465                                                                   {
00466     * (Uint32 *) pixelAddress(pixel_offset) = pixel_value;
00467 }

Here is the call graph for this function:

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

Definition at line 420 of file sdlsurface.cpp.

References Wt::SDLSurface::pixelAddress().

Referenced by Wt::SDLSurface::onDepthChange().

00420                                                                  {
00421     * (Uint8 *) pixelAddress(pixel_offset) = pixel_value;
00422 }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class Singleton< SDLDisplay > [friend]

Definition at line 32 of file sdldisplay.h.


Member Data Documentation

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

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)

Definition at line 336 of file sdlsurface.h.

Referenced by load().

template<class DERIVED>
DERIVED * Wt::Singleton< DERIVED >::instance_ = 0 [static, protected, inherited]

Definition at line 91 of file singleton.h.

Referenced by Wt::Singleton< Wt::Audio >::existingInstance(), Wt::Singleton< Wt::Audio >::instance(), Wt::Singleton< Wt::Audio >::load(), load(), Wt::Audio::load(), Wt::Singleton< Wt::Audio >::Singleton(), and Wt::Singleton< Wt::Audio >::~Singleton().


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

Generated Fri Jul 28 19:32:20 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.