Drawing 2D vector graphics.
More...
#include <cc/Painter>
|
| | Painter (const Surface &surface) |
| | Create a new painter for surface.
|
| |
| | Painter (Surface::State *state) |
| | Create a new painter.
|
| |
| | ~Painter () |
| | Finish painting.
|
| |
| Painter & | save () |
| | Save painter state to the top of the state stack.
|
| |
| Painter & | restore () |
| | Restore painter state from the top of the state stack.
|
| |
| Painter & | nextPage (bool clear=true) |
| | Emit current page.
|
| |
|
| Painter & | newPath () |
| | Start a new path.
|
| |
| Painter & | newSubPath () |
| | Start a new sub-path without setting an initial current point.
|
| |
| Painter & | closePath () |
| | Close path with a line segment.
|
| |
| bool | hasCurrentPoint () const |
| | Check if there is a current point.
|
| |
| Point | currentPoint () const |
| | Get the current point.
|
| |
| Painter & | moveTo (Point c) |
| | Start a new sub-path starting at c.
|
| |
| Painter & | lineTo (Point c) |
| | Add a line segment to the path from the current point to the new current point c.
|
| |
| Painter & | curveTo (Point a, Point b, Point c) |
| | Add a cubic Bézier spline starting in the current point, spanning over control points a, b and ending in the new current point c.
|
| |
| Painter & | arcAround (Point b, double alpha) |
| | Add an arc that starts at the current point and circles around point b alpha radians (-2*pi to +2*pi)
|
| |
| Painter & | arc (Point m, double r, double alpha0=0, double alpha1=2 *M_PI) |
| | Add a circular arc of radius r centered at m starting at angle alpha0 and ending at angle alpha1 (in radians)
|
| |
| Painter & | arcNegative (Point m, double r, double alpha0, double alpha1) |
| | Add a circular arc with alpha1 < alpha0.
|
| |
| Painter & | rectangle (Point pos, Size size) |
| | Add a closed sub-path in form of a rectangle with top-left at pos and given dimensions size.
|
| |
| Rect | pathExtents () const |
| | Get the current path's extents.
|
| |
| Rect | fillExtents () const |
| | Get the current path's exact rasterization extents.
|
| |
| Painter & | addPath (const Path &path) |
| | Add path.
|
| |
Drawing 2D vector graphics.
- Exceptions
-
- Todo
make showGlyphRun() and showTextRun() use the currentPoint() as baseline start
remove arcNegative() (automatically select the proper method)
◆ GetColor
Get color for a given byte offset.
◆ CurrentPath
Tells if to delete the current path after a stroke or fill operation.
| Enumerator |
|---|
| Clear | Clear the current path from the painting context
|
| Preserve | Preserve the painting context's current path
|
◆ Painter() [1/2]
Create a new painter for surface.
◆ Painter() [2/2]
◆ ~Painter()
◆ save()
Save painter state to the top of the state stack.
◆ restore()
Restore painter state from the top of the state stack.
◆ nextPage()
| Painter & nextPage |
( |
bool | clear = true | ) |
|
Emit current page.
- Parameters
-
| clear | Start with clean page |
◆ newPath()
◆ newSubPath()
Start a new sub-path without setting an initial current point.
◆ closePath()
Close path with a line segment.
◆ hasCurrentPoint()
| bool hasCurrentPoint |
( |
| ) |
const |
Check if there is a current point.
◆ currentPoint()
| Point currentPoint |
( |
| ) |
const |
◆ moveTo()
Start a new sub-path starting at c.
◆ lineTo()
Add a line segment to the path from the current point to the new current point c.
◆ curveTo()
Add a cubic Bézier spline starting in the current point, spanning over control points a, b and ending in the new current point c.
◆ arcAround()
Add an arc that starts at the current point and circles around point b alpha radians (-2*pi to +2*pi)
◆ arc()
| Painter & arc |
( |
Point | m, |
|
|
double | r, |
|
|
double | alpha0 = 0, |
|
|
double | alpha1 = 2 * M_PI ) |
Add a circular arc of radius r centered at m starting at angle alpha0 and ending at angle alpha1 (in radians)
◆ arcNegative()
| Painter & arcNegative |
( |
Point | m, |
|
|
double | r, |
|
|
double | alpha0, |
|
|
double | alpha1 ) |
Add a circular arc with alpha1 < alpha0.
◆ rectangle()
Add a closed sub-path in form of a rectangle with top-left at pos and given dimensions size.
◆ pathExtents()
| Rect pathExtents |
( |
| ) |
const |
Get the current path's extents.
◆ fillExtents()
| Rect fillExtents |
( |
| ) |
const |
Get the current path's exact rasterization extents.
◆ addPath()
◆ showGlyphRun() [1/2]
Show glyph run.
- Parameters
-
| pos | Baseline position |
| run | Glyph run |
◆ showGlyphRun() [2/2]
Show glyph run with additional colors.
- Parameters
-
| pos | Baseline position |
| run | Glyph run |
| ink | Foreground colors |
| paper | Background colors |
◆ showTextRun() [1/2]
Show text run.
- Parameters
-
| pos | Baseline position |
| run | Text run |
◆ showTextRun() [2/2]
Show text run with additional colors.
- Parameters
-
| pos | Baseline position |
| run | Text run |
| ink | Foreground colors |
| paper | Background colors |
◆ translate()
Move coordinate system by step.
◆ scale()
Scale coordinate system by ratio
◆ rotate()
Rotate coordinate system by angle (in radian)
◆ setPen() [1/2]
◆ setPen() [2/2]
Set source color and line style in one go
◆ fill()
Fill the current path.
- Parameters
-
| mode | Tells if to delete the current path after a stroke or fill operation. |
◆ stroke()
Stroke the outline of the current path.
- Parameters
-
| mode | Tells if to delete the current path after a stroke or fill operation. |