ScummVM API documentation
managed_surface.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GRAPHICS_MANAGED_SURFACE_H
23#define GRAPHICS_MANAGED_SURFACE_H
24
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"
30
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))
33
34namespace Graphics {
35
36class Palette;
37
52private:
56 Surface _innerSurface;
57
62 DisposeAfterUse::Flag _disposeAfterUse;
63
68 ManagedSurface *_owner;
69
74 Common::Point _offsetFromOwner;
75
80 uint _transparentColor;
81 bool _transparentColorSet;
82
86 Palette *_palette;
87protected:
91 void simpleBlitFromInner(const Surface &src, const Common::Rect &srcRect,
92 const Common::Point &destPos, const Palette *srcPalette,
93 bool transparentColorSet, uint transparentColor,
94 byte flip, bool alpha, byte aMod);
95
99 void maskBlitFromInner(const Surface &src, const Surface &mask,
100 const Common::Rect &srcRect, const Common::Point &destPos,
101 const Palette *srcPalette, byte flip, bool alpha, byte aMod);
102
106 void blitFromInner(const Surface &src, const Common::Rect &srcRect,
107 const Common::Rect &destRect, const Palette *srcPalette);
108
112 void transBlitFromInner(const Surface &src, const Common::Rect &srcRect,
113 const Common::Rect &destRect, uint32 transColor, bool flipped, uint32 srcAlpha,
114 const Palette *srcPalette, const Palette *dstPalette);
115
119 void blendBlitFromInner(const Surface &src, const Common::Rect &srcRect,
120 const Common::Rect &destRect, const int flipping, const uint colorMod,
121 const TSpriteBlendMode blend, const AlphaType alphaType);
122
123 uint32 convertTransparentColor(const ManagedSurface &surf, const PixelFormat &dstFmt) const;
124
125public:
129 bool clip(Common::Rect& srcBounds, Common::Rect& destBounds, uint src_w = 0, uint src_h = 0, byte flip = FLIP_NONE) const {
130 return _innerSurface.clip(srcBounds, destBounds, src_w, src_h, flip);
131 }
132
133public:
134 int16 &w;
135 int16 &h;
136 int32 &pitch;
138public:
143
151 WARN_DEPRECATED("Use copyFrom(), a move constructor or supply bounds")
153
158
162 ManagedSurface(int width, int height);
163
167 ManagedSurface(int width, int height, const Graphics::PixelFormat &pixelFormat);
168
172 ManagedSurface(ManagedSurface &surf, const Common::Rect &bounds);
173
177 virtual ~ManagedSurface();
178
186 operator const Surface &() const { return _innerSurface; }
187
195 const Surface &rawSurface() const { return _innerSurface; }
196 Surface *surfacePtr() { return &_innerSurface; }
197
203 WARN_DEPRECATED("Use copyFrom() or a move constructor instead")
204 ManagedSurface &operator=(const ManagedSurface &surf);
205
209 ManagedSurface &operator=(ManagedSurface &&surf);
210
214 bool empty() const { return w == 0 || h == 0 || _innerSurface.getPixels() == nullptr; }
215
219 DisposeAfterUse::Flag disposeAfterUse() const { return _disposeAfterUse; }
220
229 inline uint32 getPixel(int x, int y) const {
230 return _innerSurface.getPixel(x, y);
231 }
232
240 inline void setPixel(int x, int y, uint32 pixel) {
241 return _innerSurface.setPixel(x, y, pixel);
242 }
243
252 inline const void *getBasePtr(int x, int y) const {
253 return _innerSurface.getBasePtr(x, y);
254 }
255
264 inline void *getBasePtr(int x, int y) {
265 return _innerSurface.getBasePtr(x, y);
266 }
267
271 inline void *getPixels() { return _innerSurface.getPixels(); }
273 inline const void *getPixels() const { return _innerSurface.getPixels(); }
274
278 virtual void setPixels(void *newPixels);
279
283 virtual void create(int16 width, int16 height);
284
288 virtual void create(int16 width, int16 height, const PixelFormat &pixelFormat);
289
299 virtual void create(ManagedSurface &surf, const Common::Rect &bounds);
300
306 virtual void free();
307
311 virtual void clearDirtyRects() {}
312
317 virtual void addDirtyRect(const Common::Rect &r);
318
323 const Common::Point getOffsetFromOwner() const { return _offsetFromOwner; }
324
328 const Common::Rect getBounds() const {
329 return Common::Rect(0, 0, this->w, this->h);
330 }
331
335 void simpleBlitFrom(const Surface &src,
336 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
337 const Palette *srcPalette = nullptr);
338
342 void simpleBlitFrom(const Surface &src, const Common::Point &destPos,
343 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
344 const Palette *srcPalette = nullptr);
345
349 void simpleBlitFrom(const Surface &src, const Common::Rect &srcRect,
350 const Common::Point &destPos,
351 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
352 const Palette *srcPalette = nullptr);
353
358 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
359
363 void simpleBlitFrom(const ManagedSurface &src, const Common::Point &destPos,
364 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
365
369 void simpleBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
370 const Common::Point &destPos,
371 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
372
376 void maskBlitFrom(const Surface &src, const Surface &mask,
377 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
378 const Palette *srcPalette = nullptr);
379
383 void maskBlitFrom(const Surface &src, const Surface &mask, const Common::Point &destPos,
384 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
385 const Palette *srcPalette = nullptr);
386
390 void maskBlitFrom(const Surface &src, const Surface &mask, const Common::Rect &srcRect,
391 const Common::Point &destPos,
392 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff,
393 const Palette *srcPalette = nullptr);
394
398 void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask,
399 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
400
404 void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask, const Common::Point &destPos,
405 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
406
410 void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask,
411 const Common::Rect &srcRect, const Common::Point &destPos,
412 byte flip = FLIP_NONE, bool alpha = false, byte aMod = 0xff);
413
417 void blitFrom(const Surface &src, const Palette *srcPalette = nullptr);
418
422 void blitFrom(const Surface &src, const Common::Point &destPos, const Palette *srcPalette = nullptr);
423
427 void blitFrom(const Surface &src, const Common::Rect &srcRect,
428 const Common::Point &destPos, const Palette *srcPalette = nullptr);
429
433 void blitFrom(const Surface &src, const Common::Rect &srcRect,
434 const Common::Rect &destRect, const Palette *srcPalette = nullptr);
435
439 void blitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
440 const Common::Rect &destRect);
441
445 void blitFrom(const ManagedSurface &src);
446
450 void blitFrom(const ManagedSurface &src, const Common::Point &destPos);
451
455 void blitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
456 const Common::Point &destPos);
457
467 void transBlitFrom(const Surface &src, uint32 transColor = 0, bool flipped = false,
468 uint32 srcAlpha = 0xff, const Palette *srcPalette = nullptr);
469
480 void transBlitFrom(const Surface &src, const Common::Point &destPos,
481 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff, const Palette *srcPalette = nullptr);
482
494 void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos,
495 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff, const Palette *srcPalette = nullptr);
496
506 void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette);
507
520 void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect,
521 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff,
522 const Palette *srcPalette = nullptr);
523
532 void transBlitFrom(const ManagedSurface &src, uint32 transColor = 0, bool flipped = false,
533 uint32 srcAlpha = 0xff);
534
544 void transBlitFrom(const ManagedSurface &src, const Common::Point &destPos,
545 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff);
546
557 void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos,
558 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff);
559
571 void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect,
572 uint32 transColor = 0, bool flipped = false, uint32 srcAlpha = 0xff);
573
577 void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
578 const Common::Point &destPos) {
579 blitFromInner(src._innerSurface, srcRect, Common::Rect(destPos.x, destPos.y, destPos.x + srcRect.width(),
580 destPos.y + srcRect.height()), src._palette);
581 }
582
588 static inline bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst) {
590 }
591
605 void blendBlitFrom(const Surface &src,
606 const int flipping = FLIP_NONE,
607 const uint colorMod = MS_ARGB(255, 255, 255, 255),
608 const TSpriteBlendMode blend = BLEND_NORMAL,
609 const AlphaType alphaType = ALPHA_FULL);
610
625 void blendBlitFrom(const Surface &src, const Common::Point &destPos,
626 const int flipping = FLIP_NONE,
627 const uint colorMod = MS_ARGB(255, 255, 255, 255),
628 const TSpriteBlendMode blend = BLEND_NORMAL,
629 const AlphaType alphaType = ALPHA_FULL);
630
646 void blendBlitFrom(const Surface &src, const Common::Rect &srcRect,
647 const Common::Point &destPos,
648 const int flipping = FLIP_NONE,
649 const uint colorMod = MS_ARGB(255, 255, 255, 255),
650 const TSpriteBlendMode blend = BLEND_NORMAL,
651 const AlphaType alphaType = ALPHA_FULL);
652
669 void blendBlitFrom(const Surface &src, const Common::Rect &srcRect,
670 const Common::Rect &destRect,
671 const int flipping = FLIP_NONE,
672 const uint colorMod = MS_ARGB(255, 255, 255, 255),
673 const TSpriteBlendMode blend = BLEND_NORMAL,
674 const AlphaType alphaType = ALPHA_FULL);
675
690 const int flipping = FLIP_NONE,
691 const uint colorMod = MS_ARGB(255, 255, 255, 255),
692 const TSpriteBlendMode blend = BLEND_NORMAL,
693 const AlphaType alphaType = ALPHA_FULL);
694
709 void blendBlitFrom(const ManagedSurface &src, const Common::Point &destPos,
710 const int flipping = FLIP_NONE,
711 const uint colorMod = MS_ARGB(255, 255, 255, 255),
712 const TSpriteBlendMode blend = BLEND_NORMAL,
713 const AlphaType alphaType = ALPHA_FULL);
714
730 void blendBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
731 const Common::Point &destPos,
732 const int flipping = FLIP_NONE,
733 const uint colorMod = MS_ARGB(255, 255, 255, 255),
734 const TSpriteBlendMode blend = BLEND_NORMAL,
735 const AlphaType alphaType = ALPHA_FULL);
736
753 void blendBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
754 const Common::Rect &destRect,
755 const int flipping = FLIP_NONE,
756 const uint colorMod = MS_ARGB(255, 255, 255, 255),
757 const TSpriteBlendMode blend = BLEND_NORMAL,
758 const AlphaType alphaType = ALPHA_FULL);
759
775 const int posX = 0, const int posY = 0,
776 const int flipping = FLIP_NONE,
777 const Common::Rect *srcRect = nullptr,
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,
784 const int flipping = FLIP_NONE,
785 const Common::Rect *srcRect = nullptr,
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);
790
798 void blendFillRect(const Common::Rect r, const uint colorMod, const TSpriteBlendMode blend);
799
803 void clear(uint32 color = 0);
804
809
815 void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height) {
816 _innerSurface.copyRectToSurface(buffer, srcPitch, destX, destY, width, height);
817 addDirtyRect(Common::Rect(destX, destY, destX + width, destY + height));
818 }
819
825 void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect) {
826 _innerSurface.copyRectToSurface(srcSurface, destX, destY, subRect);
827 addDirtyRect(Common::Rect(destX, destY, destX + subRect.width(), destY + subRect.height()));
828 }
829
835 void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key) {
836 _innerSurface.copyRectToSurfaceWithKey(buffer, srcPitch, destX, destY, width, height, key);
837 addDirtyRect(Common::Rect(destX, destY, destX + width, destY + height));
838 }
839
845 void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect, uint32 key) {
846 _innerSurface.copyRectToSurfaceWithKey(srcSurface, destX, destY, subRect, key);
847 addDirtyRect(Common::Rect(destX, destY, destX + subRect.width(), destY + subRect.height()));
848 }
849
854 void copyFrom(const ManagedSurface &surf);
855
860 void copyFrom(const Surface &surf);
861
867 void convertFrom(const ManagedSurface &surf, const PixelFormat &fmt);
868
874 void convertFrom(const Surface &surf, const PixelFormat &fmt);
875
883 ManagedSurface *scale(int16 newWidth, int16 newHeight, bool filtering = false, byte flip = 0) const;
884
893 ManagedSurface *rotoscale(const TransformStruct &transform, bool filtering = false) const;
894
898 void drawLine(int x0, int y0, int x1, int y1, uint32 color) {
899 _innerSurface.drawLine(x0, y0, x1, y1, color);
900 addDirtyRect(Common::Rect(MIN(x0, x1), MIN(y0, y1), MAX(x0, x1 + 1), MAX(y0, y1 + 1)));
901 }
902
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);
908 addDirtyRect(Common::Rect(MIN(x0, x1 + penX), MIN(y0, y1 + penY), MAX(x0, x1 + penX), MAX(y0, y1 + penY)));
909 }
910
914 void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled) {
915 _innerSurface.drawRoundRect(rect, arc, color, filled);
916 addDirtyRect(rect);
917 }
918
922 void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color) {
923 _innerSurface.drawPolygonScan(polyX, polyY, npoints, bbox, color);
924 addDirtyRect(bbox);
925 }
926
930 void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled) {
931 _innerSurface.drawEllipse(x0, y0, x1, y1, color, filled);
932 addDirtyRect(Common::Rect(MIN(x0, x1), MIN(y0, y1), MAX(x0, x1 + 1), MAX(y0, y1 + 1)));
933 }
934
938 void hLine(int x, int y, int x2, uint32 color) {
939 _innerSurface.hLine(x, y, x2, color);
940 addDirtyRect(Common::Rect(x, y, x2 + 1, y + 1));
941 }
942
946 void vLine(int x, int y, int y2, uint32 color) {
947 _innerSurface.vLine(x, y, y2, color);
948 addDirtyRect(Common::Rect(x, y, x + 1, y2 + 1));
949 }
950
954 void fillRect(const Common::Rect &r, uint32 color) {
955 _innerSurface.fillRect(r, color);
956 addDirtyRect(r);
957 }
958
962 void frameRect(const Common::Rect &r, uint32 color) {
963 _innerSurface.frameRect(r, color);
964 addDirtyRect(r);
965 }
966
970 AlphaType detectAlpha() const {
971 return _innerSurface.detectAlpha();
972 }
973
979 addDirtyRect(area);
980 return _innerSurface.getSubArea(area);
981 }
982
986 const Surface getSubArea(const Common::Rect &area) const {
987 return _innerSurface.getSubArea(area);
988 }
989
999 void convertToInPlace(const PixelFormat &dstFormat);
1000
1012 void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount) {
1013 _innerSurface.convertToInPlace(dstFormat, palette, paletteCount);
1014 }
1015
1019 uint getTransparentColor() const { return _transparentColor; }
1020
1024 void setTransparentColor(uint32 color) {
1025 _transparentColor = color;
1026 _transparentColorSet = true;
1027 }
1028
1033 _transparentColorSet = false;
1034 }
1035
1039 bool hasTransparentColor() const {
1040 return _transparentColorSet;
1041 }
1042
1047
1051 bool hasPalette() const;
1052
1056 void grabPalette(byte *colors, uint start, uint num) const;
1057 const Graphics::Palette *grabPalette() const {
1058 return _palette;
1059 }
1060
1064 void setPalette(const byte *colors, uint start, uint num);
1065};
1067} // End of namespace Graphics
1068
1069#endif
static PixelFormat getSupportedPixelFormat()
Definition: blit.h:411
Definition: managed_surface.h:51
void blendFillRect(const Common::Rect r, const uint colorMod, const TSpriteBlendMode blend)
void convertFrom(const ManagedSurface &surf, const PixelFormat &fmt)
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
const Surface & rawSurface() const
Definition: managed_surface.h:195
const Common::Rect getBounds() const
Definition: managed_surface.h:328
const void * getPixels() const
Definition: managed_surface.h:273
void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
void simpleBlitFrom(const Surface &src, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
void copyFrom(const ManagedSurface &surf)
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:252
void blendBlitFrom(const ManagedSurface &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)
virtual void create(ManagedSurface &surf, const Common::Rect &bounds)
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask, const Common::Rect &srcRect, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
virtual void create(int16 width, int16 height)
void simpleBlitFrom(const ManagedSurface &src, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
void fillRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:954
void blendBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, 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)
DisposeAfterUse::Flag disposeAfterUse() const
Definition: managed_surface.h:219
void blendBlitFrom(const ManagedSurface &src, const Common::Point &destPos, 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)
void blitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette=nullptr)
void maskBlitFrom(const Surface &src, const Surface &mask, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
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)
void * getBasePtr(int x, int y)
Definition: managed_surface.h:264
int16 & w
Definition: managed_surface.h:134
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Definition: managed_surface.h:906
int16 & h
Definition: managed_surface.h:135
void clearTransparentColor()
Definition: managed_surface.h:1032
virtual void clearDirtyRects()
Definition: managed_surface.h:311
void clear(uint32 color=0)
void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff)
void simpleBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
void transBlitFrom(const ManagedSurface &src, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff)
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
virtual void addDirtyRect(const Common::Rect &r)
bool hasTransparentColor() const
Definition: managed_surface.h:1039
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
Definition: managed_surface.h:815
void blendBlitFrom(const Surface &src, const Common::Point &destPos, 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)
void transBlitFrom(const ManagedSurface &src, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff)
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)
void setPalette(const byte *colors, uint start, uint num)
void rawBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
Definition: managed_surface.h:577
void vLine(int x, int y, int y2, uint32 color)
Definition: managed_surface.h:946
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
Definition: managed_surface.h:1012
ManagedSurface * rotoscale(const TransformStruct &transform, bool filtering=false) const
Rotoscale function; this returns a transformed version of this surface after rotation and scaling....
void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff)
void blendBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos, 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)
void convertFrom(const Surface &surf, const PixelFormat &fmt)
bool empty() const
Definition: managed_surface.h:214
void blitFrom(const Surface &src, const Common::Point &destPos, const Palette *srcPalette=nullptr)
void simpleBlitFrom(const ManagedSurface &src, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
virtual void setPixels(void *newPixels)
int32 & pitch
Definition: managed_surface.h:136
uint32 getPixel(int x, int y) const
Definition: managed_surface.h:229
const Surface getSubArea(const Common::Rect &area) const
Definition: managed_surface.h:986
void simpleBlitFrom(const Surface &src, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
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.
uint getTransparentColor() const
Definition: managed_surface.h:1019
void maskBlitFrom(const Surface &src, const Surface &mask, const Common::Rect &srcRect, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
void maskBlitFrom(const ManagedSurface &src, const ManagedSurface &mask, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff)
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)
void blendBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect, 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)
void frameRect(const Common::Rect &r, uint32 color)
Definition: managed_surface.h:962
void transBlitFrom(const Surface &src, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
void blitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette=nullptr)
void blitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
static bool isBlendBlitPixelFormatSupported(const PixelFormat &src, const PixelFormat &dst)
Definition: managed_surface.h:588
void copyRectToSurfaceWithKey(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect, uint32 key)
Definition: managed_surface.h:845
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette)
void simpleBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
PixelFormat & format
Definition: managed_surface.h:137
void blitFrom(const ManagedSurface &src, const Common::Point &destPos)
void blitFrom(const ManagedSurface &src)
void transBlitFrom(const Surface &src, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
void grabPalette(byte *colors, uint start, uint num) const
Surface getSubArea(const Common::Rect &area)
Definition: managed_surface.h:978
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)
Definition: managed_surface.h:835
ManagedSurface * scale(int16 newWidth, int16 newHeight, bool filtering=false, byte flip=0) const
void blendBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, 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)
const Common::Point getOffsetFromOwner() const
Definition: managed_surface.h:323
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 drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
Definition: managed_surface.h:914
void hLine(int x, int y, int x2, uint32 color)
Definition: managed_surface.h:938
void blitFromInner(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette)
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
void * getPixels()
Definition: managed_surface.h:271
void setTransparentColor(uint32 color)
Definition: managed_surface.h:1024
void setPixel(int x, int y, uint32 pixel)
Definition: managed_surface.h:240
void blitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect)
AlphaType detectAlpha() const
Definition: managed_surface.h:970
void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect &subRect)
Definition: managed_surface.h:825
virtual void create(int16 width, int16 height, const PixelFormat &pixelFormat)
void convertToInPlace(const PixelFormat &dstFormat)
void copyFrom(const Surface &surf)
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
Definition: managed_surface.h:930
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
Definition: managed_surface.h:922
void maskBlitFrom(const Surface &src, const Surface &mask, byte flip=FLIP_NONE, bool alpha=false, byte aMod=0xff, const Palette *srcPalette=nullptr)
Simple class for handling a palette data.
Definition: palette.h:61
Definition: atari-screen.h:42
T MIN(T a, T b)
Definition: util.h:63
T MAX(T a, T b)
Definition: util.h:66
Definition: algorithm.h:29
Definition: formatinfo.h:28
@ FLIP_NONE
The image will not be flipped.
Definition: transform_struct.h:49
T y
Definition: rect.h:49
T x
Definition: rect.h:48
Definition: rect.h:144
T height() const
Definition: rect.h:218
T width() const
Definition: rect.h:217
Definition: rect.h:536
Definition: pixelformat.h:138
Definition: surface.h:67
uint32 getPixel(int x, int y) const
Definition: surface.h:164
void copyRectToSurfaceWithKey(const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
AlphaType detectAlpha() const
void fillRect(Common::Rect r, uint32 color)
const void * getBasePtr(int x, int y) const
Definition: surface.h:140
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:361
void frameRect(const Common::Rect &r, uint32 color)
void hLine(int x, int y, int x2, uint32 color)
void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
Surface getSubArea(const Common::Rect &area)
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
void drawRoundRect(const Common::Rect &rect, int arc, uint32 color, bool filled)
void setPixel(int x, int y, int pixel)
Definition: surface.h:185
bool clip(Common::Rect &srcBounds, Common::Rect &destBounds, uint src_w=0, uint src_h=0, byte flip=FLIP_NONE) const
void drawLine(int x0, int y0, int x1, int y1, uint32 color)
void drawEllipse(int x0, int y0, int x1, int y1, uint32 color, bool filled)
void vLine(int x, int y, int y2, uint32 color)
const void * getPixels() const
Definition: surface.h:110
void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color)
Definition: transform_struct.h:75