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() {
139 return (
const byte *)(pixels) + y * pitch + x * format.
bytesPerPixel;
151 return static_cast<byte *
>(pixels) + y * pitch + x * format.
bytesPerPixel;
165 return *((
const uint8 *)getBasePtr(x, y));
167 return *((
const uint16 *)getBasePtr(x, y));
169 return READ_UINT24(getBasePtr(x, y));
171 return *((
const uint32 *)getBasePtr(x, y));
185 assert(x >= 0 && x < w && y >= 0 && y < h);
187 *((uint8 *)getBasePtr(x, y)) = pixel;
189 *((uint16 *)getBasePtr(x, y)) = pixel;
191 WRITE_UINT24(getBasePtr(x, y), pixel);
193 *((uint32 *)getBasePtr(x, y)) = pixel;
205 void create(int16 width, int16 height,
const PixelFormat &format);
229 void init(int16 width, int16 height, int16 pitch,
void *pixels,
const PixelFormat &format);
240 void copyFrom(
const Surface &surf);
306 void copyRectToSurface(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height);
332 void copyRectToSurfaceWithKey(
const void *buffer,
int srcPitch,
int destX,
int destY,
int width,
int height, uint32 key);
360 convertToInPlace(dstFormat,
nullptr, 0);
377 void convertToInPlace(
const PixelFormat &dstFormat,
const byte *palette, uint16 paletteCount);
392 Graphics::Surface *convertTo(
const PixelFormat &dstFormat,
const byte *srcPalette = 0,
int srcPaletteCount = 256,
const byte *dstPalette = 0,
int dstPaletteCount = 0, DitherMethod method = kDitherFloyd)
const;
395 void ditherFloyd(
const byte *srcPalette,
int srcPaletteCount,
Surface *dstSurf,
const byte *dstPalette,
int dstPaletteCount, DitherMethod method,
const PixelFormat &dstFormat)
const;
410 void drawLine(
int x0,
int y0,
int x1,
int y1, uint32 color);
427 void drawThickLine(
int x0,
int y0,
int x1,
int y1,
int penX,
int penY, uint32 color);
438 void hLine(
int x,
int y,
int x2, uint32 color);
449 void vLine(
int x,
int y,
int y2, uint32 color);
471 void move(
int dx,
int dy,
int height);
494 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha =
false);
506 bool applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey,
bool overwriteAlpha,
507 uint8 rNew, uint8 gNew, uint8 bNew);
514 bool setAlpha(uint8 alpha,
bool skipTransparent =
false);
519 AlphaType detectAlpha()
const;
560 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;
569 void operator()(
Surface *ptr) {
596 FloodFill(
Surface *surface, uint32 oldColor, uint32 fillColor,
bool maskMode =
false);
605 void addSeed(
int x,
int y);
635 uint32 _oldColor, _fillColor;
void * getPixels()
Definition: surface.h:117
int32 pitch
Definition: surface.h:83
void * pixels
Definition: surface.h:89
void * getBasePtr(int x, int y)
Definition: surface.h:150
Surface * getMask()
Definition: surface.h:629
int16 h
Definition: surface.h:76
void convertToInPlace(const PixelFormat &dstFormat)
Definition: surface.h:359
Definition: surface.h:587
void setPixels(void *newPixels)
Definition: surface.h:128
Definition: display_client.h:58
Surface()
Definition: surface.h:100
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: surface.h:568
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
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:183
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:162
const void * getPixels() const
Definition: surface.h:108