add: the method of drawing arcs
This commit is contained in:
parent
57b528d67f
commit
ab2c6092e8
|
|
@ -452,6 +452,22 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void Canvas::AddArc(Point const & point, Point const & radius, float rotation, bool clockwise, bool is_small)
|
||||
{
|
||||
if (current_sink_)
|
||||
{
|
||||
current_sink_->AddArc(
|
||||
D2D1::ArcSegment(
|
||||
point,
|
||||
D2D1_SIZE_F{ radius.x, radius.y },
|
||||
rotation,
|
||||
clockwise ? D2D1_SWEEP_DIRECTION_CLOCKWISE : D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE,
|
||||
is_small ? D2D1_ARC_SIZE_SMALL : D2D1_ARC_SIZE_LARGE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::StrokePath()
|
||||
{
|
||||
render_target_->DrawGeometry(
|
||||
|
|
|
|||
|
|
@ -157,6 +157,15 @@ namespace easy2d
|
|||
Point const& point3 /* 贝塞尔曲线的终点 */
|
||||
);
|
||||
|
||||
// 添加弧线
|
||||
void AddArc(
|
||||
Point const& point, /* 终点 */
|
||||
Point const& radius, /* 椭圆半径 */
|
||||
float rotation, /* 椭圆旋转角度 */
|
||||
bool clockwise = true, /* 顺时针 or 逆时针 */
|
||||
bool is_small = true /* 是否取小于 180° 的弧 */
|
||||
);
|
||||
|
||||
// 路径描边
|
||||
void StrokePath();
|
||||
|
||||
|
|
|
|||
|
|
@ -392,6 +392,22 @@ namespace easy2d
|
|||
}
|
||||
}
|
||||
|
||||
void PathGeometry::AddArc(Point const & point, Point const & radius, float rotation, bool clockwise, bool is_small)
|
||||
{
|
||||
if (current_sink_)
|
||||
{
|
||||
current_sink_->AddArc(
|
||||
D2D1::ArcSegment(
|
||||
point,
|
||||
D2D1_SIZE_F{ radius.x, radius.y },
|
||||
rotation,
|
||||
clockwise ? D2D1_SWEEP_DIRECTION_CLOCKWISE : D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE,
|
||||
is_small ? D2D1_ARC_SIZE_SMALL : D2D1_ARC_SIZE_LARGE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void PathGeometry::ClearPath()
|
||||
{
|
||||
geo_ = nullptr;
|
||||
|
|
|
|||
|
|
@ -258,6 +258,15 @@ namespace easy2d
|
|||
Point const& point3 /* 贝塞尔曲线的终点 */
|
||||
);
|
||||
|
||||
// 添加弧线
|
||||
void AddArc(
|
||||
Point const& point, /* 终点 */
|
||||
Point const& radius, /* 椭圆半径 */
|
||||
float rotation, /* 椭圆旋转角度 */
|
||||
bool clockwise = true, /* 顺时针 or 逆时针 */
|
||||
bool is_small = true /* 是否取小于 180° 的弧 */
|
||||
);
|
||||
|
||||
// 清除路径
|
||||
void ClearPath();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue