24 #include "../libs/sdlmm/src/sdlmm.h"
25 #include "../basestreaminterface.h"
43 inline Uint32
MapRGB(SDL_PixelFormat* format)
const {
44 return SDL_MapRGB(format, r, g, b);
47 inline Uint32
MapRGBA(SDL_PixelFormat* format, Uint8 a)
const {
48 return SDL_MapRGBA(format, r, g, b, a);
56 return ((r == c.r) && (g == c.g) && (b == c.b));
63 void* pixelDataPointer;
67 explicit Surface( SDL_Surface *surface);
68 Surface(
const SDLmm::Surface& other);
91 void strech (
int width,
int height );
99 void assignPalette(SDL_Color* colors,
int startColor = 0,
int colorNum = 256 );
124 static SDLmm::PixelFormat* default8bit;
125 static SDLmm::PixelFormat* default32bit;
143 assert ( surface.GetPixelFormat().BytesPerPixel() ==
depth );
144 assert ( depthCheck ==
depth );
158 assert ( s.GetPixelFormat().BytesPerPixel() == depth );
const SDL_Surface * getBaseSurface() const
TypedSurface< 1 > Surface8
A Device Independent color. Shamelessly pinched from Paragui to reduce coupling.
TypedSurface< 4 > Surface32
void applyLegacyFieldMask(Surface &s, int x=0, int y=0, bool detectColorKey=false)
applies a field mask that uses FEFEFE Color as Colorkey to load old images
static const Uint32 transparent
TypedSurface< depth > & castSurface(Surface &s)
static void readDefaultPixelFormat(tnstream &stream)
static Surface createSurface(int width, int height, SDLmm::Color color=255)
The interface for all kinds of IO stream.
void strech(int width, int height)
bool operator==(const DI_Color &c) const
SDL_Surface * getBaseSurface()
void ColorKey2AlphaChannel()
Uint32 MapRGBA(SDL_PixelFormat *format, Uint8 a) const
TypedSurface(SDLmm::Surface &surface, int depthCheck)
the parameter depthcheck is primarily there to prevent accidential usage of this constructor ...
void read(tnstream &stream)
void write(tnstream &stream) const
Uint32 MapRGB(SDL_PixelFormat *format) const
virtual int getDepthFormat()
TypedSurfaceBase(const SDLmm::Surface &other)
static void SetScreen(SDL_Surface *screen)
static const Uint32 opaque
bool operator!=(const DI_Color &c) const
bool isTransparent(SDLmm::Color col) const
void assignDefaultPalette()
assigns the default ASC palette to the surface (only for 8 Bit surfaces)
void newFromBGI(void *img)
Creates an image from an BGI image structure.
DI_Color & operator=(const SDL_Color &c)
TypedSurface(SDL_Surface *surface)
static Surface Wrap(SDL_Surface *surface)
Surface rotateSurface(Surface &s, int degrees)
TypedSurface(const TypedSurface< colorDepth > &other)
void readImageFile(tnstream &stream)
virtual int getDepthFormat()
void assignPalette(SDL_Color *colors, int startColor=0, int colorNum=256)
int getMemoryFootprint() const
void writeDefaultPixelFormat(tnstream &stream)
void applyFieldMask(Surface &s, int x=0, int y=0, bool detectColorKey=true)
TypedSurfaceBase(SDL_Surface *surface)
void detectColorKey(bool RLE=false)
tries to automatically detect the color key of the surface
Surface Duplicate() const