#include <VectorRendererSpec.h>
Public Member Functions | |
VectorRendererSpec (PixelFormat format) | |
void | drawLine (int x1, int y1, int x2, int y2) override |
void | drawCircle (int x, int y, int r) override |
void | drawSquare (int x, int y, int w, int h) override |
void | drawRoundedSquare (int x, int y, int r, int w, int h) override |
void | drawTriangle (int x, int y, int base, int height, TriangleOrientation orient) override |
void | drawTab (int x, int y, int r, int w, int h, int s) override |
void | drawBeveledSquare (int x, int y, int w, int h) override |
void | drawString (const Graphics::Font *font, const Common::U32String &text, const Common::Rect &area, Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, int deltax, bool elipsis, const Common::Rect &textDrawableArea=Common::Rect(0, 0, 0, 0)) override |
void | setFgColor (uint8 r, uint8 g, uint8 b) override |
void | setBgColor (uint8 r, uint8 g, uint8 b) override |
void | setBevelColor (uint8 r, uint8 g, uint8 b) override |
void | setGradientColors (uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2) override |
void | setClippingRect (const Common::Rect &clippingArea) override |
void | copyFrame (OSystem *sys, const Common::Rect &r) override |
void | copyWholeFrame (OSystem *sys) override |
void | fillSurface () override |
void | blitSurface (const Graphics::ManagedSurface *source, const Common::Rect &r) override |
void | blitManagedSurface (const Graphics::ManagedSurface *source, const Common::Point &p, Graphics::AlphaType alphaType) override |
void | applyScreenShading (GUI::ThemeEngine::ShadingStyle shadingStyle) override |
Public Member Functions inherited from Graphics::VectorRenderer | |
virtual void | drawCross (int x, int y, int w, int h) |
virtual void | setSurface (ManagedSurface *surface) |
virtual ManagedSurface * | getActiveSurface () |
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) |
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 | disableShadows () |
virtual void | enableShadows () |
Protected Member Functions | |
void | putPixel (int x, int y, PixelType color) |
void | blendPixel (int x, int y, PixelType color, uint8 alpha) |
void | blendPixelPtr (PixelType *ptr, PixelType color, uint8 alpha) |
void | blendPixelPtrClip (PixelType *ptr, PixelType color, uint8 alpha, int x, int y) |
void | blendPixelDestAlphaPtr (PixelType *ptr, PixelType color, uint8 alpha) |
virtual void | drawLineAlg (int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) |
virtual void | drawLineAlgClip (int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) |
virtual void | drawCircleAlg (int x, int y, int r, PixelType color, FillMode fill_m) |
virtual void | drawCircleAlgClip (int x, int y, int r, PixelType color, FillMode fill_m) |
virtual void | drawRoundedSquareAlg (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawRoundedSquareAlgClip (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawBorderRoundedSquareAlg (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m, uint8 alpha_t, uint8 alpha_r, uint8 alpha_b, uint8 alpha_l) |
virtual void | drawBorderRoundedSquareAlgClip (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m, uint8 alpha_t, uint8 alpha_r, uint8 alpha_b, uint8 alpha_l) |
virtual void | drawInteriorRoundedSquareAlg (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawInteriorRoundedSquareAlgClip (int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawSquareAlg (int x, int y, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawSquareAlgClip (int x, int y, int w, int h, PixelType color, FillMode fill_m) |
virtual void | drawTriangleHorzAlg (int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawTriangleHorzAlgClip (int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawTriangleFastH (int x, int y, int size, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawTriangleVertAlg (int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawTriangleVertAlgClip (int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawTriangleFastV (int x, int y, int size, bool inverted, PixelType color, FillMode fill_m) |
virtual void | drawBevelSquareAlg (int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color) |
virtual void | drawBevelSquareAlgClip (int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color) |
virtual void | drawTabAlg (int x, int y, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m, int baseLeft, int baseRight, bool vFlip) |
virtual void | drawTabAlgClip (int x, int y, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m, int baseLeft, int baseRight, bool vFlip) |
virtual void | drawTabShadow (int x, int y, int w, int h, int r, int offset, uint32 shadowIntensity, bool vFlip) |
virtual void | drawTabShadowClip (int x, int y, int w, int h, int r, int offset, uint32 shadowIntensity, bool vFlip) |
virtual void | drawBevelTabAlg (int x, int y, int w, int h, int bevel, PixelType topColor, PixelType bottomColor, int baseLeft, int baseRight, bool vFlip) |
virtual void | drawBevelTabAlgClip (int x, int y, int w, int h, int bevel, PixelType topColor, PixelType bottomColor, int baseLeft, int baseRight, bool vFlip) |
virtual void | drawSquareShadow (int x, int y, int w, int h, int offset) |
virtual void | drawSquareShadowClip (int x, int y, int w, int h, int offset) |
virtual void | drawRoundedSquareShadow (int x, int y, int r, int w, int h, int offset, uint32 shadowIntensity) |
virtual void | drawRoundedSquareShadowClip (int x, int y, int r, int w, int h, int offset, uint32 shadowIntensity) |
PixelType | calcGradient (uint32 pos, uint32 max) |
void | precalcGradient (int h) |
void | gradientFill (PixelType *first, int width, int x, int y) |
void | gradientFillClip (PixelType *first, int width, int x, int y, int realX, int realY) |
void | blendFill (PixelType *first, PixelType *last, PixelType color, uint8 alpha) |
void | blendFillClip (PixelType *first, PixelType *last, PixelType color, uint8 alpha, int realX, int realY) |
void | darkenFill (PixelType *first, PixelType *last) |
void | darkenFillClip (PixelType *first, PixelType *last, int x, int y) |
Protected Attributes | |
Common::Rect | _clippingArea |
const PixelFormat | _format |
const PixelType | _redMask |
const PixelType | _greenMask |
const PixelType | _blueMask |
const PixelType | _alphaMask |
PixelType | _fgColor |
PixelType | _bgColor |
PixelType | _gradientStart |
PixelType | _gradientEnd |
int | _gradientBytes [3] |
Common::Array< PixelType > | _gradCache |
Common::Array< int > | _gradIndexes |
PixelType | _bevelColor |
Protected Attributes inherited from Graphics::VectorRenderer | |
ManagedSurface * | _activeSurface |
FillMode | _fillMode |
ShadowFillMode | _shadowFillMode |
int | _shadowOffset |
int | _bevel |
bool | _disableShadows |
int | _strokeWidth |
uint32 | _dynamicData |
int | _gradientFactor |
uint32 | _shadowIntensity |
Additional Inherited Members | |
Public Types inherited from Graphics::VectorRenderer | |
enum | FillMode { kFillDisabled = 0, kFillForeground = 1, kFillBackground = 2, kFillGradient = 3 } |
enum | TriangleOrientation { kTriangleAuto = 0, kTriangleUp, kTriangleDown, kTriangleLeft, kTriangleRight } |
enum | ShadowFillMode { kShadowLinear = 0, kShadowExponential = 1 } |
VectorRendererSpec: Specialized Vector Renderer Class
This templated class implements the basic subset of vector operations for all platforms by allowing the user to provide the actual Pixel Type and pixel information structs.
This class takes two template parameters:
PixelType | Defines a type which may hold the color value of a single pixel, such as "byte" or "uint16" for 8 and 16 BPP respectively. |
TODO: Expand documentation.
|
overridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
inlineoverridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
overridevirtual |
Draws a string into the screen. Wrapper for the Graphics::Font string drawing method.
Implements Graphics::VectorRenderer.
|
inlineoverridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
inlineoverridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
overridevirtual |
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 |
Implements Graphics::VectorRenderer.
|
inlineoverridevirtual |
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.
Implements Graphics::VectorRenderer.
|
overridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
inlineoverridevirtual |
Copies the current surface to the system overlay
sys | Pointer to the global System class |
Implements Graphics::VectorRenderer.
|
overridevirtual |
Fills the active surface with the specified fg/bg color or the active gradient. Defaults to using the active Foreground color for filling.
Implements Graphics::VectorRenderer.
|
overridevirtual |
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. |
Implements Graphics::VectorRenderer.
|
overridevirtual |
Applies a whole-screen shading effect, used before opening a new dialog. Currently supports screen dimmings and luminance (b&w).
Implements Graphics::VectorRenderer.
|
inlineprotected |
Draws a single pixel on the surface with the given coordinates and the given color.
x | Horizontal coordinate of the pixel. |
y | Vertical coordinate of the pixel. |
color | Color of the pixel |
|
inlineprotected |
Blends a single pixel on the surface with the given coordinates, color and Alpha intensity.
x | Horizontal coordinate of the pixel. |
y | Vertical coordinate of the pixel. |
color | Color of the pixel |
alpha | Alpha intensity of the pixel (0-255) |
|
inlineprotected |
Blends a single pixel on the surface in the given pixel pointer, using supplied color and Alpha intensity.
This is implemented to prevent blendPixel() to calculate the surface pointer on each call. Optimized drawing algorithms should call this function when possible.
ptr | Pointer to the pixel to blend on top of |
color | Color of the pixel |
alpha | Alpha intensity of the pixel (0-255) |
|
inlineprotected |
Blends a single pixel on the surface in the given pixel pointer, using supplied color and Alpha intensity. If the destination pixel has 0 alpha, set the color and alpha channels, overwriting the destination pixel entirely. If the destination pixel has non-zero alpha, blend dest with src.
This is implemented to prevent blendPixel() to calculate the surface pointer on each call. Optimized drawing algorithms should call this function when possible.
ptr | Pointer to the pixel to blend on top of |
color | Color of the pixel |
alpha | Alpha intensity of the pixel (0-255) |
|
protectedvirtual |
PRIMITIVE DRAWING ALGORITHMS
Generic algorithms for drawing all kinds of aliased primitive shapes. These may be overloaded in inheriting classes to implement platform-specific optimizations or improve looks.
Reimplemented in Graphics::VectorRendererAA< PixelType >.
|
protectedvirtual |
SHADOW DRAWING ALGORITHMS
Optimized versions of the primitive drawing algorithms with alpha blending for shadow drawing. There functions may be overloaded in inheriting classes to improve performance in the slowest platforms where pixel alpha blending just doesn't cut it.
offset | Intensity/size of the shadow. |
|
inlineprotected |
Calculates the color gradient on a given point. This function assumes that the gradient start/end colors have been set beforehand from the API function call.
pos | Progress of the gradient. |
max | Maximum amount of the progress. |
|
inlineprotected |
Fills several pixels in a row with a given color and the specified alpha blending.
first | Pointer to the first pixel to fill. |
last | Pointer to the last pixel to fill. |
color | Color of the pixel |
alpha | Alpha intensity of the pixel (0-255) |
|
protected |
Foreground color currently being used to draw on the renderer
|
protected |
Background color currently being used to draw on the renderer
|
protected |
Start color for the fill gradient
|
protected |
End color for the fill gradient
|
protected |
Color bytes of the active gradient, used to speed up calculation