TpPainterPath 类
V0.2.1TpUtils
2025-11-14
基础信息
| 头文件: | include <TpPainterPath.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | |
| 派生类: |
Public 成员函数
| TpPainterPath() | ||
|---|---|---|
| TpPainterPath(const TpPainterPath &others) | ||
| TpPainterPath(const TpPoint &startPoint) | 构造函数,以给定起点初始化路径 | |
| moveTo(const TpPoint &point) | 移动当前点到指定位置(不绘制) | |
| lineTo(const TpPoint &endPoint) | 添加直线到指定点 | |
| cubicTo(const TpPoint &controlPoint1, const TpPoint &](/V0.2.1/TpUtils/TpPoint/)controlPoint2, const TpPoint &endPoint) | 添加三次贝塞尔曲线 | |
| addRect(const TpRect &rect) | 添加矩形路径 | |
| addEllipse(const TpRect &rect) | 添加椭圆路径 | |
| addRoundedRect(const TpRect &rect, float radius) | 添加圆角矩形路径 | |
| addArc(const TpPoint ¢er, float radius, float startAngle, float endAngle) | 添加圆弧路径 | |
| addPie(const TpPoint ¢er, float radius, float startAngle, float endAngle) | 添加扇形路径 | |
| closeSubpath() | 闭合路径(添加起点到当前点的线段) | |
| clear() | 清除当前路径的所有元素 | |
| isEmpty() const | 判断路径是否为空 | |
| TpRect | boundingRect() const | 获取路径边界矩形 |
| TpPainterPath TpPainterPath::operator+ | operator+(const TpPainterPath &other) const | 连接两个路径 |
| TpPainterPath & TpPainterPath::operator+= | operator+=(const TpPainterPath &other) | 连接两个路径 |
成员函数说明
TpPainterPath::TpPainterPath()
暂无注释...
TpPainterPath::TpPainterPath(const TpPainterPath &others)
暂无注释...
TpPainterPath::TpPainterPath(const TpPoint &startPoint)
构造函数,以给定起点初始化路径...
构造函数,以给定起点初始化路径
参数:startPoint: 路径起始点
void TpPainterPath::moveTo(const TpPoint &point)
移动当前点到指定位置(不绘制)...
移动当前点到指定位置(不绘制)
参数:point: 目标位置
void TpPainterPath::lineTo(const TpPoint &endPoint)
添加直线到指定点...
添加直线到指定点
参数:endPoint: 线段终点
void TpPainterPath::cubicTo(const TpPoint &controlPoint1, const TpPoint &controlPoint2, const TpPoint &endPoint)
添加三次贝塞尔曲线...
添加三次贝塞尔曲线
参数:controlPoint1: 第一控制点
参数:controlPoint2: 第二控制点
参数:endPoint: 结束点
void TpPainterPath::addRect(const TpRect &rect)
添加矩形路径...
添加矩形路径
参数:rect: 要添加的矩形区域
void TpPainterPath::addEllipse(const TpRect &rect)
添加椭圆路径...
添加椭圆路径
参数:rect: 椭圆的外接矩形
void TpPainterPath::addRoundedRect(const TpRect &rect, float radius)
添加圆角矩形路径...
添加圆角矩形路径
参数:rect: 矩形区域
参数:xRadius: X方向圆角半径
参数:yRadius: Y方向圆角半径
void TpPainterPath::addArc(const TpPoint ¢er, float radius, float startAngle, float endAngle)
添加圆弧路径...
添加圆弧路径
参数:center: 圆心坐标
参数:radius: 半径
参数:startAngle: 起始角度(度)0度:指向右侧(正X轴方向)90度:指向下方(正Y轴方向)
参数:endAngle: 终止角度(度)要比起始角度大
void TpPainterPath::addPie(const TpPoint ¢er, float radius, float startAngle, float endAngle)
添加扇形路径...
添加扇形路径
参数:center: 圆心坐标
参数:radius: 半径
参数:startAngle: 起始角度(度)0度:指向右侧(正X轴方向)90度:指向下方(正Y轴方向)
参数:endAngle: 终止角度(度)要比起始角度大
void TpPainterPath::closeSubpath()
闭合路径(添加起点到当前点的线段)...
闭合路径(添加起点到当前点的线段)
void TpPainterPath::clear()
清除当前路径的所有元素...
清除当前路径的所有元素
bool TpPainterPath::isEmpty() const
判断路径是否为空...
判断路径是否为空
返回值:true表示路径无任何元素
TpRect TpPainterPath::boundingRect() const
获取路径边界矩形...
获取路径边界矩形
返回值:包含整个路径的矩形
TpPainterPath TpPainterPath::operator+(const TpPainterPath &other) const
连接两个路径...
连接两个路径
参数:other: 要连接的路径
TpPainterPath & TpPainterPath::operator+=(const TpPainterPath &other)
连接两个路径...
连接两个路径
参数:other: 要连接的路径
