#include <VectorRenderer.h>
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 ManagedSurface * | getActiveSurface () |
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, Graphics::AlphaType alphaType)=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 |
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.
Specifies the way in which a shape is filled
|
pure virtual |
Draws a line by considering the special cases for optimization.
x1 | Horizontal (X) coordinate for the line start |
x2 | Horizontal (X) coordinate for the line end |
y1 | Vertical (Y) coordinate for the line start |
y2 | Vertical (Y) coordinate for the line end |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
pure virtual |
Draws a circle centered at (x,y) with radius r.
x | Horizontal (X) coordinate for the center of the circle |
y | Vertical (Y) coordinate for the center of the circle |
r | Radius of the circle. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
pure virtual |
Draws a square starting at (x,y) with the given width and height.
x | Horizontal (X) coordinate for the center of the square |
y | Vertical (Y) coordinate for the center of the square |
w | Width of the square. |
h | Height of the square |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
x | Horizontal (X) coordinate for the center of the square |
y | Vertical (Y) coordinate for the center of the square |
w | Width of the square. |
h | Height of the square |
r | Radius of the corners. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
x | Horizontal (X) coordinate for the top left corner of the triangle |
y | Vertical (Y) coordinate for the top left corner of the triangle |
base | Width of the base of the triangle |
height | Height of the triangle |
orient | Orientation of the triangle. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
x | Horizontal (X) coordinate for the center of the square |
y | Vertical (Y) coordinate for the center of the square |
w | Width of the square. |
h | Height of the square |
bevel | Amount of bevel. Must be positive. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
x | Horizontal (X) coordinate for the tab |
y | Vertical (Y) coordinate for the tab |
w | Width of the tab |
h | Height of the tab |
r | Radius of the corners of the tab (0 for squared tabs). |
s | Shadow size |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
inlinevirtual |
Simple helper function to draw a cross.
|
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.
r | value of the red color byte |
g | value of the green color byte |
b | value of the blue color byte |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
r | value of the red color byte |
g | value of the green color byte |
b | value of the blue color byte |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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.
r1 | value of the red color byte for the start color |
g1 | value of the green color byte for the start color |
b1 | value of the blue color byte for the start color |
r2 | value of the red color byte for the end color |
g2 | value of the green color byte for the end color |
b2 | value of the blue color byte for the end color |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
inlinevirtual |
Sets the active drawing surface. All drawing from this point on will be done on that surface.
surface | Pointer to a Surface object. |
|
inlinevirtual |
Returns the currently active drawing surface
|
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 >.
|
inlinevirtual |
Clears the active surface.
|
inlinevirtual |
Sets the active fill mode for all shapes.
mode | Specified fill mode. |
|
inlinevirtual |
Sets the stroke width. All shapes drawn with a stroke will have that width. Pass 0 to disable shape stroking.
width | Width of the stroke in pixels. |
|
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.
offset | Shadow offset. |
|
inlinevirtual |
Sets the multiplication factor of the active gradient.
factor | Multiplication factor. |
|
inlinevirtual |
Sets the pixel interval for drawing shadows
shadowIntensity | interval for drawing shadows |
|
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 >.
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.
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.
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
|
inline |
DrawStep callback functions for each drawing feature
|
virtual |
|
pure virtual |
Copies the part of the current frame to the system overlay.
sys | Pointer to the global System class |
r | Zone of the surface to copy into the overlay. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
pure virtual |
Copies the current surface to the system overlay
sys | Pointer to the global System class |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
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().
source | Surface to blit into the drawing surface. |
r | Position in the active drawing surface to do the blitting. |
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
pure virtual |
Draws a string into the screen. Wrapper for the Graphics::Font string drawing method.
Implemented in Graphics::VectorRendererSpec< PixelType >.
|
inlinevirtual |
Allows to temporarily enable/disable all shadows drawing. i.e. for performance issues, blitting, etc
|
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 >.
|
protected |
Pointer to the surface currently being drawn
|
protected |
Defines in which way (if any) are filled the drawn shapes
|
protected |
offset for drawn shadows
|
protected |
amount of fake bevel
|
protected |
Disables temporarily shadow drawing for overlayed images.
|
protected |
Width of the stroke of all drawn shapes
|
protected |
Dynamic data from the GUI Theme that modifies the drawing of the current shape
|
protected |
Multiplication factor of the active gradient
|
protected |
Intensity of the shadow