22 #ifndef TITANIC_TRANSPARENCY_SURFACE_H 23 #define TITANIC_TRANSPARENCY_SURFACE_H 25 #include "common/rect.h" 26 #include "graphics/surface.h" 30 enum TransparencyMode {
31 TRANS_MASK0 = 0, TRANS_MASK255 = 1, TRANS_ALPHA0 = 2,
32 TRANS_ALPHA255 = 3, TRANS_DEFAULT = 4
42 byte _transparentColor;
48 inline uint getPixel()
const {
49 byte pixel = *(
const byte *)_surface->
getBasePtr(_pos.
x, _pos.
y);
61 inline void setRow(
int yp) { _pos.
y = yp; }
66 inline void setCol(
int xp) { _pos.
x = xp; }
72 if (++_pos.
x >= _surface->
w) {
84 byte pixel = getPixel();
85 return _opaqueColor ? 0xFF - pixel : pixel;
92 byte pixel = getPixel();
93 return _opaqueColor ? pixel >= 0xf0 : pixel < 0x10;
100 byte pixel = getPixel();
101 return _transparentColor ? pixel >= 0xf0 : pixel < 0x10;
CTransparencySurface(const Graphics::Surface *surface, TransparencyMode transMode)
uint getAlpha() const
Definition: transparency_surface.h:83
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
int moveX()
Definition: transparency_surface.h:71
void setRow(int yp)
Definition: transparency_surface.h:61
int16 x
Definition: rect.h:46
Definition: transparency_surface.h:35
int16 y
Definition: rect.h:47
bool isPixelOpaque() const
Definition: transparency_surface.h:91
int16 w
Definition: surface.h:71
void setCol(int xp)
Definition: transparency_surface.h:66
bool isPixelTransparent() const
Definition: transparency_surface.h:99