GraceFt v2.3
开源图形引擎 EGE(Easy Graphics Engine) 的高层封装库
 
载入中...
搜索中...
未找到
GFt::Path类 参考

路径类 更多...

#include <Path.h>

Public 成员函数

 Path ()
 默认构造函数
 
 Path (const Path &other)
 
 Path (Path &&other)
 
 ~Path ()
 
void addArc (const fRect &rect, float startAngle, float sweepAngle)
 向路径中添加圆弧
 
void addBezier (const fBezier &bezier)
 向路径中添加贝塞尔曲线
 
void addCircle (const fCircle &circle)
 向路径中添加圆
 
void addEllipse (const fEllipse &ellipse)
 向路径中添加椭圆
 
void addFitCurve (const fFitCurve &fitCurve)
 向路径中添加拟合曲线
 
void addLine (const fLine &line)
 向路径中添加直线
 
void addPath (const Path &other, bool connect=false)
 向路径中添加路径
 
void addPie (const fRect &rect, float startAngle, float sweepAngle)
 向路径中添加扇形
 
void addPolygon (const fPolygon &points)
 向路径中添加多边形
 
void addRect (const fRect &rect)
 向路径中添加矩形
 
void addText (const std::wstring &text, const fPoint &position, const Font &font=Font(L"宋体"))
 向路径中添加文本
 
void close ()
 闭合当前图元
 
void closeAll ()
 闭合所有未闭合的图元
 
int count () const
 计算路径共有多少个控制点
 
fRect getBounds (const fMat3x3 &transform=fMat3x3::I()) const
 获取路径的最小外接矩形
 
fPoint getLastPoint () const
 获取路径的最后一个点
 
Pathoperator= (const Path &other)
 
Pathoperator= (Path &&other)
 
void outline ()
 转变为图形的轮廓线
 
void reset ()
 清空路径
 
void reverse ()
 反转路径
 
void start ()
 开始一个新的图元
 
void transformBy (const fMat3x3 &transform)
 对路径应用变换矩阵
 

友元

class Graphics
 

详细描述

路径类

用于绘制图形,可以包含多种图元,如直线、圆弧、贝塞尔曲线、多边形等

构造及析构函数说明

◆ Path() [1/3]

GFt::Path::Path ( )

默认构造函数

◆ Path() [2/3]

GFt::Path::Path ( const Path & other)

◆ Path() [3/3]

GFt::Path::Path ( Path && other)

◆ ~Path()

GFt::Path::~Path ( )

成员函数说明

◆ addArc()

void GFt::Path::addArc ( const fRect & rect,
float startAngle,
float sweepAngle )

向路径中添加圆弧

参数
rect圆弧所在矩形
startAngle圆弧起始角度
sweepAngle圆弧扫过角度

◆ addBezier()

void GFt::Path::addBezier ( const fBezier & bezier)

向路径中添加贝塞尔曲线

参数
bezier贝塞尔曲线

◆ addCircle()

void GFt::Path::addCircle ( const fCircle & circle)

向路径中添加圆

参数
circle

◆ addEllipse()

void GFt::Path::addEllipse ( const fEllipse & ellipse)

向路径中添加椭圆

参数
ellipse椭圆

◆ addFitCurve()

void GFt::Path::addFitCurve ( const fFitCurve & fitCurve)

向路径中添加拟合曲线

参数
fitCurve拟合曲线

◆ addLine()

void GFt::Path::addLine ( const fLine & line)

向路径中添加直线

参数
line直线

◆ addPath()

void GFt::Path::addPath ( const Path & other,
bool connect = false )

向路径中添加路径

参数
other要添加的路径
connect是否连接两个路径(仅在路径未闭合时有效)

◆ addPie()

void GFt::Path::addPie ( const fRect & rect,
float startAngle,
float sweepAngle )

向路径中添加扇形

参数
rect扇形所在矩形
startAngle扇形起始角度
sweepAngle扇形扫过角度

◆ addPolygon()

void GFt::Path::addPolygon ( const fPolygon & points)

向路径中添加多边形

参数
points多边形的点集

◆ addRect()

void GFt::Path::addRect ( const fRect & rect)

向路径中添加矩形

参数
rect矩形

◆ addText()

void GFt::Path::addText ( const std::wstring & text,
const fPoint & position,
const Font & font = Font(L"宋体") )

向路径中添加文本

参数
text文本内容
position文本位置
font字体

◆ close()

void GFt::Path::close ( )

闭合当前图元

◆ closeAll()

void GFt::Path::closeAll ( )

闭合所有未闭合的图元

◆ count()

int GFt::Path::count ( ) const

计算路径共有多少个控制点

返回
路径控制点的数量

◆ getBounds()

fRect GFt::Path::getBounds ( const fMat3x3 & transform = fMat3x3::I()) const

获取路径的最小外接矩形

所得的外接矩形是经过变换后的路径的最小外接矩形

参数
transform变换矩阵, 默认为单位矩阵
返回
路径的最小外接矩形

对于输入的矩阵, 会默认其已经过齐次变换

◆ getLastPoint()

fPoint GFt::Path::getLastPoint ( ) const

获取路径的最后一个点

返回
路径的最后一个点

◆ operator=() [1/2]

Path & GFt::Path::operator= ( const Path & other)

◆ operator=() [2/2]

Path & GFt::Path::operator= ( Path && other)

◆ outline()

void GFt::Path::outline ( )

转变为图形的轮廓线

◆ reset()

void GFt::Path::reset ( )

清空路径

◆ reverse()

void GFt::Path::reverse ( )

反转路径

◆ start()

void GFt::Path::start ( )

开始一个新的图元

◆ transformBy()

void GFt::Path::transformBy ( const fMat3x3 & transform)

对路径应用变换矩阵

参数
transform变换矩阵
Bug
由于EGE(24.04)的ege_path_transform函数的实现问题, 导致无法正确实现transformBy函数(此函数会引发段错误)
警告
此函数会引发段错误

友元及相关符号说明

◆ Graphics

friend class Graphics
friend