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 return _innerSurface.
clip(srcBounds, destBounds);
140 WARN_DEPRECATED(
"Use copyFrom(), a move constructor or supply bounds")
175 operator const
Surface &()
const {
return _innerSurface; }
185 Surface *surfacePtr() {
return &_innerSurface; }
192 WARN_DEPRECATED(
"Use copyFrom() or a move constructor instead")
203 bool empty()
const {
return w == 0 || h == 0 || _innerSurface.
getPixels() ==
nullptr; }
219 return _innerSurface.
getPixel(x, y);
230 return _innerSurface.
setPixel(x, y, pixel);
272 virtual void create(int16 width, int16 height);
439 uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
452 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
466 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
492 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff,
493 const Palette *srcPalette =
nullptr);
504 uint32 srcAlpha = 0xff);
516 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
529 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
543 uint32 transColor = 0,
bool flipped =
false, uint32 srcAlpha = 0xff);
551 destPos.
y + srcRect.
height()), src._palette);
578 const int posX = 0,
const int posY = 0,
579 const int flipping = FLIP_NONE,
581 const uint colorMod = MS_ARGB(255, 255, 255, 255),
582 const int width = -1,
const int height = -1,
583 const TSpriteBlendMode blend = BLEND_NORMAL,
584 const AlphaType alphaType = ALPHA_FULL);
586 const int posX = 0,
const int posY = 0,
587 const int flipping = FLIP_NONE,
589 const uint colorMod = MS_ARGB(255, 255, 255, 255),
590 const int width = -1,
const int height = -1,
591 const TSpriteBlendMode blend = BLEND_NORMAL,
592 const AlphaType alphaType = ALPHA_FULL);
597 void clear(uint32 color = 0);
609 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height) {
692 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color) {
693 _innerSurface.
drawLine(x0, y0, x1, y1, color);
700 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color) {
701 _innerSurface.
drawThickLine(x0, y0, x1, y1, penX, penY, color);
724 void drawEllipse(
int x0,
int y0,
int x1,
int y1, uint32 color,
bool filled) {
725 _innerSurface.
drawEllipse(x0, y0, x1, y1, color, filled);
732 void hLine(
int x,
int y,
int x2, uint32 color) {
733 _innerSurface.
hLine(x, y, x2, color);
740 void vLine(
int x,
int y,
int y2, uint32 color) {
741 _innerSurface.
vLine(x, y, y2, color);
814 _transparentColor = color;
815 _transparentColorSet =
true;
822 _transparentColorSet =
false;
829 return _transparentColorSet;
845 void grabPalette(byte *colors, uint start, uint num)
const;
850 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:786
const Common::Rect getBounds() const
Definition: managed_surface.h:317
static PixelFormat getSupportedPixelFormat()
Definition: blit.h:337
int16 & w
Definition: managed_surface.h:123
uint getTransparentColor() const
Definition: managed_surface.h:808
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:118
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:629
virtual void create(int16 width, int16 height)
void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
Definition: managed_surface.h:548
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:772
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
Definition: managed_surface.h:716
static bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst)
Definition: managed_surface.h:559
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
Definition: managed_surface.h:724
virtual void clearDirtyRects()
Definition: managed_surface.h:300
int32 & pitch
Definition: managed_surface.h:125
void * getBasePtr(int x, int y)
Definition: managed_surface.h:253
void maskBlitFrom(const Surface &src, const Surface &mask, const Palette *srcPalette=nullptr)
DisposeAfterUse::Flag disposeAfterUse() const
Definition: managed_surface.h:208
void setTransparentColor(uint32 color)
Definition: managed_surface.h:813
void clearTransparentColor()
Definition: managed_surface.h:821
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:241
AlphaType detectAlpha() const
Definition: managed_surface.h:764
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
Definition: managed_surface.h:692
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
bool empty() const
Definition: managed_surface.h:203
void vLine(int x, int y, int y2, uint32 color)
Definition: managed_surface.h:740
void fillRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:748
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:700
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
Definition: managed_surface.h:708
bool hasTransparentColor() const
Definition: managed_surface.h:828
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds) const
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
int16 & h
Definition: managed_surface.h:124
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
int16 width() const
Definition: rect.h:192
void hLine(int x, int y, int x2, uint32 color)
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect)
Definition: managed_surface.h:619
void * getPixels()
Definition: managed_surface.h:260
Definition: algorithm.h:29
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: formatinfo.h:28
const Surface & rawSurface() const
Definition: managed_surface.h:184
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)
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:312
void setPixel(int x, int y, int pixel)
Definition: surface.h:183
AlphaType detectAlpha() const
int16 x
Definition: rect.h:46
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:756
int16 y
Definition: rect.h:47
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:126
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:732
uint32 getPixel(int x, int y) const
Definition: managed_surface.h:218
Simple class for handling a palette data.
Definition: palette.h:51
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key)
Definition: managed_surface.h:639
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:262
uint32 getPixel(int x, int y) const
Definition: surface.h:162
void setPixel(int x, int y, uint32 pixel)
Definition: managed_surface.h:229
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
Definition: managed_surface.h:801
virtual void setPixels(void *newPixels)
const void * getPixels() const
Definition: surface.h:108
int16 height() const
Definition: rect.h:193
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
Definition: managed_surface.h:609
void maskBlitFromInner(const Surface &src, const Surface &mask, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette)
Definition: atari-screen.h:44