22 #ifndef GRAPHICS_MANAGED_SURFACE_H 23 #define GRAPHICS_MANAGED_SURFACE_H 25 #include "graphics/pixelformat.h" 26 #include "graphics/surface.h" 27 #include "graphics/transform_struct.h" 28 #include "common/types.h" 29 #include "graphics/blit.h" 31 #define MS_RGB(R,G,B) (uint32)(((R) << 24) | ((G) << 16) | ((B) << 8) | 0xff) 32 #define MS_ARGB(A,R,G,B) (uint32)(((R) << 24) | ((G) << 16) | ((B) << 8) | (A)) 62 DisposeAfterUse::Flag _disposeAfterUse;
80 uint _transparentColor;
81 bool _transparentColorSet;
93 bool transparentColorSet, uint transparentColor,
94 byte flip,
bool alpha, byte aMod);
101 const Palette *srcPalette, byte flip,
bool alpha, byte aMod);
113 const Common::Rect &destRect, uint32 transColor,
bool flipped, uint32 srcAlpha,
120 const Common::Rect &destRect,
const int flipping,
const uint colorMod,
121 const TSpriteBlendMode blend,
const AlphaType alphaType);
130 return _innerSurface.
clip(srcBounds, destBounds, src_w, src_h, flip);
151 WARN_DEPRECATED(
"Use copyFrom(), a move constructor or supply bounds")
186 operator const
Surface &()
const {
return _innerSurface; }
196 Surface *surfacePtr() {
return &_innerSurface; }
203 WARN_DEPRECATED(
"Use copyFrom() or a move constructor instead")
214 bool empty()
const {
return w == 0 || h == 0 || _innerSurface.
getPixels() ==
nullptr; }
230 return _innerSurface.
getPixel(x, y);
241 return _innerSurface.
setPixel(x, y, pixel);
283 virtual void create(int16 width, int16 height);
336 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
337 const Palette *srcPalette =
nullptr);
343 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
344 const Palette *srcPalette =
nullptr);
351 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
352 const Palette *srcPalette =
nullptr);
358 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
364 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
371 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
377 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
378 const Palette *srcPalette =
nullptr);
384 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
385 const Palette *srcPalette =
nullptr);
392 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff,
393 const Palette *srcPalette =
nullptr);
399 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
405 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
412 byte flip =
FLIP_NONE,
bool alpha =
false, byte aMod = 0xff);
468 uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
481 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
495 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
521 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
522 const Palette *srcPalette =
nullptr);
533 uint32 srcAlpha = 0xff);
545 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
558 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
572 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
580 destPos.
y + srcRect.
height()), src._palette);
607 const uint colorMod = MS_ARGB(255, 255, 255, 255),
608 const TSpriteBlendMode blend = BLEND_NORMAL,
609 const AlphaType alphaType = ALPHA_FULL);
627 const uint colorMod = MS_ARGB(255, 255, 255, 255),
628 const TSpriteBlendMode blend = BLEND_NORMAL,
629 const AlphaType alphaType = ALPHA_FULL);
649 const uint colorMod = MS_ARGB(255, 255, 255, 255),
650 const TSpriteBlendMode blend = BLEND_NORMAL,
651 const AlphaType alphaType = ALPHA_FULL);
672 const uint colorMod = MS_ARGB(255, 255, 255, 255),
673 const TSpriteBlendMode blend = BLEND_NORMAL,
674 const AlphaType alphaType = ALPHA_FULL);
691 const uint colorMod = MS_ARGB(255, 255, 255, 255),
692 const TSpriteBlendMode blend = BLEND_NORMAL,
693 const AlphaType alphaType = ALPHA_FULL);
711 const uint colorMod = MS_ARGB(255, 255, 255, 255),
712 const TSpriteBlendMode blend = BLEND_NORMAL,
713 const AlphaType alphaType = ALPHA_FULL);
733 const uint colorMod = MS_ARGB(255, 255, 255, 255),
734 const TSpriteBlendMode blend = BLEND_NORMAL,
735 const AlphaType alphaType = ALPHA_FULL);
756 const uint colorMod = MS_ARGB(255, 255, 255, 255),
757 const TSpriteBlendMode blend = BLEND_NORMAL,
758 const AlphaType alphaType = ALPHA_FULL);
775 const int posX = 0,
const int posY = 0,
778 const uint colorMod = MS_ARGB(255, 255, 255, 255),
779 const int width = -1,
const int height = -1,
780 const TSpriteBlendMode blend = BLEND_NORMAL,
781 const AlphaType alphaType = ALPHA_FULL);
783 const int posX = 0,
const int posY = 0,
786 const uint colorMod = MS_ARGB(255, 255, 255, 255),
787 const int width = -1,
const int height = -1,
788 const TSpriteBlendMode blend = BLEND_NORMAL,
789 const AlphaType alphaType = ALPHA_FULL);
803 void clear(uint32 color = 0);
815 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height) {
898 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color) {
899 _innerSurface.
drawLine(x0, y0, x1, y1, color);
906 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color) {
907 _innerSurface.
drawThickLine(x0, y0, x1, y1, penX, penY, color);
930 void drawEllipse(
int x0,
int y0,
int x1,
int y1, uint32 color,
bool filled) {
931 _innerSurface.
drawEllipse(x0, y0, x1, y1, color, filled);
938 void hLine(
int x,
int y,
int x2, uint32 color) {
939 _innerSurface.
hLine(x, y, x2, color);
946 void vLine(
int x,
int y,
int y2, uint32 color) {
947 _innerSurface.
vLine(x, y, y2, color);
1025 _transparentColor = color;
1026 _transparentColorSet =
true;
1033 _transparentColorSet =
false;
1040 return _transparentColorSet;
1056 void grabPalette(byte *colors, uint start, uint num)
const;
1064 void setPalette(
const byte *colors, uint start, uint num);
void clear(uint32 color=0)
Definition: managed_surface.h:51
void convertFrom(const ManagedSurface &surf, const PixelFormat &fmt)
void convertToInPlace(const PixelFormat &dstFormat)
const Common::Rect getBounds() const
Definition: managed_surface.h:328
static PixelFormat getSupportedPixelFormat()
Definition: blit.h:411
int16 & w
Definition: managed_surface.h:134
uint getTransparentColor() const
Definition: managed_surface.h:1019
Common::Rect blendBlitTo(ManagedSurface &target, const int posX=0, const int posY=0, const int flipping=FLIP_NONE, const Common::Rect *srcRect=nullptr, const uint colorMod=(uint32)(((255)<< 24)|((255)<< 16)|((255)<< 8)|(255)), const int width=-1, const int height=-1, const TSpriteBlendMode blend=BLEND_NORMAL, const AlphaType alphaType=ALPHA_FULL)
Renders this surface onto target.
virtual void addDirtyRect(const Common::Rect &r)
void transBlitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, uint32 transColor, bool flipped, uint32 srcAlpha, const Palette *srcPalette, const Palette *dstPalette)
Surface getSubArea(const Common::Rect &area)
const Surface getSubArea(const Common::Rect &area) const
Definition: managed_surface.h:986
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
Definition: managed_surface.h:835
virtual void create(int16 width, int16 height)
void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
Definition: managed_surface.h:577
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:361
Surface getSubArea(const Common::Rect &area)
Definition: managed_surface.h:978
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
Definition: managed_surface.h:922
static bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst)
Definition: managed_surface.h:588
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
Definition: managed_surface.h:930
virtual void clearDirtyRects()
Definition: managed_surface.h:311
int32 & pitch
Definition: managed_surface.h:136
void * getBasePtr(int x, int y)
Definition: managed_surface.h:264
DisposeAfterUse::Flag disposeAfterUse() const
Definition: managed_surface.h:219
void setTransparentColor(uint32 color)
Definition: managed_surface.h:1024
void clearTransparentColor()
Definition: managed_surface.h:1032
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:252
AlphaType detectAlpha() const
Definition: managed_surface.h:970
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
Definition: managed_surface.h:898
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
bool empty() const
Definition: managed_surface.h:214
void vLine(int x, int y, int y2, uint32 color)
Definition: managed_surface.h:946
T width() const
Definition: rect.h:217
void fillRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:954
void copyFrom(const ManagedSurface &surf)
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds, uint src_w=0, uint src_h=0, byte flip=FLIP_NONE) const
Definition: managed_surface.h:129
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: managed_surface.h:906
The image will not be flipped.
Definition: transform_struct.h:49
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
Definition: managed_surface.h:914
bool hasTransparentColor() const
Definition: managed_surface.h:1039
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
void simpleBlitFrom(const Surface &src, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
int16 & h
Definition: managed_surface.h:135
T height() const
Definition: rect.h:218
const void * getBasePtr(int x, int y) const
Definition: surface.h:140
void hLine(int x, int y, int x2, uint32 color)
void * getPixels()
Definition: managed_surface.h:271
Definition: algorithm.h:29
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: formatinfo.h:28
void blendBlitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const int flipping, const uint colorMod, const TSpriteBlendMode blend, const AlphaType alphaType)
const Surface & rawSurface() const
Definition: managed_surface.h:195
ManagedSurface * scale(int16 newWidth, int16 newHeight, bool filtering=false) const
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
void maskBlitFromInner(const Surface &src, const Surface &mask, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette, byte flip, bool alpha, byte aMod)
void frameRect(const Common::Rect &r, uint32 color)
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect)
Definition: managed_surface.h:825
ManagedSurface * rotoscale(const TransformStruct &transform, bool filtering=false) const
Rotoscale function; this returns a transformed version of this surface after rotation and scaling...
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds, uint src_w=0, uint src_h=0, byte flip=FLIP_NONE) const
const Common::Point getOffsetFromOwner() const
Definition: managed_surface.h:323
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect, uint32 key)
Definition: managed_surface.h:845
void setPixel(int x, int y, int pixel)
Definition: surface.h:185
AlphaType detectAlpha() const
void maskBlitFrom(const Surface &src, const Surface &mask, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
void blendFillRect(const Common::Rect r, const uint colorMod, const TSpriteBlendMode blend)
void transBlitFrom(const Surface &src, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
void frameRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:962
void blitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette)
T MIN(T a, T b)
Definition: util.h:61
void grabPalette(byte *colors, uint start, uint num) const
ManagedSurface & operator=(const ManagedSurface &surf)
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
PixelFormat & format
Definition: managed_surface.h:137
T MAX(T a, T b)
Definition: util.h:64
void vLine(int x, int y, int y2, uint32 color)
void hLine(int x, int y, int x2, uint32 color)
Definition: managed_surface.h:938
void simpleBlitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette, bool transparentColorSet, uint transparentColor, byte flip, bool alpha, byte aMod)
void blendBlitFrom(const Surface &src, const int flipping=FLIP_NONE, const uint colorMod=(uint32)(((255)<< 24)|((255)<< 16)|((255)<< 8)|(255)), const TSpriteBlendMode blend=BLEND_NORMAL, const AlphaType alphaType=ALPHA_FULL)
uint32 getPixel(int x, int y) const
Definition: managed_surface.h:229
Simple class for handling a palette data.
Definition: palette.h:55
void fillRect(Common::Rect r, uint32 color)
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
void setPalette(const byte *colors, uint start, uint num)
const void * getPixels() const
Definition: managed_surface.h:273
uint32 getPixel(int x, int y) const
Definition: surface.h:164
void setPixel(int x, int y, uint32 pixel)
Definition: managed_surface.h:240
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
Definition: managed_surface.h:1012
virtual void setPixels(void *newPixels)
const void * getPixels() const
Definition: surface.h:110
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
Definition: managed_surface.h:815
Definition: atari-screen.h:42