ScummVM API documentation
Graphics::VectorRenderer Class Referenceabstract

#include <VectorRenderer.h>

Inheritance diagram for Graphics::VectorRenderer:
Graphics::VectorRendererSpec< PixelType > Graphics::VectorRendererAA< PixelType >

Public Types

enum  FillMode { kFillDisabled = 0, kFillForeground = 1, kFillBackground = 2, kFillGradient = 3 }
 
enum  TriangleOrientation {
  kTriangleAuto = 0, kTriangleUp, kTriangleDown, kTriangleLeft,
  kTriangleRight
}
 
enum  ShadowFillMode { kShadowLinear = 0, kShadowExponential = 1 }
 

Public Member Functions

virtual void drawLine (int x1, int y1, int x2, int y2)=0
 
virtual void drawCircle (int x, int y, int r)=0
 
virtual void drawSquare (int x, int y, int w, int h)=0
 
virtual void drawRoundedSquare (int x, int y, int r, int w, int h)=0
 
virtual void drawTriangle (int x, int y, int base, int height, TriangleOrientation orient)=0
 
virtual void drawBeveledSquare (int x, int y, int w, int h)=0
 
virtual void drawTab (int x, int y, int r, int w, int h, int s)=0
 
virtual void drawCross (int x, int y, int w, int h)
 
virtual void setFgColor (uint8 r, uint8 g, uint8 b)=0
 
virtual void setBgColor (uint8 r, uint8 g, uint8 b)=0
 
virtual void setBevelColor (uint8 r, uint8 g, uint8 b)=0
 
virtual void setGradientColors (uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2)=0
 
virtual void setSurface (ManagedSurface *surface)
 
virtual ManagedSurfacegetActiveSurface ()
 
virtual void fillSurface ()=0
 
virtual void clearSurface ()
 
virtual void setFillMode (FillMode mode)
 
virtual void setShadowFillMode (ShadowFillMode mode)
 
virtual void setStrokeWidth (int width)
 
virtual void setShadowOffset (int offset)
 
virtual void setBevel (int amount)
 
virtual void setGradientFactor (int factor)
 
virtual void setShadowIntensity (uint32 shadowIntensity)
 
virtual void setClippingRect (const Common::Rect &clippingArea)=0
 
void stepGetPositions (const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h)
 
int stepGetRadius (const DrawStep &step, const Common::Rect &area)
 
Common::Rect applyStepClippingRect (const Common::Rect &area, const Common::Rect &clip, const DrawStep &step)
 
void drawCallback_CIRCLE (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_SQUARE (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_LINE (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_ROUNDSQ (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_FILLSURFACE (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_TRIANGLE (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_BEVELSQ (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_TAB (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_BITMAP (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_CROSS (const Common::Rect &area, const DrawStep &step)
 
void drawCallback_VOID (const Common::Rect &area, const DrawStep &step)
 
virtual void drawStep (const Common::Rect &area, const Common::Rect &clip, const DrawStep &step, uint32 extra=0)
 
virtual void copyFrame (OSystem *sys, const Common::Rect &r)=0
 
virtual void copyWholeFrame (OSystem *sys)=0
 
virtual void blitSurface (const Graphics::ManagedSurface *source, const Common::Rect &r)=0
 
virtual void blitManagedSurface (const Graphics::ManagedSurface *source, const Common::Point &p)=0
 
virtual void drawString (const Graphics::Font *font, const Common::U32String &text, const Common::Rect &area, Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, int deltax, bool useEllipsis, const Common::Rect &textDrawableArea)=0
 
virtual void disableShadows ()
 
virtual void enableShadows ()
 
virtual void applyScreenShading (GUI::ThemeEngine::ShadingStyle)=0
 

Protected Attributes

ManagedSurface_activeSurface
 
FillMode _fillMode
 
ShadowFillMode _shadowFillMode
 
int _shadowOffset
 
int _bevel
 
bool _disableShadows
 
int _strokeWidth
 
uint32 _dynamicData
 
int _gradientFactor
 
uint32 _shadowIntensity
 

Detailed Description

VectorRenderer: The core Vector Renderer Class

This virtual class exposes the API with all the vectorial rendering functions that may be used to draw on a given Surface.

This class must be instantiated as one of its children, which implement the actual rendering functionality for each Byte Depth / Byte Format combination, and may also contain platform specific code.

When specifying define DISABLE_FANCY_THEMES eye candy related code gets stripped off. This is especially useful for small devices like NDS.

TODO: Expand documentation.

See also
VectorRendererSpec
VectorRendererAA

Member Enumeration Documentation

◆ FillMode

Specifies the way in which a shape is filled

Member Function Documentation

◆ drawLine()

virtual void Graphics::VectorRenderer::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)
pure virtual

Draws a line by considering the special cases for optimization.

Parameters
x1Horizontal (X) coordinate for the line start
x2Horizontal (X) coordinate for the line end
y1Vertical (Y) coordinate for the line start
y2Vertical (Y) coordinate for the line end

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawCircle()

virtual void Graphics::VectorRenderer::drawCircle ( int  x,
int  y,
int  r 
)
pure virtual

Draws a circle centered at (x,y) with radius r.

Parameters
xHorizontal (X) coordinate for the center of the circle
yVertical (Y) coordinate for the center of the circle
rRadius of the circle.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawSquare()

virtual void Graphics::VectorRenderer::drawSquare ( int  x,
int  y,
int  w,
int  h 
)
pure virtual

Draws a square starting at (x,y) with the given width and height.

Parameters
xHorizontal (X) coordinate for the center of the square
yVertical (Y) coordinate for the center of the square
wWidth of the square.
hHeight of the square

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawRoundedSquare()

virtual void Graphics::VectorRenderer::drawRoundedSquare ( int  x,
int  y,
int  r,
int  w,
int  h 
)
pure virtual

Draws a rounded square starting at (x,y) with the given width and height. The corners of the square are rounded with the given radius.

Parameters
xHorizontal (X) coordinate for the center of the square
yVertical (Y) coordinate for the center of the square
wWidth of the square.
hHeight of the square
rRadius of the corners.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawTriangle()

virtual void Graphics::VectorRenderer::drawTriangle ( int  x,
int  y,
int  base,
int  height,
TriangleOrientation  orient 
)
pure virtual

Draws a triangle starting at (x,y) with the given base and height. The triangle will always be isosceles, with the given base and height. The orientation parameter controls the position of the base of the triangle.

Parameters
xHorizontal (X) coordinate for the top left corner of the triangle
yVertical (Y) coordinate for the top left corner of the triangle
baseWidth of the base of the triangle
heightHeight of the triangle
orientOrientation of the triangle.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawBeveledSquare()

virtual void Graphics::VectorRenderer::drawBeveledSquare ( int  x,
int  y,
int  w,
int  h 
)
pure virtual

Draws a beveled square like the ones in the Classic GUI themes. Beveled squares are always drawn with a transparent background. Draw them on top of a standard square to fill it.

Parameters
xHorizontal (X) coordinate for the center of the square
yVertical (Y) coordinate for the center of the square
wWidth of the square.
hHeight of the square
bevelAmount of bevel. Must be positive.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawTab()

virtual void Graphics::VectorRenderer::drawTab ( int  x,
int  y,
int  r,
int  w,
int  h,
int  s 
)
pure virtual

Draws a tab-like shape, specially thought for the Tab widget. If a radius is given, the tab will have rounded corners. Otherwise, the tab will be squared.

Parameters
xHorizontal (X) coordinate for the tab
yVertical (Y) coordinate for the tab
wWidth of the tab
hHeight of the tab
rRadius of the corners of the tab (0 for squared tabs).
sShadow size

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawCross()

virtual void Graphics::VectorRenderer::drawCross ( int  x,
int  y,
int  w,
int  h 
)
inlinevirtual

Simple helper function to draw a cross.

◆ setFgColor()

virtual void Graphics::VectorRenderer::setFgColor ( uint8  r,
uint8  g,
uint8  b 
)
pure virtual

Set the active foreground painting color for the renderer. All the foreground drawing from then on will be done with that color, unless specified otherwise.

Foreground drawing means all outlines and basic shapes.

Parameters
rvalue of the red color byte
gvalue of the green color byte
bvalue of the blue color byte

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ setBgColor()

virtual void Graphics::VectorRenderer::setBgColor ( uint8  r,
uint8  g,
uint8  b 
)
pure virtual

Set the active background painting color for the renderer. All the background drawing from then on will be done with that color, unless specified otherwise.

Background drawing means all the shape filling.

Parameters
rvalue of the red color byte
gvalue of the green color byte
bvalue of the blue color byte

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ setGradientColors()

virtual void Graphics::VectorRenderer::setGradientColors ( uint8  r1,
uint8  g1,
uint8  b1,
uint8  r2,
uint8  g2,
uint8  b2 
)
pure virtual

Set the active gradient color. All shapes drawn using kFillGradient as their fill mode will use this VERTICAL gradient as their fill color.

Parameters
r1value of the red color byte for the start color
g1value of the green color byte for the start color
b1value of the blue color byte for the start color
r2value of the red color byte for the end color
g2value of the green color byte for the end color
b2value of the blue color byte for the end color

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ setSurface()

virtual void Graphics::VectorRenderer::setSurface ( ManagedSurface surface)
inlinevirtual

Sets the active drawing surface. All drawing from this point on will be done on that surface.

Parameters
surfacePointer to a Surface object.

◆ getActiveSurface()

virtual ManagedSurface* Graphics::VectorRenderer::getActiveSurface ( )
inlinevirtual

Returns the currently active drawing surface

◆ fillSurface()

virtual void Graphics::VectorRenderer::fillSurface ( )
pure virtual

Fills the active surface with the specified fg/bg color or the active gradient. Defaults to using the active Foreground color for filling.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ clearSurface()

virtual void Graphics::VectorRenderer::clearSurface ( )
inlinevirtual

Clears the active surface.

◆ setFillMode()

virtual void Graphics::VectorRenderer::setFillMode ( FillMode  mode)
inlinevirtual

Sets the active fill mode for all shapes.

See also
VectorRenderer::FillMode
Parameters
modeSpecified fill mode.

◆ setStrokeWidth()

virtual void Graphics::VectorRenderer::setStrokeWidth ( int  width)
inlinevirtual

Sets the stroke width. All shapes drawn with a stroke will have that width. Pass 0 to disable shape stroking.

Parameters
widthWidth of the stroke in pixels.

◆ setShadowOffset()

virtual void Graphics::VectorRenderer::setShadowOffset ( int  offset)
inlinevirtual

Enables adding shadows to all drawn primitives. Shadows are drawn automatically under the shapes. The given offset controls their intensity and size (the higher the offset, the bigger the shadows). If the offset is 0, no shadows are drawn.

Parameters
offsetShadow offset.

◆ setGradientFactor()

virtual void Graphics::VectorRenderer::setGradientFactor ( int  factor)
inlinevirtual

Sets the multiplication factor of the active gradient.

See also
_gradientFactor
Parameters
factorMultiplication factor.

◆ setShadowIntensity()

virtual void Graphics::VectorRenderer::setShadowIntensity ( uint32  shadowIntensity)
inlinevirtual

Sets the pixel interval for drawing shadows

Parameters
shadowIntensityinterval for drawing shadows

◆ setClippingRect()

virtual void Graphics::VectorRenderer::setClippingRect ( const Common::Rect clippingArea)
pure virtual

Sets the clipping rectangle to be used by draw calls.

Draw calls are restricted to pixels that are inside of the clipping rectangle. Pixels outside the clipping rectangle are not modified. To disable the clipping rectangle, call this method with a rectangle the same size as the target surface.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ stepGetPositions()

void Graphics::VectorRenderer::stepGetPositions ( const DrawStep step,
const Common::Rect area,
uint16 &  in_x,
uint16 &  in_y,
uint16 &  in_w,
uint16 &  in_h 
)

Translates the position data inside a DrawStep into actual screen drawing positions.

◆ stepGetRadius()

int Graphics::VectorRenderer::stepGetRadius ( const DrawStep step,
const Common::Rect area 
)

Translates the radius data inside a drawstep into the real radius for the shape. Used for automatic radius calculations.

◆ applyStepClippingRect()

Common::Rect Graphics::VectorRenderer::applyStepClippingRect ( const Common::Rect area,
const Common::Rect clip,
const DrawStep step 
)

Restrict a draw call clipping rect with a step specific clipping rect

◆ drawCallback_CIRCLE()

void Graphics::VectorRenderer::drawCallback_CIRCLE ( const Common::Rect area,
const DrawStep step 
)
inline

DrawStep callback functions for each drawing feature

◆ drawStep()

virtual void Graphics::VectorRenderer::drawStep ( const Common::Rect area,
const Common::Rect clip,
const DrawStep step,
uint32  extra = 0 
)
virtual

Draws the specified draw step on the screen.

See also
DrawStep
Parameters
areaZone to paint on
stepPointer to a DrawStep struct.

◆ copyFrame()

virtual void Graphics::VectorRenderer::copyFrame ( OSystem sys,
const Common::Rect r 
)
pure virtual

Copies the part of the current frame to the system overlay.

Parameters
sysPointer to the global System class
rZone of the surface to copy into the overlay.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ copyWholeFrame()

virtual void Graphics::VectorRenderer::copyWholeFrame ( OSystem sys)
pure virtual

Copies the current surface to the system overlay

Parameters
sysPointer to the global System class

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ blitSurface()

virtual void Graphics::VectorRenderer::blitSurface ( const Graphics::ManagedSurface source,
const Common::Rect r 
)
pure virtual

Blits a given graphics surface on top of the current drawing surface.

Note that the source surface and the active surface are expected to be of the same size, hence the area delimited by "r" in the source surface will be blitted into the area delimited by "r" on the current surface.

If you wish to blit a smaller surface into the active drawing area, use VectorRenderer::blitSubSurface().

Parameters
sourceSurface to blit into the drawing surface.
rPosition in the active drawing surface to do the blitting.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ drawString()

virtual void Graphics::VectorRenderer::drawString ( const Graphics::Font font,
const Common::U32String text,
const Common::Rect area,
Graphics::TextAlign  alignH,
GUI::ThemeEngine::TextAlignVertical  alignV,
int  deltax,
bool  useEllipsis,
const Common::Rect textDrawableArea 
)
pure virtual

Draws a string into the screen. Wrapper for the Graphics::Font string drawing method.

Implemented in Graphics::VectorRendererSpec< PixelType >.

◆ disableShadows()

virtual void Graphics::VectorRenderer::disableShadows ( )
inlinevirtual

Allows to temporarily enable/disable all shadows drawing. i.e. for performance issues, blitting, etc

◆ applyScreenShading()

virtual void Graphics::VectorRenderer::applyScreenShading ( GUI::ThemeEngine::ShadingStyle  )
pure virtual

Applies a whole-screen shading effect, used before opening a new dialog. Currently supports screen dimmings and luminance (b&w).

Implemented in Graphics::VectorRendererSpec< PixelType >.

Member Data Documentation

◆ _activeSurface

ManagedSurface* Graphics::VectorRenderer::_activeSurface
protected

Pointer to the surface currently being drawn

◆ _fillMode

FillMode Graphics::VectorRenderer::_fillMode
protected

Defines in which way (if any) are filled the drawn shapes

◆ _shadowOffset

int Graphics::VectorRenderer::_shadowOffset
protected

offset for drawn shadows

◆ _bevel

int Graphics::VectorRenderer::_bevel
protected

amount of fake bevel

◆ _disableShadows

bool Graphics::VectorRenderer::_disableShadows
protected

Disables temporarily shadow drawing for overlayed images.

◆ _strokeWidth

int Graphics::VectorRenderer::_strokeWidth
protected

Width of the stroke of all drawn shapes

◆ _dynamicData

uint32 Graphics::VectorRenderer::_dynamicData
protected

Dynamic data from the GUI Theme that modifies the drawing of the current shape

◆ _gradientFactor

int Graphics::VectorRenderer::_gradientFactor
protected

Multiplication factor of the active gradient

◆ _shadowIntensity

uint32 Graphics::VectorRenderer::_shadowIntensity
protected

Intensity of the shadow


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