|
CoreComponents 4.0.0
A Modern C++ Toolkit
|
Drawing 2D vector graphics. More...
#include <cc/Painter>
Public Types | |
| using | GetColor = Function< Color(int)> |
| Get color for a given byte offset. | |
Drawing | |
| enum class | CurrentPath { Clear , Preserve } |
| Tells if to delete the current path after a stroke or fill operation. More... | |
| Painter & | setPen (Color color) |
| Set source color | |
| Painter & | setPen (const Pen &pen) |
| Set source color and line style in one go | |
| Painter & | fill (CurrentPath mode=CurrentPath::Clear) |
| Fill the current path. | |
| Painter & | stroke (CurrentPath mode=CurrentPath::Clear) |
| Stroke the outline of the current path. | |
Painter State | |
| 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. | |
Path Creation | |
| 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. | |
Text Rendering | |
| Painter & | showGlyphRun (Point pos, const GlyphRun &run) |
| Show glyph run. | |
| Painter & | showGlyphRun (Point pos, const GlyphRun &run, const GetColor &ink, const GetColor &paper=GetColor{}) |
| Show glyph run with additional colors. | |
| Painter & | showTextRun (Point pos, const TextRun &run) |
| Show text run. | |
| Painter & | showTextRun (Point pos, const TextRun &run, const GetColor &ink, const GetColor &paper) |
| Show text run with additional colors. | |
Coordinate System Transformations | |
| Painter & | translate (Step step) |
| Move coordinate system by step. | |
| Painter & | scale (Scale ratio) |
| Scale coordinate system by ratio | |
| Painter & | rotate (double angle) |
| Rotate coordinate system by angle (in radian) | |
Drawing 2D vector graphics.
| PainterError |
make showGlyphRun() and showTextRun() use the currentPoint() as baseline start
remove arcNegative() (automatically select the proper method)
|
strong |
|
explicit |
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.
| clear | Start with clean 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.
Add a line segment to the path from the current point to the new current 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.
Add an arc that starts at the current point and circles around point b alpha radians (-2*pi to +2*pi)
Add a circular arc of radius r centered at m starting at angle alpha0 and ending at angle alpha1 (in radians)
Add a circular arc with alpha1 < alpha0.
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.
Show glyph run.
| pos | Baseline position |
| run | Glyph run |
| Painter & showGlyphRun | ( | Point | pos, |
| const GlyphRun & | run, | ||
| const GetColor & | ink, | ||
| const GetColor & | paper = GetColor{} |
||
| ) |
Show glyph run with additional colors.
| pos | Baseline position |
| run | Glyph run |
| ink | Foreground colors |
| paper | Background colors |
Show text run.
| pos | Baseline position |
| run | Text run |
| Painter & showTextRun | ( | Point | pos, |
| const TextRun & | run, | ||
| const GetColor & | ink, | ||
| const GetColor & | paper | ||
| ) |
Show text run with additional colors.
| pos | Baseline position |
| run | Text run |
| ink | Foreground colors |
| paper | Background colors |
| Painter & rotate | ( | double | angle | ) |
Rotate coordinate system by angle (in radian)
| Painter & fill | ( | CurrentPath | mode = CurrentPath::Clear | ) |
Fill the current path.
| mode | Tells if to delete the current path after a stroke or fill operation. |
| Painter & stroke | ( | CurrentPath | mode = CurrentPath::Clear | ) |
Stroke the outline of the current path.
| mode | Tells if to delete the current path after a stroke or fill operation. |