7#include "bezier_point.hpp"
8#include "bezier_curve.hpp"
9#include "exception.hpp"
10#include "geometry/axis_aligned_rectangle.hpp"
11#include "geometry/transform.hpp"
12#include "rapid/sfloat_rgba16.hpp"
13#include "rapid/sdf_r8.hpp"
96 [[nodiscard]]
color getColorOfLayer(
ssize_t layerNr) const noexcept;
98 void setColorOfLayer(
ssize_t layerNr,
color fill_color) noexcept;
142 void lineTo(
point2 position) noexcept;
144 void lineRelativeTo(
vector2 direction) noexcept;
146 void quadraticCurveTo(
point2 controlPosition,
point2 position) noexcept;
154 void cubicCurveTo(
point2 controlPosition1,
point2 controlPosition2,
point2 position) noexcept;
198 std::vector<bezier_point>::const_iterator
const &begin,
199 std::vector<bezier_point>::const_iterator
const &end)
noexcept;
216 LineJoinStyle lineJoinStyle = LineJoinStyle::Miter,
217 float tolerance = 0.05f) noexcept;
231 float strokeWidth = 1.0f,
232 LineJoinStyle lineJoinStyle = LineJoinStyle::Miter,
233 float tolerance = 0.05f) const noexcept;
249 for (
auto &&point : rhs_.
points) {
262void composit(pixel_map<sfloat_rgba16> &dst,
tt::color color, graphic_path
const &mask)
noexcept;
269void composit(pixel_map<sfloat_rgba16> &dst, graphic_path
const &mask)
noexcept;
275void fill(pixel_map<sdf_r8> &dst, graphic_path
const &path)
noexcept;
Definition bezier_curve.hpp:29
Definition bezier_point.hpp:18
This is a RGBA floating point color.
Definition color.hpp:36
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Definition corner_shapes.hpp:9
Class which represents an rectangle.
Definition rectangle.hpp:16
A path is a vector graphics object.
Definition graphic_path.hpp:28
bool hasLayers() const noexcept
This path has layers.
void quadraticCurveRelativeTo(vector2 controlDirection, vector2 direction) noexcept
Draw curve from the current position to the new direction.
std::vector< std::pair< ssize_t, color > > layerEndContours
An color and index into.
Definition graphic_path.hpp:39
std::vector< bezier_point >::const_iterator beginContour(ssize_t contourNr) const noexcept
Return an iterator to the start point of a contour.
void optimizeLayers() noexcept
Optimize layers.
ssize_t numberOfLayers() const noexcept
Return the number of closed layers.
void addContour(std::vector< bezier_point > const &contour) noexcept
Curve with the given bezier curve.
graphic_path toStroke(float strokeWidth=1.0f, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) const noexcept
Convert path to stroke-path.
void addContour(std::vector< bezier_curve > const &contour) noexcept
Contour with the given bezier curves.
void moveTo(point2 position) noexcept
Start a new contour at position.
void arcTo(float radius, point2 position) noexcept
Draw an circular arc.
void addPath(graphic_path const &path, color fill_color) noexcept
Add path and close layer.
bool isContourOpen() const noexcept
Return true if there is an open contour.
point2 currentPosition() const noexcept
Get the currentPosition of the open contour.
std::vector< ssize_t > contourEndPoints
An index into.
Definition graphic_path.hpp:35
void addCircle(point2 position, float radius) noexcept
Draw a circle.
void addStroke(graphic_path const &path, color strokeColor, float strokeWidth, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) noexcept
Stroke a path and close layer.
void closeLayer(color fill_color) noexcept
Close current contour.
aarectangle boundingBox() const noexcept
Calculate bounding box.
void closeContour() noexcept
Close current contour.
bool isLayerOpen() const noexcept
Return true if there is an open layer.
ssize_t numberOfContours() const noexcept
Return the number of closed contours.
void moveRelativeTo(vector2 direction) noexcept
Start a new contour relative to current position.
void addRectangle(aarectangle rectangle, corner_shapes corners=corner_shapes{0.0f, 0.0f, 0.0f, 0.0f}) noexcept
Draw a rectangle.
void tryRemoveLayers() noexcept
Try to move the layers in a path.
void clear() noexcept
Clear the path.
Definition graphic_path.hpp:43
void addContour(std::vector< bezier_point >::const_iterator const &begin, std::vector< bezier_point >::const_iterator const &end) noexcept
Curve with the given bezier curve.
std::vector< bezier_point > points
A set of all bezier points describing all bezier curves, contours and layers.
Definition graphic_path.hpp:31
bool allLayersHaveSameColor() const noexcept
Check if all layers have the same color.
graphic_path centerScale(extent2 extent, float padding=0.0) const noexcept
Center and scale a path inside the extent with padding.
void cubicCurveRelativeTo(vector2 controlDirection1, vector2 controlDirection2, vector2 direction) noexcept
Draw curve from the current position to the new direction.
Definition transform.hpp:83