Surface Class Reference

#include <surface.h>

Inheritance diagram for Surface:

Inheritance graph
[legend]
List of all members.

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.
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)
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
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

Surface Surface::Duplicate (  )  const

Definition at line 85 of file surface.cpp.

References nullParam.

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

Surface Surface::createSurface ( int  width,
int  height,
SDLmm::Color  color = 255 
) [static]

Definition at line 387 of file surface.cpp.

Referenced by applyLegacyFieldMask(), GuiFunctions::buildGuiIcon(), convert(), MapDisplayPG::createMovementBufferSurface(), VehicleBaseWidget::display(), VehicleTypeBaseWidget::display(), VehicleTypeImage::display(), BuildingItem::display(), TechWidget::display(), BuildingTypeBaseWidget::display(), MapComponent::displayClip(), StoringPosition::eventMouseMotion(), GuiFunctions::generate_gui_build_icon(), Vehicle::getImage(), Building::getImage(), initASCGraphicSubsystem(), loadASCFieldImageArray(), loadmapfromstream(), BuildingType::runTextIO(), MapDisplayPG::setNewZoom(), StoringPosition::StoringPosition(), ASCImageArrayProperty::toString(), WholeMapRenderer::WholeMapRenderer(), and writemaptostream().

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

Definition at line 394 of file surface.cpp.

References assignDefaultPalette().

static Surface Surface::Wrap ( SDL_Surface *  surface  )  [inline, static]

Definition at line 76 of file surface.h.

References Surface().

Referenced by MapDisplayPG::blitInternalSurface(), MapDisplayPG::displayMovementStep(), Emboss::eventBlit(), MainScreenWidget::eventBlit(), DamageBarWidget::eventBlit(), GraphWidget::eventBlit(), SelectionItemWidget::eventDraw(), ExperienceOverview::eventDraw(), DiplomaticModeChooser< SelectionType >::eventDraw(), MapDisplayPG::MapDisplayPG(), Weathercast::painter(), OverviewMapPanel::painter(), WeaponInfoLine::painter(), DashboardPanel::painter(), AttackPanel::painter(), and Weathercast::paintWeatherArea().

void Surface::SetScreen ( SDL_Surface *  screen  )  [static]

Definition at line 78 of file surface.cpp.

Referenced by ASC_PG_App::InitScreen().

void Surface::newFromBGI ( void *  img  ) 

Creates an image from an BGI image structure.

void * Surface::toBGI (  )  const

Definition at line 702 of file surface.cpp.

References imagesize(), and malloc().

void Surface::FillTransparent (  ) 

Definition at line 419 of file surface.cpp.

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

void Surface::read ( tnstream stream  ) 

Definition at line 265 of file surface.cpp.

References assignDefaultPalette(), convert(), tnstream::getLocation(), trleheader::id, tnstream::readChar(), tnstream::readdata(), tnstream::readInt(), tnstream::readWord(), trleheader::rle, trleheader::size, surfaceVersion, uncompress_rlepict(), trleheader::x, and trleheader::y.

Referenced by VehicleType::read(), TerrainType::Weather::read(), and ObjectType::read().

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::write ( tnstream stream  )  const

Definition at line 218 of file surface.cpp.

References surfaceVersion, tnstream::writeChar(), tnstream::writedata(), tnstream::writeInt(), and tnstream::writeWord().

Referenced by VehicleType::write(), and TerrainType::Weather::write().

void Surface::strech ( int  width,
int  height 
)

Definition at line 457 of file surface.cpp.

References assignDefaultPalette(), detectColorKey(), and SDL_StretchSurface().

Referenced by VehicleType::runTextIO(), and Weathercast::Weathercast().

void Surface::writeDefaultPixelFormat ( tnstream stream  ) 

Definition at line 211 of file surface.cpp.

void Surface::readDefaultPixelFormat ( tnstream stream  )  [static]

Definition at line 205 of file surface.cpp.

References readSDLPixelFormat().

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::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(), rotateSurface(), and strech().

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

Definition at line 515 of file surface.cpp.

References opaque.

Referenced by OverviewMapImage::create().

void Surface::ColorKey2AlphaChannel (  ) 

Definition at line 734 of file surface.cpp.

References transparent.

bool Surface::hasAlpha (  ) 

Definition at line 476 of file surface.cpp.

Referenced by applyLegacyFieldMask(), and detectColorKey().

int Surface::getMemoryFootprint (  )  const

Definition at line 716 of file surface.cpp.

References getBaseSurface().

Referenced by VehicleType::getMemoryFootprint(), and TerrainType::Weather::getMemoryFootprint().

SDL_Surface* Surface::getBaseSurface (  )  [inline]

Definition at line 116 of file surface.h.

Referenced by AmmoTransferWindow::AmmoTransferWindow(), ASCGUI_Window::WidgetParameters::assign(), CargoDialog::CargoDialog(), copy2screen(), SavegameWidget::display(), TextRenderer::eval_command(), StoringPosition::eventBlit(), StoringPosition::eventMouseMotion(), getMemoryFootprint(), InternalAmmoTransferWindow::InternalAmmoTransferWindow(), VisibilityLayer::paintSingleField(), GuiButton::registerFunc(), WholeMapRenderer::renderVisibility(), VehicleTypeRenderer::renderWidget(), DataTab::setData(), ASCGUI_Window::setImage(), StartupScreen::StartupScreen(), and UnitInfoDialog::UnitInfoDialog().

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

Definition at line 117 of file surface.h.

virtual int Surface::getDepthFormat (  )  [inline, protected, virtual]

Reimplemented in TypedSurface< colorDepth >.

Definition at line 120 of file surface.h.

void Surface::convert (  )  [protected]

Definition at line 151 of file surface.cpp.

References createSurface().

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


Member Data Documentation

const Uint32 Surface::transparent = 0 [static]

Definition at line 65 of file surface.h.

Referenced by ColorMerger_AlphaMerge< 4 >::assign(), OverviewMapHolder::clear(), ColorKey2AlphaChannel(), ColorConverter< 1, 4 >::convert(), OverviewMapImage::create(), Vehicle::getImage(), Building::getImage(), imageEmpty(), snowify(), ColorTransform_PlayerTrueColHSV< pixelsize >::transform(), WholeMapRenderer::WholeMapRenderer(), and writePNGtrim().

const Uint32 Surface::opaque = 255l [static]

Definition at line 66 of file surface.h.

Referenced by ColorMerger_AlphaMerge< 4 >::assign(), ColorConverter< 1, 4 >::convert(), OverviewMapImage::create(), hasTransparency(), and isTransparent().


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:47:39 2012 for Advanced Strategic Command by  doxygen 1.5.1