载入中...
搜索中...
未找到
PrimitivePath.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <glm/vec2.hpp>
6
7#include <cstdint>
8#include <vector>
9
10namespace eve::graphics {
11
13enum class PathFillRule : std::uint8_t { NonZero, EvenOdd };
14
17 std::vector<glm::vec2> points;
18 bool closed = false;
19};
20
28public:
30 Path2D& moveTo(glm::vec2 point);
32 Path2D& lineTo(glm::vec2 point);
34 Path2D& quadTo(glm::vec2 control, glm::vec2 point);
36 Path2D& cubicTo(glm::vec2 control1, glm::vec2 control2, glm::vec2 point);
38 Path2D& close();
40 void clear() noexcept;
41
47 [[nodiscard]] std::vector<FlattenedContour2D> flatten(float tolerance = 0.25f, std::uint32_t maxDepth = 12) const;
48
49 void setFillRule(PathFillRule rule) noexcept { fillRule_ = rule; }
51 [[nodiscard]] PathFillRule fillRule() const noexcept { return fillRule_; }
53 [[nodiscard]] bool empty() const noexcept { return verbs_.empty(); }
54
55private:
56 enum class Verb : std::uint8_t { Move, Line, Quad, Cubic, Close };
57
58 std::vector<Verb> verbs_;
59 std::vector<glm::vec2> points_;
60 PathFillRule fillRule_ = PathFillRule::NonZero;
61 bool contourOpen_ = false;
62};
63
64} // namespace eve::graphics
#define EVENGINE_API_BACKENDS
Definition Export.h:108
glm::vec3 point
Owning backend-neutral 2D vector path.
void setFillRule(PathFillRule rule) noexcept
PathFillRule fillRule() const noexcept
Fill rule.
bool empty() const noexcept
Empty.
Pixel-space sub-rectangle of a Texture (atlas cell / sprite frame). UV conversion uses the texture's ...
Definition Quad.h:11
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
PathFillRule
Fill rule applied to closed 2D path contours.
One flattened owning contour produced from a Path2D.
std::vector< glm::vec2 > points