![]() |
Iridescence 1.00
Embedded Graphic Framework
|
DsRenderer is a class that implements all the drawing operations. More...
#include <ds_renderer.h>
Public Member Functions | |
void | setSurface (DsSurface &surface) |
Sets the underlying surface used for drawing. | |
DsSurface & | getSurface (void) |
Gets the underlying surface used for drawing. | |
void | pushClipRegion (DsRegion ®ion) |
Pushes a clipping region to the clipping region stack. | |
void | popClipRegion (void) |
Pops a clipping region from the clipping region stack. | |
void | unrollClipRegions (uint8_t level) |
Unrolls the clipping region stack back to a specific number of clip regions. | |
void | clearClipRegions (void) |
Clears all the clipping regions. | |
DsRenderer | newRenderer (DsSurface &surface) |
Creates a new child renderer for the specified surface. | |
void | setSupersampling (int32_t ss) |
Sets the supersampling factor. | |
void | drawLine (DsPoint p0, DsPoint p1, DsColor color) |
Draws a non-antialiased line of thickness 1 in between two points. | |
void | drawRectangle (DsRect rect, uint16_t thickness, DsColor color) |
Draws a rectangle with lines of specified thickness. | |
void | drawRoundedRectangle (DsRect rect, DsColor color, uint16_t corner_radius) |
Draws a non-antialiased rectangle with rounded corners using lines of thickness 1. | |
void | drawRoundedRectangle (DsRect rect, DsColor color, uint16_t corner_radius_tl, uint16_t corner_radius_tr, uint16_t corner_radius_br, uint16_t corner_radius_bl) |
Draws a non-antialiased rectangle with rounded corners using lines of thickness 1. | |
void | fillRectangle (DsRect rect, DsColor color) |
Fills a rectangle using the specified color. | |
void | fillRoundedRectangle (DsRect rect, DsColor color, uint16_t corner_radius) |
Fills a rectangle with rounded corners using the specified color. | |
void | fillRoundedRectangle (DsRect rect, DsColor color, uint16_t corner_radius_tl, uint16_t corner_radius_tr, uint16_t corner_radius_br, uint16_t corner_radius_bl) |
Fills a rectangle with rounded corners using the specified color. | |
void | drawPoly (const DsPoint *points, uint32_t np, DsColor color) |
Draws a non-antialiased closed polygon using lines of thickness 1. | |
void | fillPoly (const DsPoint *points, uint32_t np, DsColor color) |
Fills a non-antialiased closed polygon. | |
void | drawCircle (DsFPoint center, float radius, float thickness, DsColor color) |
Draws a non-antialiased circle of specified thickness. | |
void | fillCircle (DsFPoint center, float radius, DsColor color) |
Fills a non-antialiased circle. | |
void | drawEllipse (DsEllipse ellipse, float thickness, DsColor color) |
Draws a non-antialiased ellipse of specified thickness. | |
void | fillEllipse (DsEllipse ellipse, DsColor color) |
Fills a non-antialiased ellipse. | |
void | drawEllipseArc (DsEllipse ellipse, float thickness, float start_angle, float end_angle, DsColor color) |
Draws a non-antialiased ellipse arc of specified thickness. | |
void | fillEllipseArc (DsEllipse ellipse, float start_angle, float end_angle, DsColor color) |
Fills a non-antialiased ellipse arc. | |
void | drawCircleArc (DsFPoint center, float radius, float thickness, float start_angle, float end_angle, DsColor color) |
Draws a non-antialiased circle arc of specified thickness. | |
void | fillCircleArc (DsFPoint center, float radius, float start_angle, float end_angle, DsColor color) |
Fills a non-antialiased circle arc. | |
void | drawLineAA (const DsFPoint &p0, const DsFPoint &p1, float thickness, DsColor color) |
Draws an antialiased line of specified thickness between two points. | |
void | drawPolyAA (const DsFPoint *points, uint32_t np, float thickness, DsColor color) |
Draws an antialiased closed polygon using lines of specified thickness. | |
void | fillPolyAA (const DsFPoint *points, uint32_t np, DsColor color) |
Fills an antialiased closed polygon. | |
void | fillRectangleAA (DsFRect rect, DsColor color) |
Fills an antialiased rectangle using the specified color. | |
void | drawRoundedRectangleAA (DsFRect rect, DsColor color, float thickness, float corner_radius) |
Draws an antialiased rectangle with rounded corners and lines of specified thickness. | |
void | drawRoundedRectangleAA (DsFRect rect, DsColor color, float thickness, float corner_radius_tl, float corner_radius_tr, float corner_radius_br, float corner_radius_bl) |
Draws an antialiased rectangle with rounded corners and lines of specified thickness. | |
void | fillRoundedRectangleAA (DsFRect rect, DsColor color, float corner_radius) |
Fills an antialiased rectangle with rounded corners using the specified color. | |
void | fillRoundedRectangleAA (DsFRect rect, DsColor color, float corner_radius_tl, float corner_radius_tr, float corner_radius_br, float corner_radius_bl) |
Fills an antialiased rectangle with rounded corners using the specified color. | |
void | drawEllipseAA (DsEllipse ellipse, float thickness, DsColor color) |
Draws an antialiased ellipse of specified thickness. | |
void | fillEllipseAA (DsEllipse ellipse, DsColor color) |
Fills an antialiased ellipse. | |
void | drawCircleAA (DsFPoint center, float radius, float thickness, DsColor color) |
Draws an antialiased circle of specified thickness. | |
void | fillCircleAA (DsFPoint center, float radius, DsColor color) |
Fills an antialiased circle. | |
void | drawEllipseArcAA (DsEllipse ellipse, float thickness, float start, float end, DsColor color) |
Draws an antialiased ellipse arc of specified thickness. | |
void | fillEllipseArcAA (DsEllipse ellipse, float start, float end, DsColor color) |
Fills an antialiased ellipse arc. | |
void | drawCircleArcAA (DsFPoint center, float radius, float thickness, float start, float end, DsColor color) |
Draws an antialiased circle arc of specified thickness. | |
void | fillCircleArcAA (DsFPoint center, float radius, float start, float end, DsColor color) |
Fills an antialiased circle arc. | |
DsRect | renderText (DsPoint pos, const ds_bitmap_font_t *font, DsColor color, const char *text, size_t length=DsString::npos) |
Renders text. | |
DsRect | renderMultilineText (DsPoint pos, const ds_bitmap_font_t *font, DsColor color, const DsAlignment &line_alignment, float row_spacing, const char *text, size_t length=DsString::npos) |
Renders multiline text. It does this by interpreting the CR and LF characters. | |
DsRect | renderTextAligned (const DsRect &boundary, const DsAlignment &alignment, const DsPoint &offset, const ds_bitmap_font_t *font, DsColor color, const char *text, size_t length=DsString::npos) |
Renders text in aligned mode. | |
DsRect | renderMultilineTextAligned (const DsRect &boundary, const DsAlignment &text_alignment, const DsPoint &offset, const ds_bitmap_font_t *font, DsColor color, const DsAlignment &line_alignment, float row_spacing, const char *text, size_t length=DsString::npos) |
Renders multiline text in aligned mode. It does this by interpreting the CR and LF characters. | |
DsRect | renderTextCentered (DsPoint pos, const ds_bitmap_font_t *font, DsColor color, const char *text, size_t length=DsString::npos) |
Renders text centered on a point. | |
DsRect | renderMultilineTextCentered (DsPoint pos, const ds_bitmap_font_t *font, DsColor color, const DsAlignment &line_alignment, float row_spacing, const char *text, size_t length=DsString::npos) |
Renders multiline text centered on a point. It does this by interpreting the CR and LF characters. | |
void | moveClipRegions (const DsFPoint &offset) |
Static Public Member Functions | |
static bool | clipLine (const DsRect &bounds, int32_t &x0, int32_t &y0, int32_t &x1, int32_t &y1) |
Friends | |
class | DsScreen |
DsRenderer is a class that implements all the drawing operations.
DsRenderer has member functions which perform both antialiased and non-antialiased drawing. The rendered holds a reference to a DsSurface which is the destination for all drawing operations. Use setSurface() / getSurface() to set and get the drawing surface. The antialiasing supersampling level can be set using the setSupersampling() member function.
|
inline |
Draws a non-antialiased circle of specified thickness.
center | Coordinate of the center |
radius | Radius in pixels |
thickness | Thickness in pixels |
color | Color to use |
|
inline |
Draws an antialiased circle of specified thickness.
center | Coordinate of the center |
radius | Radius in pixels |
thickness | Thickness in pixels |
color | Color to use |
|
inline |
Draws a non-antialiased circle arc of specified thickness.
center | Coordinate of the center |
radius | Radius in pixels |
thickness | Thickness in pixels |
start_angle | Start angle in degrees |
end_angle | End angle in degrees |
color | Color to use |
|
inline |
Draws an antialiased circle arc of specified thickness.
center | Coordinate of the center |
radius | Radius in pixels |
thickness | Thickness in pixels |
start | Start angle in degrees |
end | End angle in degrees |
color | Color to use |
Draws a non-antialiased ellipse of specified thickness.
The ellipse can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
thickness | Thickness in pixels |
color | Color to use |
Draws an antialiased ellipse of specified thickness.
The ellipse can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
thickness | Thickness in pixels |
color | Color to use |
void DsRenderer::drawEllipseArc | ( | DsEllipse | ellipse, |
float | thickness, | ||
float | start_angle, | ||
float | end_angle, | ||
DsColor | color | ||
) |
Draws a non-antialiased ellipse arc of specified thickness.
The ellipse arc can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
thickness | Thickness in pixels |
start_angle | Start angle in degrees |
end_angle | End angle in degrees |
color | Color to use |
void DsRenderer::drawEllipseArcAA | ( | DsEllipse | ellipse, |
float | thickness, | ||
float | start, | ||
float | end, | ||
DsColor | color | ||
) |
Draws an antialiased ellipse arc of specified thickness.
The ellipse arc can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
thickness | Thickness in pixels |
start | Start angle in degrees |
end | End angle in degrees |
color | Color to use |
Draws a non-antialiased line of thickness 1 in between two points.
p0 | First point |
p1 | Second point |
color | Color to use |
void DsRenderer::drawLineAA | ( | const DsFPoint & | p0, |
const DsFPoint & | p1, | ||
float | thickness, | ||
DsColor | color | ||
) |
Draws an antialiased line of specified thickness between two points.
p0 | First point |
p1 | Second point |
thickness | Thickness in pixels |
color | Color to use |
Draws a non-antialiased closed polygon using lines of thickness 1.
points | Pointer to an array of DsPoint objects defining the vertices |
np | Number of points in the "points" array (minimum 3) |
color | Color to use |
void DsRenderer::drawPolyAA | ( | const DsFPoint * | points, |
uint32_t | np, | ||
float | thickness, | ||
DsColor | color | ||
) |
Draws an antialiased closed polygon using lines of specified thickness.
points | Pointer to an array of DsFPoint objects defining the vertices |
np | Number of points in the "points" array (minimum 3) |
thickness | Line thickness in pixels |
color | Color to use |
Draws a rectangle with lines of specified thickness.
The rectangle size applies to the outside of the lines (in case the line thickness is higher than 1).
rect | The rectangle to draw |
thickness | Thickness in pixels of the lines used for drawing the rectangle |
color | Color to use |
Draws a non-antialiased rectangle with rounded corners using lines of thickness 1.
rect | The rectangle to draw |
color | Color to use |
corner_radius | Corner radius |
void DsRenderer::drawRoundedRectangle | ( | DsRect | rect, |
DsColor | color, | ||
uint16_t | corner_radius_tl, | ||
uint16_t | corner_radius_tr, | ||
uint16_t | corner_radius_br, | ||
uint16_t | corner_radius_bl | ||
) |
Draws a non-antialiased rectangle with rounded corners using lines of thickness 1.
rect | The rectangle to draw |
color | Color to use |
corner_radius_tl | Top left corner radius |
corner_radius_tr | Top right corner radius |
corner_radius_br | Bottom right corner radius |
corner_radius_bl | Bottom left corner radius |
|
inline |
Draws an antialiased rectangle with rounded corners and lines of specified thickness.
rect | The rectangle to draw |
color | Color to use |
thickness | Thickness in pixels of the lines used for drawing the rectangle |
corner_radius | Corner radius |
void DsRenderer::drawRoundedRectangleAA | ( | DsFRect | rect, |
DsColor | color, | ||
float | thickness, | ||
float | corner_radius_tl, | ||
float | corner_radius_tr, | ||
float | corner_radius_br, | ||
float | corner_radius_bl | ||
) |
Draws an antialiased rectangle with rounded corners and lines of specified thickness.
rect | The rectangle to draw |
color | Color to use |
thickness | Thickness in pixels of the lines used for drawing the rectangle |
corner_radius_tl | Top left corner radius |
corner_radius_tr | Top right corner radius |
corner_radius_br | Bottom right corner radius |
corner_radius_bl | Bottom left corner radius |
Fills a non-antialiased circle.
center | Coordinate of the center |
radius | Radius in pixels |
color | Color to use |
Fills an antialiased circle.
center | Coordinate of the center |
radius | Radius in pixels |
color | Color to use |
|
inline |
Fills a non-antialiased circle arc.
center | Coordinate of the center |
radius | Radius in pixels |
start_angle | Start angle in degrees |
end_angle | End angle in degrees |
color | Color to use |
|
inline |
Fills an antialiased circle arc.
center | Coordinate of the center |
radius | Radius in pixels |
start | Start angle in degrees |
end | End angle in degrees |
color | Color to use |
Fills a non-antialiased ellipse.
The ellipse can only be filled in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
color | Color to use |
Fills an antialiased ellipse.
The ellipse can only be filled in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
color | Color to use |
void DsRenderer::fillEllipseArc | ( | DsEllipse | ellipse, |
float | start_angle, | ||
float | end_angle, | ||
DsColor | color | ||
) |
Fills a non-antialiased ellipse arc.
The ellipse arc can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
start_angle | Start angle in degrees |
end_angle | End angle in degrees |
color | Color to use |
Fills an antialiased ellipse arc.
The ellipse arc can only be drawed in a fixed rotation, by specifying the X and Y radii.
ellipse | DsEllipse object describing the geometry of the ellipse |
start | Start angle in degrees |
end | End angle in degrees |
color | Color to use |
Fills a non-antialiased closed polygon.
points | Pointer to an array of DsPoint objects defining the vertices |
np | Number of points in the "points" array (minumum 3) |
color | Color to use |
Fills an antialiased closed polygon.
points | Pointer to an array of DsFPoint objects defining the vertices |
np | Number of points in the "points" array (minimum 3) |
color | Color to use |
Fills a rectangle using the specified color.
rect | The rectangle to draw |
color | Color to use |
Fills an antialiased rectangle using the specified color.
rect | The rectangle to draw |
color | Color to use |
Fills a rectangle with rounded corners using the specified color.
rect | The rectangle to draw |
color | Color to use |
corner_radius | Corner radius |
void DsRenderer::fillRoundedRectangle | ( | DsRect | rect, |
DsColor | color, | ||
uint16_t | corner_radius_tl, | ||
uint16_t | corner_radius_tr, | ||
uint16_t | corner_radius_br, | ||
uint16_t | corner_radius_bl | ||
) |
Fills a rectangle with rounded corners using the specified color.
rect | The rectangle to draw |
color | Color to use |
corner_radius_tl | Top left corner radius |
corner_radius_tr | Top right corner radius |
corner_radius_br | Bottom right corner radius |
corner_radius_bl | Bottom left corner radius |
Fills an antialiased rectangle with rounded corners using the specified color.
rect | The rectangle to draw |
color | Color to use |
corner_radius | Corner radius |
void DsRenderer::fillRoundedRectangleAA | ( | DsFRect | rect, |
DsColor | color, | ||
float | corner_radius_tl, | ||
float | corner_radius_tr, | ||
float | corner_radius_br, | ||
float | corner_radius_bl | ||
) |
Fills an antialiased rectangle with rounded corners using the specified color.
rect | The rectangle to draw |
color | Color to use |
corner_radius_tl | Top left corner radius |
corner_radius_tr | Top right corner radius |
corner_radius_br | Bottom right corner radius |
corner_radius_bl | Bottom left corner radius |
DsSurface & DsRenderer::getSurface | ( | void | ) |
Gets the underlying surface used for drawing.
DsRenderer DsRenderer::newRenderer | ( | DsSurface & | surface | ) |
Creates a new child renderer for the specified surface.
The new child rendered shares all resources with the parent renderer.
surface | The DsSurface object |
void DsRenderer::pushClipRegion | ( | DsRegion & | region | ) |
Pushes a clipping region to the clipping region stack.
region | Clipping region. This is a class derived from DsRegion. |
DsRect DsRenderer::renderMultilineText | ( | DsPoint | pos, |
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const DsAlignment & | line_alignment, | ||
float | row_spacing, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders multiline text. It does this by interpreting the CR and LF characters.
pos | Coordinate of the rendering operation |
font | Pointer to the font to use |
color | Text color |
line_alignment | The line alignment mode |
row_spacing | Row spacing multiplier (1.0 means keep original font row spacing) |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
DsRect DsRenderer::renderMultilineTextAligned | ( | const DsRect & | boundary, |
const DsAlignment & | text_alignment, | ||
const DsPoint & | offset, | ||
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const DsAlignment & | line_alignment, | ||
float | row_spacing, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders multiline text in aligned mode. It does this by interpreting the CR and LF characters.
boundary | Rectangle representing the boundary for rendering the text |
alignment | The alighment mode inside the boundary |
ofset | The offset to apply to the aligned text |
font | Pointer to the font to use |
color | Text color |
line_alignment | The line alignment mode |
row_spacing | Row spacing multiplier (1.0 means keep original font row spacing) |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
DsRect DsRenderer::renderMultilineTextCentered | ( | DsPoint | pos, |
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const DsAlignment & | line_alignment, | ||
float | row_spacing, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders multiline text centered on a point. It does this by interpreting the CR and LF characters.
pos | The position to center the text on |
font | Pointer to the font to use |
color | Text color |
line_alignment | The line alignment mode |
row_spacing | Row spacing multiplier (1.0 means keep original font row spacing) |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
DsRect DsRenderer::renderText | ( | DsPoint | pos, |
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders text.
pos | Coordinate of the rendering operation |
font | Pointer to the font to use |
color | Text color |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
DsRect DsRenderer::renderTextAligned | ( | const DsRect & | boundary, |
const DsAlignment & | alignment, | ||
const DsPoint & | offset, | ||
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders text in aligned mode.
boundary | Rectangle representing the boundary for rendering the text |
alignment | The alighment mode inside the boundary |
ofset | The offset to apply to the aligned text |
font | Pointer to the font to use |
color | Text color |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
DsRect DsRenderer::renderTextCentered | ( | DsPoint | pos, |
const ds_bitmap_font_t * | font, | ||
DsColor | color, | ||
const char * | text, | ||
size_t | length = DsString::npos |
||
) |
Renders text centered on a point.
pos | The position to center the text on |
font | Pointer to the font to use |
color | Text color |
text | Null termianted string representing the text to render |
length | Maximum number of characters to render (default is all characters) |
void DsRenderer::setSupersampling | ( | int32_t | ss | ) |
Sets the supersampling factor.
ss | Supersampling factor [1 .. 5]. A higher factor produces better antialiased results but requires more processing power. The default value is 3. |
void DsRenderer::setSurface | ( | DsSurface & | surface | ) |
Sets the underlying surface used for drawing.
surface | The DsSurface object |
void DsRenderer::unrollClipRegions | ( | uint8_t | level | ) |
Unrolls the clipping region stack back to a specific number of clip regions.
level | Number of levels to leave in the stack |