6#include "TTauri/Foundation/BezierPoint.hpp"
7#include "TTauri/Foundation/attributes.hpp"
8#include "TTauri/Foundation/TTauriIconParser.hpp"
9#include "TTauri/Foundation/ResourceView.hpp"
10#include "TTauri/Foundation/exceptions.hpp"
11#include "TTauri/Foundation/vec.hpp"
12#include "TTauri/Foundation/aarect.hpp"
13#include "TTauri/Foundation/mat.hpp"
14#include "TTauri/Foundation/R16G16B16A16SFloat.hpp"
15#include "TTauri/Foundation/SDF8.hpp"
21template<
typename T>
struct PixelMap;
92 [[nodiscard]]
std::vector<
BezierCurve> getBeziers() const noexcept;
96 [[nodiscard]]
vec getColorOfLayer(
ssize_t layerNr) const noexcept;
98 void setColorOfLayer(
ssize_t layerNr,
vec fillColor) noexcept;
142 void lineTo(
vec position) noexcept;
144 void lineRelativeTo(
vec direction) noexcept;
146 void quadraticCurveTo(
vec controlPosition,
vec position) noexcept;
154 void cubicCurveTo(
vec controlPosition1,
vec controlPosition2,
vec position) noexcept;
196 void addContour(std::vector<BezierPoint>::const_iterator
const &begin, std::vector<BezierPoint>::const_iterator
const &end)
noexcept;
209 void addStroke(
Path const &path,
vec strokeColor,
float strokeWidth, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter,
float tolerance=0.05f) noexcept;
222 [[nodiscard]]
Path toStroke(
float strokeWidth=1.0f, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter,
float tolerance=0.05f) const noexcept;
228 Path &operator+=(
Path const &rhs) noexcept;
230 [[nodiscard]] friend
Path operator+(
Path lhs,
Path const &rhs) noexcept {
234 template<
typename M, std::enable_if_t<is_mat_v<M>,
int> = 0>
235 Path &operator*=(M
const &rhs)
noexcept {
236 for (
auto &&point:
points) {
242 template<
typename M, std::enable_if_t<is_mat_v<M>,
int> = 0>
243 friend Path operator*(M
const &lhs, Path rhs)
noexcept {
258void composit(PixelMap<R16G16B16A16SFloat>& dst, vec color, Path
const &mask)
noexcept;
265void composit(PixelMap<R16G16B16A16SFloat>& dst, Path
const &mask)
noexcept;
271void fill(PixelMap<SDF8> &dst, Path
const &path)
noexcept;
280 if (location.extension() ==
"tticon") {
281 ttlet view = location.loadView();
284 return std::make_unique<Path>(parseTTauriIcon(*view));
286 e.set<url_tag>(location);
291 TTAURI_THROW(url_error(
"Unknown extension")
292 .set<url_tag>(location)
Class which represents an axis-aligned rectangle.
Definition aarect.hpp:13
Definition BezierCurve.hpp:25
Definition BezierPoint.hpp:17
ssize_t numberOfLayers() const noexcept
bool isContourOpen() const noexcept
bool isLayerOpen() const noexcept
std::vector< BezierPoint >::const_iterator beginContour(ssize_t contourNr) const noexcept
void tryRemoveLayers() noexcept
void quadraticCurveRelativeTo(vec controlDirection, vec direction) noexcept
aarect boundingBox() const noexcept
Calculate bounding box.
void clear() noexcept
Clear the path.
Definition Path.hpp:44
void arcTo(float radius, vec position) noexcept
void addContour(std::vector< BezierPoint > const &contour) noexcept
void addStroke(Path const &path, vec strokeColor, float strokeWidth, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) noexcept
bool hasLayers() const noexcept
Path centerScale(vec extent, float padding=0.0) const noexcept
Center and scale a path inside the extent with padding.
std::vector< ssize_t > contourEndPoints
Definition Path.hpp:36
bool allLayersHaveSameColor() const noexcept
void addContour(std::vector< BezierPoint >::const_iterator const &begin, std::vector< BezierPoint >::const_iterator const &end) noexcept
Path toStroke(float strokeWidth=1.0f, LineJoinStyle lineJoinStyle=LineJoinStyle::Miter, float tolerance=0.05f) const noexcept
std::vector< std::pair< ssize_t, vec > > layerEndContours
Definition Path.hpp:40
void addRectangle(aarect r, vec corners={0.0f, 0.0f, 0.0f, 0.0f}) noexcept
ssize_t numberOfContours() const noexcept
void optimizeLayers() noexcept
Optimize layers.
void closeLayer(vec fillColor) noexcept
std::vector< BezierPoint > points
Definition Path.hpp:32
void moveTo(vec position) noexcept
vec currentPosition() const noexcept
void moveRelativeTo(vec direction) noexcept
void addPath(Path const &path, vec fillColor) noexcept
void addContour(std::vector< BezierCurve > const &contour) noexcept
void addCircle(vec position, float radius) noexcept
void cubicCurveRelativeTo(vec controlDirection1, vec controlDirection2, vec direction) noexcept
void closeContour() noexcept
A 4D vector.
Definition vec.hpp:37