3#include "sdl_painter/export.h"
4#include "sdl_painter/geometry.h"
10namespace sdl_painter {
17inline constexpr float kDefaultFlatness = 0.25F;
75 explicit Path(
float flatness);
101 void QuadTo(
float cx,
float cy,
float x,
float y);
116 void CubicTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
138 [[nodiscard]]
bool IsEmpty() const noexcept;
141 [[nodiscard]]
Point CurrentPoint() const noexcept {
return mCurrent; }
144 [[nodiscard]]
const std::vector<SubPath>&
SubPaths() const noexcept {
149 [[nodiscard]]
float Flatness() const noexcept {
return mFlatness; }
156 void AppendPoint(const
Point& point);
163 void DropDegenerateSubPath();
170 void EnsureStarted();
180 [[nodiscard]] int32_t SegmentsForCurve(
float second_derivative_bound) const;
187 static constexpr int32_t kMaxCurveSegments = 256;
189 std::vector<
SubPath> mSubPaths;
201 bool mPendingStart{
false};
203 float mFlatness{kDefaultFlatness};
Doğru parçaları ve Bézier eğrilerinden oluşan çizim yolu.
Definition path.h:66
void MoveTo(float x, float y)
Yeni bir alt yol başlat ve imleci oraya taşı.
void QuadTo(float cx, float cy, float x, float y)
İkinci dereceden (quadratic) Bézier eğrisi ekle.
void LineTo(float x, float y)
İmleçten verilen noktaya doğru parçası ekle.
void Close()
Yürürlükteki alt yolu kapat.
void CubicTo(const Point &control1, const Point &control2, const Point &end)
Üçüncü dereceden (cubic) Bézier eğrisi ekle.
void MoveTo(const Point &point)
Yeni bir alt yol başlat ve imleci oraya taşı.
void LineTo(const Point &point)
İmleçten verilen noktaya doğru parçası ekle.
void Clear() noexcept
Tüm alt yolları sil; tolerans korunur.
Path(float flatness)
Düzleştirme toleransını belirterek boş yol oluştur.
float Flatness() const noexcept
Yürürlükteki düzleştirme toleransı (piksel).
Definition path.h:149
const std::vector< SubPath > & SubPaths() const noexcept
Düzleştirilmiş alt yollar.
Definition path.h:144
void QuadTo(const Point &control, const Point &end)
İkinci dereceden (quadratic) Bézier eğrisi ekle.
void CubicTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
Üçüncü dereceden (cubic) Bézier eğrisi ekle.
Path()=default
Varsayılan toleransla (kDefaultFlatness) boş yol.
std::size_t PointCount() const noexcept
Bu yolun toplam nokta sayısı (tanı ve test için).
2B nokta — float koordinatlar.
Definition geometry.h:8
Bir Path içindeki tek parça — düzleştirilmiş nokta dizisi.
Definition path.h:23
std::vector< Point > points
Parçanın noktaları (en az bir tane).
Definition path.h:25
bool closed
Path::Close ile kapatıldı mı?
Definition path.h:31