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);
112 const Common::Rect &destRect, uint32 transColor,
bool flipped, uint32 srcAlpha,
119 const Common::Rect &destRect,
const int flipping,
const uint colorMod,
120 const TSpriteBlendMode blend,
const AlphaType alphaType);
127 return _innerSurface.
clip(srcBounds, destBounds);
148 WARN_DEPRECATED(
"Use copyFrom(), a move constructor or supply bounds")
183 operator const
Surface &()
const {
return _innerSurface; }
193 Surface *surfacePtr() {
return &_innerSurface; }
200 WARN_DEPRECATED(
"Use copyFrom() or a move constructor instead")
211 bool empty()
const {
return w == 0 || h == 0 || _innerSurface.
getPixels() ==
nullptr; }
227 return _innerSurface.
getPixel(x, y);
238 return _innerSurface.
setPixel(x, y, pixel);
280 virtual void create(int16 width, int16 height);
447 uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
460 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
474 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
500 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
501 const Palette *srcPalette =
nullptr);
512 uint32 srcAlpha = 0xff);
524 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
537 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
551 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
559 destPos.
y + srcRect.
height()), src._palette);
585 const int flipping = FLIP_NONE,
586 const uint colorMod = MS_ARGB(255, 255, 255, 255),
587 const TSpriteBlendMode blend = BLEND_NORMAL,
588 const AlphaType alphaType = ALPHA_FULL);
605 const int flipping = FLIP_NONE,
606 const uint colorMod = MS_ARGB(255, 255, 255, 255),
607 const TSpriteBlendMode blend = BLEND_NORMAL,
608 const AlphaType alphaType = ALPHA_FULL);
627 const int flipping = FLIP_NONE,
628 const uint colorMod = MS_ARGB(255, 255, 255, 255),
629 const TSpriteBlendMode blend = BLEND_NORMAL,
630 const AlphaType alphaType = ALPHA_FULL);
650 const int flipping = FLIP_NONE,
651 const uint colorMod = MS_ARGB(255, 255, 255, 255),
652 const TSpriteBlendMode blend = BLEND_NORMAL,
653 const AlphaType alphaType = ALPHA_FULL);
669 const int flipping = FLIP_NONE,
670 const uint colorMod = MS_ARGB(255, 255, 255, 255),
671 const TSpriteBlendMode blend = BLEND_NORMAL,
672 const AlphaType alphaType = ALPHA_FULL);
689 const int flipping = FLIP_NONE,
690 const uint colorMod = MS_ARGB(255, 255, 255, 255),
691 const TSpriteBlendMode blend = BLEND_NORMAL,
692 const AlphaType alphaType = ALPHA_FULL);
711 const int flipping = FLIP_NONE,
712 const uint colorMod = MS_ARGB(255, 255, 255, 255),
713 const TSpriteBlendMode blend = BLEND_NORMAL,
714 const AlphaType alphaType = ALPHA_FULL);
734 const int flipping = FLIP_NONE,
735 const uint colorMod = MS_ARGB(255, 255, 255, 255),
736 const TSpriteBlendMode blend = BLEND_NORMAL,
737 const AlphaType alphaType = ALPHA_FULL);
754 const int posX = 0,
const int posY = 0,
755 const int flipping = FLIP_NONE,
757 const uint colorMod = MS_ARGB(255, 255, 255, 255),
758 const int width = -1,
const int height = -1,
759 const TSpriteBlendMode blend = BLEND_NORMAL,
760 const AlphaType alphaType = ALPHA_FULL);
762 const int posX = 0,
const int posY = 0,
763 const int flipping = FLIP_NONE,
765 const uint colorMod = MS_ARGB(255, 255, 255, 255),
766 const int width = -1,
const int height = -1,
767 const TSpriteBlendMode blend = BLEND_NORMAL,
768 const AlphaType alphaType = ALPHA_FULL);
782 void clear(uint32 color = 0);
794 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height) {
877 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color) {
878 _innerSurface.
drawLine(x0, y0, x1, y1, color);
885 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color) {
886 _innerSurface.
drawThickLine(x0, y0, x1, y1, penX, penY, color);
909 void drawEllipse(
int x0,
int y0,
int x1,
int y1, uint32 color,
bool filled) {
910 _innerSurface.
drawEllipse(x0, y0, x1, y1, color, filled);
917 void hLine(
int x,
int y,
int x2, uint32 color) {
918 _innerSurface.
hLine(x, y, x2, color);
925 void vLine(
int x,
int y,
int y2, uint32 color) {
926 _innerSurface.
vLine(x, y, y2, color);
999 _transparentColor = color;
1000 _transparentColorSet =
true;
1007 _transparentColorSet =
false;
1014 return _transparentColorSet;
1030 void grabPalette(byte *colors, uint start, uint num)
const;
1035 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)
Definition: managed_surface.h:971
const Common::Rect getBounds() const
Definition: managed_surface.h:325
static PixelFormat getSupportedPixelFormat()
Definition: blit.h:375
int16 & w
Definition: managed_surface.h:131
uint getTransparentColor() const
Definition: managed_surface.h:993
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)
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds) const
Definition: managed_surface.h:126
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)
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
Definition: managed_surface.h:814
virtual void create(int16 width, int16 height)
void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
Definition: managed_surface.h:556
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
void simpleBlitFrom(const Surface &src, const Palette *srcPalette=nullptr)
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:359
Surface getSubArea(const Common::Rect &area)
Definition: managed_surface.h:957
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
Definition: managed_surface.h:901
static bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst)
Definition: managed_surface.h:567
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
Definition: managed_surface.h:909
virtual void clearDirtyRects()
Definition: managed_surface.h:308
int32 & pitch
Definition: managed_surface.h:133
void * getBasePtr(int x, int y)
Definition: managed_surface.h:261
void maskBlitFrom(const Surface &src, const Surface &mask, const Palette *srcPalette=nullptr)
DisposeAfterUse::Flag disposeAfterUse() const
Definition: managed_surface.h:216
void setTransparentColor(uint32 color)
Definition: managed_surface.h:998
void clearTransparentColor()
Definition: managed_surface.h:1006
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:249
AlphaType detectAlpha() const
Definition: managed_surface.h:949
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
Definition: managed_surface.h:877
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
bool empty() const
Definition: managed_surface.h:211
void vLine(int x, int y, int y2, uint32 color)
Definition: managed_surface.h:925
T width() const
Definition: rect.h:217
void fillRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:933
void copyFrom(const ManagedSurface &surf)
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: managed_surface.h:885
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
Definition: managed_surface.h:893
bool hasTransparentColor() const
Definition: managed_surface.h:1013
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds) const
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
int16 & h
Definition: managed_surface.h:132
T height() const
Definition: rect.h:218
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
void hLine(int x, int y, int x2, uint32 color)
void * getPixels()
Definition: managed_surface.h:268
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:192
ManagedSurface * scale(int16 newWidth, int16 newHeight, bool filtering=false) const
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
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:804
ManagedSurface * rotoscale(const TransformStruct &transform, bool filtering=false) const
Rotoscale function; this returns a transformed version of this surface after rotation and scaling...
const Common::Point getOffsetFromOwner() const
Definition: managed_surface.h:320
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect, uint32 key)
Definition: managed_surface.h:824
void setPixel(int x, int y, int pixel)
Definition: surface.h:183
AlphaType detectAlpha() const
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:941
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
void simpleBlitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette, bool transparentColorSet, uint transparentColor)
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:134
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:917
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:226
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:270
uint32 getPixel(int x, int y) const
Definition: surface.h:162
void setPixel(int x, int y, uint32 pixel)
Definition: managed_surface.h:237
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
Definition: managed_surface.h:986
virtual void setPixels(void *newPixels)
const void * getPixels() const
Definition: surface.h:108
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
Definition: managed_surface.h:794
void maskBlitFromInner(const Surface &src, const Surface &mask, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette)
Definition: atari-screen.h:42