ScummVM API documentation
Graphics::ManagedSurface Class Reference

#include <managed_surface.h>

Inheritance diagram for Graphics::ManagedSurface:
AGS3::Surface Graphics::Screen Graphics::SVGBitmap MM::Shared::Xeen::BaseSurface Tetraedge::TeImage Titanic::Image Ultima::Shared::Gfx::Bitmap Ultima::Shared::Gfx::VisualSurface Ultima::Ultima4::MouseCursorSurface

Public Member Functions

bool clip (Common::Rect &srcBounds, Common::Rect &destBounds) const
 
 ManagedSurface ()
 
 ManagedSurface (const ManagedSurface &surf)
 
 ManagedSurface (ManagedSurface &&surf)
 
 ManagedSurface (int width, int height)
 
 ManagedSurface (int width, int height, const Graphics::PixelFormat &pixelFormat)
 
 ManagedSurface (ManagedSurface &surf, const Common::Rect &bounds)
 
 ManagedSurface (Surface *surf, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES)
 
 ManagedSurface (const Surface *surf)
 
virtual ~ManagedSurface ()
 
 operator const Surface & () const
 
const SurfacerawSurface () const
 
SurfacesurfacePtr ()
 
ManagedSurfaceoperator= (const ManagedSurface &surf)
 
ManagedSurfaceoperator= (ManagedSurface &&surf)
 
bool empty () const
 
DisposeAfterUse::Flag disposeAfterUse () const
 
uint32 getPixel (int x, int y) const
 
void setPixel (int x, int y, uint32 pixel)
 
const void * getBasePtr (int x, int y) const
 
void * getBasePtr (int x, int y)
 
void * getPixels ()
 
const void * getPixels () const
 
virtual void setPixels (void *newPixels)
 
virtual void create (int16 width, int16 height)
 
virtual void create (int16 width, int16 height, const PixelFormat &pixelFormat)
 
virtual void create (ManagedSurface &surf, const Common::Rect &bounds)
 
virtual void free ()
 
virtual void clearDirtyRects ()
 
virtual void addDirtyRect (const Common::Rect &r)
 
const Common::Point getOffsetFromOwner () const
 
const Common::Rect getBounds () const
 
void simpleBlitFrom (const Surface &src, const Palette *srcPalette=nullptr)
 
void simpleBlitFrom (const Surface &src, const Common::Point &destPos, const Palette *srcPalette=nullptr)
 
void simpleBlitFrom (const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette=nullptr)
 
void simpleBlitFrom (const ManagedSurface &src)
 
void simpleBlitFrom (const ManagedSurface &src, const Common::Point &destPos)
 
void simpleBlitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
 
void blitFrom (const Surface &src, const Palette *srcPalette=nullptr)
 
void blitFrom (const Surface &src, const Common::Point &destPos, const Palette *srcPalette=nullptr)
 
void blitFrom (const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette=nullptr)
 
void blitFrom (const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette=nullptr)
 
void blitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect)
 
void blitFrom (const ManagedSurface &src)
 
void blitFrom (const ManagedSurface &src, const Common::Point &destPos)
 
void blitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
 
void transBlitFrom (const Surface &src, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
 
void transBlitFrom (const Surface &src, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
 
void transBlitFrom (const Surface &src, const Common::Point &destPos, const ManagedSurface &mask, const Palette *srcPalette=nullptr)
 
void transBlitFrom (const Surface &src, const Common::Point &destPos, const Surface &mask, const Palette *srcPalette=nullptr)
 
void transBlitFrom (const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Palette *srcPalette=nullptr)
 
void transBlitFrom (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::Rect &destRect, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Surface *mask=nullptr, bool maskOnly=false, const Palette *srcPalette=nullptr)
 
void transBlitFrom (const ManagedSurface &src, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff)
 
void transBlitFrom (const ManagedSurface &src, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff)
 
void transBlitFrom (const ManagedSurface &src, const Common::Point &destPos, const ManagedSurface &mask)
 
void transBlitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff)
 
void transBlitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect, uint32 transColor=0, bool flipped=false, uint32 overrideColor=0, uint32 srcAlpha=0xff, const Surface *mask=nullptr, bool maskOnly=false)
 
void rawBlitFrom (const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos)
 
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. More...
 
Common::Rect blendBlitTo (Surface &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)
 
void clear (uint32 color=0)
 
void markAllDirty ()
 
void copyRectToSurface (const void *buffer, int srcPitch, int destX, int destY, int width, int height)
 
void copyRectToSurface (const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect)
 
void copyRectToSurfaceWithKey (const void *buffer, int srcPitch, int destX, int destY, int width, int height, uint32 key)
 
void copyRectToSurfaceWithKey (const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect, uint32 key)
 
void copyFrom (const ManagedSurface &surf)
 
void copyFrom (const Surface &surf)
 
void convertFrom (const ManagedSurface &surf, const PixelFormat &fmt)
 
void convertFrom (const Surface &surf, const PixelFormat &fmt)
 
ManagedSurfacescale (int16 newWidth, int16 newHeight, bool filtering=false) const
 
ManagedSurfacerotoscale (const TransformStruct &transform, bool filtering=false) const
 Rotoscale function; this returns a transformed version of this surface after rotation and scaling. Please do not use this if angle == 0, use plain old scaling function. More...
 
void drawLine (int x0, int y0, int x1, int y1, uint32 color)
 
void drawThickLine (int x0, int y0, int x1, int y1, int penX, int penY, uint32 color)
 
void hLine (int x, int y, int x2, uint32 color)
 
void vLine (int x, int y, int y2, uint32 color)
 
void fillRect (Common::Rect r, uint32 color)
 
void frameRect (const Common::Rect &r, uint32 color)
 
AlphaType detectAlpha () const
 
Surface getSubArea (const Common::Rect &area)
 
void convertToInPlace (const PixelFormat &dstFormat)
 
void convertToInPlace (const PixelFormat &dstFormat, const byte *palette, uint16 paletteCount)
 
uint getTransparentColor () const
 
void setTransparentColor (uint32 color)
 
void clearTransparentColor ()
 
bool hasTransparentColor () const
 
void clearPalette ()
 
bool hasPalette () const
 
void grabPalette (byte *colors, uint start, uint num) const
 
void setPalette (const byte *colors, uint start, uint num)
 

Static Public Member Functions

static bool isBlendBlitPixelFormatSupported (const PixelFormat &src, const PixelFormat &dst)
 

Public Attributes

int16 & w
 
int16 & h
 
int32 & pitch
 
PixelFormatformat
 

Protected Member Functions

void simpleBlitFromInner (const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, const Palette *srcPalette, bool transparentColorSet, uint transparentColor)
 
void blitFromInner (const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, const Palette *srcPalette)
 
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)
 

Detailed Description

A derived graphics surface, which supports automatically managing the allocated surface data block and introduces several new blitting methods.

Constructor & Destructor Documentation

◆ ManagedSurface() [1/8]

Graphics::ManagedSurface::ManagedSurface ( )

Create the managed surface.

◆ ManagedSurface() [2/8]

Graphics::ManagedSurface::ManagedSurface ( const ManagedSurface surf)

Create a managed surface from another one.

If the source surface is maintaining its own surface data, then this surface will create its own surface of the same size and copy the contents from the source surface.

◆ ManagedSurface() [3/8]

Graphics::ManagedSurface::ManagedSurface ( ManagedSurface &&  surf)

Create a managed surface from another one.

◆ ManagedSurface() [4/8]

Graphics::ManagedSurface::ManagedSurface ( int  width,
int  height 
)

Create the managed surface.

◆ ManagedSurface() [5/8]

Graphics::ManagedSurface::ManagedSurface ( int  width,
int  height,
const Graphics::PixelFormat pixelFormat 
)

Create the managed surface.

◆ ManagedSurface() [6/8]

Graphics::ManagedSurface::ManagedSurface ( ManagedSurface surf,
const Common::Rect bounds 
)

Create the managed surface.

◆ ManagedSurface() [7/8]

Graphics::ManagedSurface::ManagedSurface ( Surface surf,
DisposeAfterUse::Flag  disposeAfterUse = DisposeAfterUse::YES 
)

Create a managed surface from plain Surface.

If disposeAfterUse flag is set (default), the surface will reuse all structures from the surface and destroy it, otherwise it will make a copy.

◆ ManagedSurface() [8/8]

Graphics::ManagedSurface::ManagedSurface ( const Surface surf)

Create a managed surface from plain Surface.

◆ ~ManagedSurface()

virtual Graphics::ManagedSurface::~ManagedSurface ( )
virtual

Destroy the managed surface.

Member Function Documentation

◆ simpleBlitFromInner()

void Graphics::ManagedSurface::simpleBlitFromInner ( const Surface src,
const Common::Rect srcRect,
const Common::Point destPos,
const Palette srcPalette,
bool  transparentColorSet,
uint  transparentColor 
)
protected

Inner method for blitting.

◆ blitFromInner()

void Graphics::ManagedSurface::blitFromInner ( const Surface src,
const Common::Rect srcRect,
const Common::Rect destRect,
const Palette srcPalette 
)
protected

Inner method for blitting.

◆ transBlitFromInner()

void Graphics::ManagedSurface::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 
)
protected

Inner method for copying another surface into this one at a given destination position.

◆ clip()

bool Graphics::ManagedSurface::clip ( Common::Rect srcBounds,
Common::Rect destBounds 
) const
inline

Clip the given source bounds so the passed destBounds will be entirely on-screen.

◆ operator const Surface &()

Graphics::ManagedSurface::operator const Surface & ( ) const
inline

Automatically convert to a Graphics::Surface by simply returning the inner surface.

This must be const, because changes are not supposed to be done directly to it, since it would bypass dirty rect handling.

◆ rawSurface()

const Surface& Graphics::ManagedSurface::rawSurface ( ) const
inline

Return the underlying Graphics::Surface

If a caller uses the non-const surfacePtr version and changes the surface, they'll be responsible for calling addDirtyRect for any affected area

◆ operator=() [1/2]

ManagedSurface& Graphics::ManagedSurface::operator= ( const ManagedSurface surf)

Reassign one managed surface to another one.

Note
If the source has a managed surface, it will be duplicated.

◆ operator=() [2/2]

ManagedSurface& Graphics::ManagedSurface::operator= ( ManagedSurface &&  surf)

Reassign one managed surface to another one.

◆ empty()

bool Graphics::ManagedSurface::empty ( ) const
inline

Return true if the surface has not yet been allocated.

◆ disposeAfterUse()

DisposeAfterUse::Flag Graphics::ManagedSurface::disposeAfterUse ( ) const
inline

Return true if the surface manages its own pixels.

◆ getPixel()

uint32 Graphics::ManagedSurface::getPixel ( int  x,
int  y 
) const
inline

Return the pixel at the specified point.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
Returns
The value of the pixel.

◆ setPixel()

void Graphics::ManagedSurface::setPixel ( int  x,
int  y,
uint32  pixel 
)
inline

Set the pixel at the specified point.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
pixelThe value of the pixel.

◆ getBasePtr() [1/2]

const void* Graphics::ManagedSurface::getBasePtr ( int  x,
int  y 
) const
inline

Return a pointer to the pixel at the specified point.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
Returns
Pointer to the pixel.

◆ getBasePtr() [2/2]

void* Graphics::ManagedSurface::getBasePtr ( int  x,
int  y 
)
inline

Return a pointer to the pixel at the specified point.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
Returns
Pointer to the pixel.

◆ getPixels() [1/2]

void* Graphics::ManagedSurface::getPixels ( )
inline

Get a reference to the pixel data.

◆ getPixels() [2/2]

const void* Graphics::ManagedSurface::getPixels ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setPixels()

virtual void Graphics::ManagedSurface::setPixels ( void *  newPixels)
virtual

Set the pixel data.

◆ create() [1/3]

virtual void Graphics::ManagedSurface::create ( int16  width,
int16  height 
)
virtual

Allocate memory for the pixel data of the surface.

Reimplemented in TsAGE::GfxSurface.

◆ create() [2/3]

virtual void Graphics::ManagedSurface::create ( int16  width,
int16  height,
const PixelFormat pixelFormat 
)
virtual

Allocate memory for the pixel data of the surface.

◆ create() [3/3]

virtual void Graphics::ManagedSurface::create ( ManagedSurface surf,
const Common::Rect bounds 
)
virtual

Set up the surface as a subsection of another passed parent surface.

This surface will not own the pixels, and any dirty rect notifications will be automatically passed to the original parent surface.

Note
This differs from Graphics::Surface::getSubArea, in that this method only adds a single initial dirty rect for the whole area, and then none more.

◆ free()

virtual void Graphics::ManagedSurface::free ( )
virtual

Release the memory used by the pixel memory of this surface.

This is a counterpart of create().

◆ clearDirtyRects()

virtual void Graphics::ManagedSurface::clearDirtyRects ( )
inlinevirtual

Clear any pending dirty rectangles that have been generated for the surface.

Reimplemented in Graphics::Screen.

◆ addDirtyRect()

virtual void Graphics::ManagedSurface::addDirtyRect ( const Common::Rect r)
virtual

Base method that descendant classes can override for recording the affected dirty areas of the surface.

Reimplemented in MADS::MSurface, Access::ASurface, Sherlock::Surface, MM::Xeen::Window, TsAGE::GfxSurface, Graphics::Screen, MM::Xeen::Screen, Petka::VideoSystem, and MM::Shared::Xeen::BaseSurface.

◆ getOffsetFromOwner()

const Common::Point Graphics::ManagedSurface::getOffsetFromOwner ( ) const
inline

When the managed surface is a subsection of a parent surface, return the the offset in the parent surface where the managed surface starts at.

◆ getBounds()

const Common::Rect Graphics::ManagedSurface::getBounds ( ) const
inline

Return a rect providing the bounds of the surface.

◆ simpleBlitFrom() [1/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const Surface src,
const Palette srcPalette = nullptr 
)

Copy another surface into this one.

◆ simpleBlitFrom() [2/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const Surface src,
const Common::Point destPos,
const Palette srcPalette = nullptr 
)

Copy another surface into this one at a given destination position.

◆ simpleBlitFrom() [3/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Point destPos,
const Palette srcPalette = nullptr 
)

Copy another surface into this one at a given destination position.

◆ simpleBlitFrom() [4/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const ManagedSurface src)

Copy another surface into this one.

◆ simpleBlitFrom() [5/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const ManagedSurface src,
const Common::Point destPos 
)

Copy another surface into this one at a given destination position.

◆ simpleBlitFrom() [6/6]

void Graphics::ManagedSurface::simpleBlitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Point destPos 
)

Copy another surface into this one at a given destination position.

◆ blitFrom() [1/8]

void Graphics::ManagedSurface::blitFrom ( const Surface src,
const Palette srcPalette = nullptr 
)

Copy another surface into this one.

◆ blitFrom() [2/8]

void Graphics::ManagedSurface::blitFrom ( const Surface src,
const Common::Point destPos,
const Palette srcPalette = nullptr 
)

Copy another surface into this one at a given destination position.

◆ blitFrom() [3/8]

void Graphics::ManagedSurface::blitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Point destPos,
const Palette srcPalette = nullptr 
)

Copy another surface into this one at a given destination position.

◆ blitFrom() [4/8]

void Graphics::ManagedSurface::blitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Rect destRect,
const Palette srcPalette = nullptr 
)

Copy another surface into this one at a given destination area and perform the potential scaling.

◆ blitFrom() [5/8]

void Graphics::ManagedSurface::blitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Rect destRect 
)

Copy another surface into this one at a given destination area and perform the potential scaling.

◆ blitFrom() [6/8]

void Graphics::ManagedSurface::blitFrom ( const ManagedSurface src)

Copy another surface into this one.

◆ blitFrom() [7/8]

void Graphics::ManagedSurface::blitFrom ( const ManagedSurface src,
const Common::Point destPos 
)

Copy another surface into this one at a given destination position.

◆ blitFrom() [8/8]

void Graphics::ManagedSurface::blitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Point destPos 
)

Copy another surface into this one at a given destination position.

◆ transBlitFrom() [1/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [2/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Point destPos,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
destPosDestination position to draw the surface.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [3/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Point destPos,
const ManagedSurface mask,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
destPosDestination position to draw the surface.
maskMask definition.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [4/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Point destPos,
const Surface mask,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
destPosDestination position to draw the surface.
maskMask definition.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [5/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Point destPos,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
srcRectSubsection of the source surface to draw.
destPosDestination position to draw the surface.
transColorTransparency color to ignore copying of.
flippedSpecifies whether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [6/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Rect destRect,
const Palette srcPalette 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
srcRectSubsection of the source surface to draw.
destRectDestination area to draw the surface in. This can be sized differently then srcRect, allowing for arbitrary scaling of the image.
srcPalettePalette for the CLUT8 src surface.

◆ transBlitFrom() [7/12]

void Graphics::ManagedSurface::transBlitFrom ( const Surface src,
const Common::Rect srcRect,
const Common::Rect destRect,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff,
const Surface mask = nullptr,
bool  maskOnly = false,
const Palette srcPalette = nullptr 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
srcRectSubsection of the source surface to draw.
destRectDestination area to draw the surface in. This can be sized differently then srcRect, allowing for arbitrary scaling of the image.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.
maskOptional parameter with mask definition.
maskOnlyOptional parameter for using mask over transColor.
srcPaletteOptional palette if the src surface uses a CLUT8 pixel format.

◆ transBlitFrom() [8/12]

void Graphics::ManagedSurface::transBlitFrom ( const ManagedSurface src,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.

◆ transBlitFrom() [9/12]

void Graphics::ManagedSurface::transBlitFrom ( const ManagedSurface src,
const Common::Point destPos,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
destPosDestination position to draw the surface.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.

◆ transBlitFrom() [10/12]

void Graphics::ManagedSurface::transBlitFrom ( const ManagedSurface src,
const Common::Point destPos,
const ManagedSurface mask 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
destPosDestination position to draw the surface.
maskMask definition.

◆ transBlitFrom() [11/12]

void Graphics::ManagedSurface::transBlitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Point destPos,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
srcRectSubsection of the source surface to draw.
destPosDestination position to draw the surface.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.

◆ transBlitFrom() [12/12]

void Graphics::ManagedSurface::transBlitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Rect destRect,
uint32  transColor = 0,
bool  flipped = false,
uint32  overrideColor = 0,
uint32  srcAlpha = 0xff,
const Surface mask = nullptr,
bool  maskOnly = false 
)

Copy another surface into this one, ignoring pixels of a designated transparent color.

Parameters
srcSource surface.
srcRectSubsection of the source surface to draw.
destRectDestination area to draw the surface in. This can be sized differently then srcRect, allowing for arbitrary scaling of the image.
transColorTransparency color to ignore copying of.
flippedWhether to horizontally flip the image.
overrideColorOptional color to use instead of non-transparent pixels from the source surface.
srcAlphaOptional additional transparency applied to src.
maskOptional parameter with mask definition.
maskOnlyOptional parameter for using mask over transColor.

◆ rawBlitFrom()

void Graphics::ManagedSurface::rawBlitFrom ( const ManagedSurface src,
const Common::Rect srcRect,
const Common::Point destPos 
)
inline

Does a blitFrom ignoring any transparency settings

◆ isBlendBlitPixelFormatSupported()

static bool Graphics::ManagedSurface::isBlendBlitPixelFormatSupported ( const PixelFormat src,
const PixelFormat dst 
)
inlinestatic

ManagedSurface::blendBlitTo is meant to be a highly optimized blending/blitting function, so it can only accept certain format combinations.

Returns
true if the formats can be used by blendBlitTo.

◆ blendBlitTo()

Common::Rect Graphics::ManagedSurface::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.

Parameters
targetrenders this surface onto this one
srcsource surface
posX,posYare the position of the src onto this surface
flippingflipping flags (use Graphics::FLIP_FLAGS)
srcRectsource clipping
widthwidth of destination
heightheight of destination
colorModwhat color to multiply by (0xffffffff does nothing)
blendthe blending mode to use.
alphaTypewhat alpha mode to use. FULL is default
Returns
returns the size of the rendered rectangle

◆ clear()

void Graphics::ManagedSurface::clear ( uint32  color = 0)

Clear the entire surface.

◆ markAllDirty()

void Graphics::ManagedSurface::markAllDirty ( )

Mark the entire surface as dirty.

◆ copyRectToSurface() [1/2]

void Graphics::ManagedSurface::copyRectToSurface ( const void *  buffer,
int  srcPitch,
int  destX,
int  destY,
int  width,
int  height 
)
inline

Copy a bitmap to the internal buffer of the surface.

The pixel format of the buffer must match the pixel format of the surface.

◆ copyRectToSurface() [2/2]

void Graphics::ManagedSurface::copyRectToSurface ( const Graphics::Surface srcSurface,
int  destX,
int  destY,
const Common::Rect  subRect 
)
inline

Copy a bitmap to the internal buffer of the surface.

The pixel format of the buffer must match the pixel format of the surface.

◆ copyRectToSurfaceWithKey() [1/2]

void Graphics::ManagedSurface::copyRectToSurfaceWithKey ( const void *  buffer,
int  srcPitch,
int  destX,
int  destY,
int  width,
int  height,
uint32  key 
)
inline

Copy a bitmap to the internal buffer of the surface.

The pixel format of the buffer must match the pixel format of the surface.

◆ copyRectToSurfaceWithKey() [2/2]

void Graphics::ManagedSurface::copyRectToSurfaceWithKey ( const Graphics::Surface srcSurface,
int  destX,
int  destY,
const Common::Rect  subRect,
uint32  key 
)
inline

Copy a bitmap to the internal buffer of the surface.

The pixel format of the buffer must match the pixel format of the surface.

◆ copyFrom() [1/2]

void Graphics::ManagedSurface::copyFrom ( const ManagedSurface surf)

Copy the data from another surface, reinitializing the surface to match the dimensions of the passed surface.

◆ copyFrom() [2/2]

void Graphics::ManagedSurface::copyFrom ( const Surface surf)

Copy the data from another surface, reinitializing the surface to match the dimensions of the passed surface.

◆ convertFrom() [1/2]

void Graphics::ManagedSurface::convertFrom ( const ManagedSurface surf,
const PixelFormat fmt 
)

Convert the data from another surface to a given pixel format, reinitializing the surface to match the dimensions of the passed surface.

◆ convertFrom() [2/2]

void Graphics::ManagedSurface::convertFrom ( const Surface surf,
const PixelFormat fmt 
)

Convert the data from another surface to a given pixel format, reinitializing the surface to match the dimensions of the passed surface.

◆ scale()

ManagedSurface* Graphics::ManagedSurface::scale ( int16  newWidth,
int16  newHeight,
bool  filtering = false 
) const

Scale the data to the given size.

Parameters
newWidthThe resulting width.
newHeightThe resulting height.
filteringWhether or not to use bilinear filtering.

◆ rotoscale()

ManagedSurface* Graphics::ManagedSurface::rotoscale ( const TransformStruct transform,
bool  filtering = false 
) const

Rotoscale function; this returns a transformed version of this surface after rotation and scaling. Please do not use this if angle == 0, use plain old scaling function.

Parameters
transforma TransformStruct wrapping the required info.
See also
TransformStruct
Parameters
filteringWhether or not to use bilinear filtering.

◆ drawLine()

void Graphics::ManagedSurface::drawLine ( int  x0,
int  y0,
int  x1,
int  y1,
uint32  color 
)
inline

Draw a line.

◆ drawThickLine()

void Graphics::ManagedSurface::drawThickLine ( int  x0,
int  y0,
int  x1,
int  y1,
int  penX,
int  penY,
uint32  color 
)
inline

Draw a thick line.

◆ hLine()

void Graphics::ManagedSurface::hLine ( int  x,
int  y,
int  x2,
uint32  color 
)
inline

Draw a horizontal line.

◆ vLine()

void Graphics::ManagedSurface::vLine ( int  x,
int  y,
int  y2,
uint32  color 
)
inline

Draw a vertical line.

◆ fillRect()

void Graphics::ManagedSurface::fillRect ( Common::Rect  r,
uint32  color 
)
inline

Fill a rect with a given color.

◆ frameRect()

void Graphics::ManagedSurface::frameRect ( const Common::Rect r,
uint32  color 
)
inline

Draw a frame around a specified rect.

◆ detectAlpha()

AlphaType Graphics::ManagedSurface::detectAlpha ( ) const
inline

Checks if the given surface contains alpha transparency

◆ getSubArea()

Surface Graphics::ManagedSurface::getSubArea ( const Common::Rect area)
inline

Return a sub-area of the screen, but only add a single initial dirty rect for the retrieved area.

◆ convertToInPlace() [1/2]

void Graphics::ManagedSurface::convertToInPlace ( const PixelFormat dstFormat)
inline

Convert the data to another pixel format.

This works in-place. This means it does not create an additional buffer for the conversion process. The value of 'pixels' might change though (that means it might realloc the pixel data).

Parameters
dstFormatThe desired format.

◆ convertToInPlace() [2/2]

void Graphics::ManagedSurface::convertToInPlace ( const PixelFormat dstFormat,
const byte *  palette,
uint16  paletteCount 
)
inline

Convert the data to another pixel format.

This works in-place. This means it does not create an additional buffer for the conversion process. The value of 'pixels' might change though (that means it might realloc the pixel data).

Parameters
dstFormatThe desired format.
paletteThe palette (in RGB888), if the source format has one.
paletteCountThe number of colors in the palette.

◆ getTransparentColor()

uint Graphics::ManagedSurface::getTransparentColor ( ) const
inline

Return the current transparent color.

◆ setTransparentColor()

void Graphics::ManagedSurface::setTransparentColor ( uint32  color)
inline

Set the transparent color.

◆ clearTransparentColor()

void Graphics::ManagedSurface::clearTransparentColor ( )
inline

Clear the transparent color setting.

◆ hasTransparentColor()

bool Graphics::ManagedSurface::hasTransparentColor ( ) const
inline

Return true if a transparent color has been set.

◆ clearPalette()

void Graphics::ManagedSurface::clearPalette ( )

Clear any existing palette.

◆ hasPalette()

bool Graphics::ManagedSurface::hasPalette ( ) const

Return true if a palette has been set.

◆ grabPalette()

void Graphics::ManagedSurface::grabPalette ( byte *  colors,
uint  start,
uint  num 
) const

Grab the palette using RGB tuples.

◆ setPalette()

void Graphics::ManagedSurface::setPalette ( const byte *  colors,
uint  start,
uint  num 
)

Set the palette using RGB tuples.

Member Data Documentation

◆ w

int16& Graphics::ManagedSurface::w

Width of the surface rectangle.

◆ h

int16& Graphics::ManagedSurface::h

Height of the surface rectangle.

◆ pitch

int32& Graphics::ManagedSurface::pitch

Pitch of the surface rectangle. See Surface::pitch.

◆ format

PixelFormat& Graphics::ManagedSurface::format

Pixel format of the surface. See PixelFormat.


The documentation for this class was generated from the following file: