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" 47 struct TransformStruct;
99 Surface() : w(0), h(0), pitch(0), pixels(0), format() {
138 return (
const byte *)(pixels) + y * pitch + x * format.
bytesPerPixel;
150 return static_cast<byte *
>(pixels) + y * pitch + x * format.
bytesPerPixel;
164 return *((
const uint8 *)getBasePtr(x, y));
166 return *((
const uint16 *)getBasePtr(x, y));
168 return READ_UINT24(getBasePtr(x, y));
170 return *((
const uint32 *)getBasePtr(x, y));
184 assert(x >= 0 && x < w && y >= 0 && y < h);
186 *((uint8 *)getBasePtr(x, y)) = pixel;
188 *((uint16 *)getBasePtr(x, y)) = pixel;
190 WRITE_UINT24(getBasePtr(x, y), pixel);
192 *((uint32 *)getBasePtr(x, y)) = pixel;
204 void create(int16 width, int16 height,
const PixelFormat &format);
228 void init(int16 width, int16 height, int16 pitch,
void *pixels,
const PixelFormat &format);
239 void copyFrom(
const Surface &surf);
305 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height);
331 void copyRectToSurfaceWithKey(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height, uint32 key);
359 convertToInPlace(dstFormat,
nullptr, 0);
376 void convertToInPlace(
const PixelFormat &dstFormat,
const byte *palette, uint16 paletteCount);
391 Graphics::Surface *convertTo(
const PixelFormat &dstFormat,
const byte *srcPalette = 0,
int srcPaletteCount = 0,
const byte *dstPalette = 0,
int dstPaletteCount = 0, DitherMethod method = kDitherFloyd)
const;
394 void ditherFloyd(
const byte *srcPalette,
int srcPaletteCount,
Surface *dstSurf,
const byte *dstPalette,
int dstPaletteCount, DitherMethod method,
const PixelFormat &dstFormat)
const;
409 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color);
426 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color);
437 void hLine(
int x,
int y,
int x2, uint32 color);
448 void vLine(
int x,
int y,
int y2, uint32 color);
470 void move(
int dx,
int dy,
int height);
493 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha =
false);
505 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha,
506 uint8 rNew, uint8 gNew, uint8 bNew);
513 bool setAlpha(uint8 alpha,
bool skipTransparent =
false);
554 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;
563 void operator()(
Surface *ptr) {
590 FloodFill(
Surface *surface, uint32 oldColor, uint32 fillColor,
bool maskMode =
false);
599 void addSeed(
int x,
int y);
629 uint32 _oldColor, _fillColor;
void * getPixels()
Definition: surface.h:116
int32 pitch
Definition: surface.h:82
void * pixels
Definition: surface.h:88
void * getBasePtr(int x, int y)
Definition: surface.h:149
Surface * getMask()
Definition: surface.h:623
int16 h
Definition: surface.h:75
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:358
Definition: surface.h:581
void setPixels(void *newPixels)
Definition: surface.h:127
Definition: display_client.h:58
Surface()
Definition: surface.h:99
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: surface.h:562
const void * getBasePtr(int x, int y) const
Definition: surface.h:137
constexpr remove_reference_t< T > && move(T &&t) noexcept
Definition: util.h:209
Definition: algorithm.h:29
Definition: formatinfo.h:28
void setPixel(int x, int y, int pixel)
Definition: surface.h:182
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:111
int16 w
Definition: surface.h:70
PixelFormat format
Definition: surface.h:94
uint32 getPixel(int x, int y) const
Definition: surface.h:161
const void * getPixels() const
Definition: surface.h:107