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);
105 const Common::Rect &destRect, uint32 transColor,
bool flipped, uint32 overrideColor,
106 uint32 srcAlpha,
const Palette *srcPalette,
const Palette *dstPalette,
107 const Surface *mask,
bool maskOnly);
113 return _innerSurface.
clip(srcBounds, destBounds);
134 WARN_DEPRECATED(
"Use copyFrom(), a move constructor or supply bounds")
163 WARN_DEPRECATED("Use
copyFrom() instead")
169 WARN_DEPRECATED("Use
copyFrom() instead")
184 operator const
Surface &()
const {
return _innerSurface; }
194 Surface *surfacePtr() {
return &_innerSurface; }
201 WARN_DEPRECATED(
"Use copyFrom() or a move constructor instead")
212 bool empty()
const {
return w == 0 || h == 0 || _innerSurface.
getPixels() ==
nullptr; }
228 return _innerSurface.
getPixel(x, y);
239 return _innerSurface.
setPixel(x, y, pixel);
281 virtual void create(int16 width, int16 height);
418 uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
433 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
471 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
const Palette *srcPalette =
nullptr);
501 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
502 const Surface *mask =
nullptr,
bool maskOnly =
false,
const Palette *srcPalette =
nullptr);
515 uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
529 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
554 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff);
572 uint32 transColor = 0,
bool flipped =
false, uint32 overrideColor = 0, uint32 srcAlpha = 0xff,
573 const Surface *mask =
nullptr,
bool maskOnly =
false);
581 destPos.
y + srcRect.
height()), src._palette);
608 const int posX = 0,
const int posY = 0,
609 const int flipping = FLIP_NONE,
611 const uint colorMod = MS_ARGB(255, 255, 255, 255),
612 const int width = -1,
const int height = -1,
613 const TSpriteBlendMode blend = BLEND_NORMAL,
614 const AlphaType alphaType = ALPHA_FULL);
616 const int posX = 0,
const int posY = 0,
617 const int flipping = FLIP_NONE,
619 const uint colorMod = MS_ARGB(255, 255, 255, 255),
620 const int width = -1,
const int height = -1,
621 const TSpriteBlendMode blend = BLEND_NORMAL,
622 const AlphaType alphaType = ALPHA_FULL);
627 void clear(uint32 color = 0);
639 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height) {
722 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color) {
723 _innerSurface.
drawLine(x0, y0, x1, y1, color);
730 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color) {
731 _innerSurface.
drawThickLine(x0, y0, x1, y1, penX, penY, color);
738 void hLine(
int x,
int y,
int x2, uint32 color) {
739 _innerSurface.
hLine(x, y, x2, color);
746 void vLine(
int x,
int y,
int y2, uint32 color) {
747 _innerSurface.
vLine(x, y, y2, color);
820 _transparentColor = color;
821 _transparentColorSet =
true;
828 _transparentColorSet =
false;
835 return _transparentColorSet;
851 void grabPalette(byte *colors, uint start, uint num)
const;
856 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:792
const Common::Rect getBounds() const
Definition: managed_surface.h:326
static PixelFormat getSupportedPixelFormat()
Definition: blit.h:337
int16 & w
Definition: managed_surface.h:117
uint getTransparentColor() const
Definition: managed_surface.h:814
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:112
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:659
virtual void create(int16 width, int16 height)
void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
Definition: managed_surface.h:578
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:778
static bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst)
Definition: managed_surface.h:589
virtual void clearDirtyRects()
Definition: managed_surface.h:309
int32 & pitch
Definition: managed_surface.h:119
void * getBasePtr(int x, int y)
Definition: managed_surface.h:262
DisposeAfterUse::Flag disposeAfterUse() const
Definition: managed_surface.h:217
void setTransparentColor(uint32 color)
Definition: managed_surface.h:819
void clearTransparentColor()
Definition: managed_surface.h:827
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:250
void transBlitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, uint32 transColor, bool flipped, uint32 overrideColor, uint32 srcAlpha, const Palette *srcPalette, const Palette *dstPalette, const Surface *mask, bool maskOnly)
AlphaType detectAlpha() const
Definition: managed_surface.h:770
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
Definition: managed_surface.h:722
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
void transBlitFrom(const Surface &src, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
bool empty() const
Definition: managed_surface.h:212
void vLine(int x, int y, int y2, uint32 color)
Definition: managed_surface.h:746
void copyFrom(const ManagedSurface &surf)
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: managed_surface.h:730
bool hasTransparentColor() const
Definition: managed_surface.h:834
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds) const
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
int16 & h
Definition: managed_surface.h:118
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
int16 width() const
Definition: rect.h:191
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:649
void * getPixels()
Definition: managed_surface.h:269
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:193
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:321
void setPixel(int x, int y, int pixel)
Definition: surface.h:183
AlphaType detectAlpha() const
int16 x
Definition: rect.h:46
void fillRect(Common::Rect r, uint32 color)
Definition: managed_surface.h:754
void frameRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:762
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:59
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)
PixelFormat & format
Definition: managed_surface.h:120
T MAX(T a, T b)
Definition: util.h:62
void vLine(int x, int y, int y2, uint32 color)
void hLine(int x, int y, int x2, uint32 color)
Definition: managed_surface.h:738
uint32 getPixel(int x, int y) const
Definition: managed_surface.h:227
Simple class for handling a palette data.
Definition: palette.h:45
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key)
Definition: managed_surface.h:669
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:271
uint32 getPixel(int x, int y) const
Definition: surface.h:162
void setPixel(int x, int y, uint32 pixel)
Definition: managed_surface.h:238
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
Definition: managed_surface.h:807
virtual void setPixels(void *newPixels)
const void * getPixels() const
Definition: surface.h:108
int16 height() const
Definition: rect.h:192
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
Definition: managed_surface.h:639
Definition: atari-screen.h:44