Advanced Strategic Command
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Surface Class Reference

#include <surface.h>

Inheritance diagram for Surface:
Inheritance graph
[legend]

Public Member Functions

 Surface (SDL_Surface *surface)
 
 Surface (const SDLmm::Surface &other)
 
 Surface ()
 
Surface Duplicate () const
 
void newFromBGI (void *img)
 Creates an image from an BGI image structure. More...
 
void * toBGI () const
 
void FillTransparent ()
 
void read (tnstream &stream)
 
void readImageFile (tnstream &stream)
 
void write (tnstream &stream) const
 
void strech (int width, int height)
 
void writeDefaultPixelFormat (tnstream &stream)
 
void assignDefaultPalette ()
 assigns the default ASC palette to the surface (only for 8 Bit surfaces) More...
 
void assignPalette (SDL_Color *colors, int startColor=0, int colorNum=256)
 
void detectColorKey (bool RLE=false)
 tries to automatically detect the color key of the surface More...
 
bool isTransparent (SDLmm::Color col) const
 
void ColorKey2AlphaChannel ()
 
bool hasAlpha ()
 
int getMemoryFootprint () const
 
SDL_Surface * getBaseSurface ()
 
const SDL_Surface * getBaseSurface () const
 
 ~Surface ()
 

Static Public Member Functions

static Surface createSurface (int width, int height, SDLmm::Color color=255)
 
static Surface createSurface (int width, int height, int depth, SDLmm::Color color=0xff0000ff)
 
static Surface Wrap (SDL_Surface *surface)
 
static void SetScreen (SDL_Surface *screen)
 
static void readDefaultPixelFormat (tnstream &stream)
 

Static Public Attributes

static const Uint32 transparent = 0
 
static const Uint32 opaque = 255l
 

Protected Member Functions

virtual int getDepthFormat ()
 
void convert ()
 

Detailed Description

Definition at line 62 of file surface.h.

Constructor & Destructor Documentation

Surface::Surface ( SDL_Surface *  surface)
explicit

Definition at line 145 of file surface.cpp.

References convert().

Surface::Surface ( const SDLmm::Surface &  other)

Definition at line 198 of file surface.cpp.

References convert().

Surface::Surface ( )
inline

Definition at line 69 of file surface.h.

Referenced by Wrap().

Surface::~Surface ( )

Definition at line 531 of file surface.cpp.

Member Function Documentation

void Surface::assignDefaultPalette ( )

assigns the default ASC palette to the surface (only for 8 Bit surfaces)

Definition at line 429 of file surface.cpp.

References pal.

Referenced by copy2screen(), createSurface(), loadASCFieldImageArray(), MapDisplayPG::MapDisplayPG(), read(), VehicleType::runTextIO(), and strech().

void Surface::assignPalette ( SDL_Color *  colors,
int  startColor = 0,
int  colorNum = 256 
)

Definition at line 444 of file surface.cpp.

void Surface::ColorKey2AlphaChannel ( )

Definition at line 734 of file surface.cpp.

References transparent.

Referenced by loadASCFieldImageArray().

void Surface::convert ( )
protected

Definition at line 151 of file surface.cpp.

References createSurface().

Referenced by read(), readImageFile(), and Surface().

Surface Surface::createSurface ( int  width,
int  height,
SDLmm::Color  color = 255 
)
static
Surface Surface::createSurface ( int  width,
int  height,
int  depth,
SDLmm::Color  color = 0xff0000ff 
)
static

Definition at line 394 of file surface.cpp.

References assignDefaultPalette().

void Surface::detectColorKey ( bool  RLE = false)

tries to automatically detect the color key of the surface

Definition at line 493 of file surface.cpp.

References hasAlpha().

Referenced by applyFieldMask(), applyLegacyFieldMask(), loadASCFieldImageArray(), rotateSurface(), and strech().

Surface Surface::Duplicate ( ) const

Definition at line 85 of file surface.cpp.

References nullParam.

Referenced by OverviewMapHolder::drawNextField(), and rotateSurface().

void Surface::FillTransparent ( )

Definition at line 419 of file surface.cpp.

Referenced by BuildingItem::display(), and StoringPosition::eventDraw().

SDL_Surface* Surface::getBaseSurface ( )
inline
const SDL_Surface* Surface::getBaseSurface ( ) const
inline

Definition at line 117 of file surface.h.

virtual int Surface::getDepthFormat ( )
inlineprotectedvirtual

Reimplemented in TypedSurface< colorDepth >.

Definition at line 120 of file surface.h.

int Surface::getMemoryFootprint ( ) const

Definition at line 716 of file surface.cpp.

References getBaseSurface().

Referenced by VehicleType::getMemoryFootprint().

bool Surface::hasAlpha ( )

Definition at line 476 of file surface.cpp.

Referenced by applyLegacyFieldMask(), and detectColorKey().

bool Surface::isTransparent ( SDLmm::Color  col) const

Definition at line 515 of file surface.cpp.

References opaque.

Referenced by OverviewMapImage::create().

void Surface::newFromBGI ( void *  img)

Creates an image from an BGI image structure.

void Surface::read ( tnstream stream)
void Surface::readDefaultPixelFormat ( tnstream stream)
static

Definition at line 205 of file surface.cpp.

References readSDLPixelFormat().

void Surface::readImageFile ( tnstream stream)

Definition at line 380 of file surface.cpp.

References convert(), and SDL_RWFromStream().

Referenced by CargoDialog::CargoDialog(), and UnitInfoDialog::UnitInfoDialog().

void Surface::SetScreen ( SDL_Surface *  screen)
static

Definition at line 78 of file surface.cpp.

Referenced by ASC_PG_App::InitScreen().

void Surface::strech ( int  width,
int  height 
)
void * Surface::toBGI ( ) const

Definition at line 702 of file surface.cpp.

References imagesize(), and malloc().

static Surface Surface::Wrap ( SDL_Surface *  surface)
inlinestatic
void Surface::write ( tnstream stream) const
void Surface::writeDefaultPixelFormat ( tnstream stream)

Definition at line 211 of file surface.cpp.

Member Data Documentation

const Uint32 Surface::opaque = 255l
static
const Uint32 Surface::transparent = 0
static

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