22 #ifndef GRAPHICS_SURFACE_H 23 #define GRAPHICS_SURFACE_H 25 #include "common/scummsys.h" 26 #include "common/endian.h" 27 #include "common/list.h" 34 #include "graphics/pixelformat.h" 35 #include "graphics/transform_struct.h" 48 struct TransformStruct;
100 Surface() : w(0), h(0), pitch(0), pixels(0), format() {
141 return (
const byte *)(pixels) + y * pitch + x * format.
bytesPerPixel;
153 return static_cast<byte *
>(pixels) + y * pitch + x * format.
bytesPerPixel;
167 return *((
const uint8 *)getBasePtr(x, y));
169 return *((
const uint16 *)getBasePtr(x, y));
171 return READ_UINT24(getBasePtr(x, y));
173 return *((
const uint32 *)getBasePtr(x, y));
187 assert(x >= 0 && x < w && y >= 0 && y < h);
189 *((uint8 *)getBasePtr(x, y)) = pixel;
191 *((uint16 *)getBasePtr(x, y)) = pixel;
193 WRITE_UINT24(getBasePtr(x, y), pixel);
195 *((uint32 *)getBasePtr(x, y)) = pixel;
207 void create(int16 width, int16 height,
const PixelFormat &format);
231 void init(int16 width, int16 height, int16 pitch,
void *pixels,
const PixelFormat &format);
242 void copyFrom(
const Surface &surf);
294 bool clip(
Common::Rect &srcBounds,
Common::Rect &destBounds, uint src_w = 0, uint src_h = 0, byte flip = FLIP_NONE)
const;
308 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height);
334 void copyRectToSurfaceWithKey(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height, uint32 key);
362 convertToInPlace(dstFormat,
nullptr, 0);
379 void convertToInPlace(
const PixelFormat &dstFormat,
const byte *palette, uint16 paletteCount);
394 Graphics::Surface *convertTo(
const PixelFormat &dstFormat,
const byte *srcPalette = 0,
int srcPaletteCount = 256,
const byte *dstPalette = 0,
int dstPaletteCount = 0, DitherMethod method = kDitherFloyd)
const;
397 void ditherFloyd(
const byte *srcPalette,
int srcPaletteCount,
Surface *dstSurf,
const byte *dstPalette,
int dstPaletteCount, DitherMethod method,
const PixelFormat &dstFormat)
const;
412 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color);
429 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color);
441 void drawRoundRect(
const Common::Rect &rect,
int arc, uint32 color,
bool filled);
454 void drawPolygonScan(
const int *polyX,
const int *polyY,
int npoints,
const Common::Rect &bbox, uint32 color);
468 void drawEllipse(
int x0,
int y0,
int x1,
int y1, uint32 color,
bool filled);
479 void hLine(
int x,
int y,
int x2, uint32 color);
490 void vLine(
int x,
int y,
int y2, uint32 color);
512 void move(
int dx,
int dy,
int height);
536 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha =
false);
549 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha,
550 uint8 rNew, uint8 gNew, uint8 bNew);
557 bool setAlpha(uint8 alpha,
bool skipTransparent =
false);
562 AlphaType detectAlpha()
const;
604 void debugPrint(
int debuglevel = 0,
int width = 0,
int height = 0,
int x = 0,
int y = 0,
int scale = -1,
int maxwidth = 160,
const byte *palette = NULL)
const;
613 void operator()(
Surface *ptr) {
640 FloodFill(
Surface *surface, uint32 oldColor, uint32 fillColor,
bool maskMode =
false);
649 void addSeed(
int x,
int y);
679 uint32 _oldColor, _fillColor;
void * getPixels()
Definition: surface.h:119
int32 pitch
Definition: surface.h:83
void * pixels
Definition: surface.h:89
void * getBasePtr(int x, int y)
Definition: surface.h:152
Surface * getMask()
Definition: surface.h:673
int16 h
Definition: surface.h:76
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:361
Definition: surface.h:631
void setPixels(void *newPixels)
Definition: surface.h:130
Definition: display_client.h:58
Surface()
Definition: surface.h:100
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: surface.h:612
const void * getBasePtr(int x, int y) const
Definition: surface.h:140
Definition: algorithm.h:29
Definition: formatinfo.h:28
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
void setPixel(int x, int y, int pixel)
Definition: surface.h:185
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
int16 w
Definition: surface.h:71
PixelFormat format
Definition: surface.h:95
uint32 getPixel(int x, int y) const
Definition: surface.h:164
const void * getPixels() const
Definition: surface.h:110