绘图接口类 更多...
#include <Graphics.h>
Public 成员函数 | |
| Graphics () | |
| 默认构造函数 | |
| Graphics (Graphics &&other) | |
| ~Graphics () | |
| void | bindBrushSet (BrushSet *brushSet) |
| 绑定画刷设置 | |
| void | bindPenSet (PenSet *penSet) |
| 绑定画笔设置 | |
| void | bindTextSet (TextSet *textSet) |
| 绑定文本设置 | |
| void | clear () |
| 使用背景色重绘绘图目标 | |
| void | drawAlphaImage (const PixelMap &pixelMap, const fPoint &dest, const fRect &src) |
| 以带有透明通道的形式绘制位图 | |
| void | drawAlphaImage (const PixelMap &pixelMap, const fRect &dest, const fRect &src, bool smooth=false) |
| 以带有透明通道的形式绘制位图 | |
| void | drawArc (const fRect &rect, float startAngle, float sweepAngle) |
| 绘制椭圆弧 | |
| void | drawBezier (const fBezier &curve) |
| 绘制贝塞尔曲线 | |
| void | drawCircle (const fCircle &circle) |
| 绘制圆 | |
| void | drawEllipse (const fEllipse &ellipse) |
| 绘制椭圆 | |
| void | drawFillCircle (const fCircle &circle) |
| 填充圆 | |
| void | drawFillEllipse (const fEllipse &rect) |
| 填充椭圆 | |
| void | drawFillFitCurve (const fFitCurve &curve) |
| 填充闭合拟合曲线 | |
| void | drawFillPath (const Path &path, const fPoint &pos=fPoint()) |
| 填充闭合路径 | |
| void | drawFillPie (const fRect &rect, float startAngle, float sweepAngle) |
| 填充扇形 | |
| void | drawFillPolygon (const fPolygon &polygon) |
| 填充多边形 | |
| void | drawFillRect (const fRect &rect) |
| 填充矩形 | |
| void | drawFillRoundRect (const fRoundRect &rect) |
| 填充圆角矩形 | |
| void | drawFitCurve (const fFitCurve &curve) |
| 绘制拟合曲线 | |
| void | drawImage (const fPoint &pos, const PixelMap &pixelMap) |
| 绘制位图 | |
| void | drawImage (const fRect &dest, const fRect &src, const PixelMap &pixelMap) |
| 绘制位图 | |
| void | drawLine (const fLine &line) |
| 绘制线段 | |
| void | drawPath (const Path &path, const fPoint &pos=fPoint()) |
| 绘制路径 | |
| void | drawPie (const fRect &rect, float startAngle, float sweepAngle) |
| 绘制扇形线框 | |
| void | drawPolygon (const fPolygon &polygon) |
| 绘制多边形 | |
| void | drawRect (const fRect &rect) |
| 绘制矩形 | |
| void | drawRoundRect (const fRoundRect &rect) |
| 绘制圆角矩形 | |
| int | drawText (const std::wstring &text, const fPoint &pos, const std::vector< std::wstring > &fonts={}, bool show=true) |
| 在指定位置绘制文本 | |
| int | drawText (const std::wstring &text, const fRect &rect, int flags=TextAlign::Left|TextAlign::Top, const std::vector< std::wstring > &fonts={}) |
| 在指定矩形区域内绘制文本 | |
| PixelMap * | getTarget () const |
| 获取绘图目标 | |
| fMat3x3 | getTransform () const |
| 获取当前应用的变换矩阵 | |
| Graphics & | operator= (Graphics &&other) |
| void | reset () |
| 重置所有设置 | |
| void | resetTransform () |
| 重置变换矩阵 | |
| void | setAntiAliasing (bool enable) |
| 设置抗锯齿 | |
| void | setBackgroundColor (const Color &color) |
| 设置默认背景色 | |
| void | setTarget (PixelMap *target) |
| 设置绘图目标 | |
| void | setTransform (const fMat3x3 &matrix) |
| 应用变换矩阵 | |
| int | textHeight (const std::wstring &text, const std::vector< std::wstring > &fonts={}) |
| 获取指定文本在指定回滚字体集合中的高度 | |
| int | textHeight (wchar_t c, const std::vector< std::wstring > &fonts={}) |
| 获取指定字符在指定回滚字体集合中的高度 | |
| int | textWidth (const std::wstring &text, const std::vector< std::wstring > &fonts={}) |
| 获取指定文本在指定回滚字体集合中的宽度 | |
| int | textWidth (wchar_t c, const std::vector< std::wstring > &fonts={}) |
| 获取指定字符在指定回滚字体集合中的宽度 | |
绘图接口类
该类提供了绘图相关的接口,包括绘制线段、矩形、圆形、椭圆、圆弧、多边形、贝塞尔曲线、拟合曲线、路径、图像、文本等
| GFt::Graphics::Graphics | ( | ) |
默认构造函数
| GFt::Graphics::Graphics | ( | Graphics && | other | ) |
| GFt::Graphics::~Graphics | ( | ) |
| void GFt::Graphics::bindBrushSet | ( | BrushSet * | brushSet | ) |
绑定画刷设置
| brushSet | 画刷设置 |
| void GFt::Graphics::bindPenSet | ( | PenSet * | penSet | ) |
绑定画笔设置
| penSet | 画笔设置 |
| void GFt::Graphics::bindTextSet | ( | TextSet * | textSet | ) |
绑定文本设置
| textSet | 文本设置 |
| void GFt::Graphics::clear | ( | ) |
使用背景色重绘绘图目标
| void GFt::Graphics::drawAlphaImage | ( | const PixelMap & | pixelMap, |
| const fPoint & | dest, | ||
| const fRect & | src ) |
以带有透明通道的形式绘制位图
| pixelMap | 要绘制的位图 |
| dest | 要绘制的目标位置 |
| src | 要绘制的源区域 |
| void GFt::Graphics::drawAlphaImage | ( | const PixelMap & | pixelMap, |
| const fRect & | dest, | ||
| const fRect & | src, | ||
| bool | smooth = false ) |
以带有透明通道的形式绘制位图
若源区域与目标区域的大小不一致,则会执行拉伸操作
| pixelMap | 要绘制的位图 |
| dest | 要绘制的目标区域 |
| src | 要绘制的源区域 |
| smooth | 是否启用平滑处理 |
| void GFt::Graphics::drawArc | ( | const fRect & | rect, |
| float | startAngle, | ||
| float | sweepAngle ) |
绘制椭圆弧
| rect | 椭圆弧所在椭圆的外接矩形 |
| startAngle | 起始角度 |
| sweepAngle | 扫过角度 |
| void GFt::Graphics::drawBezier | ( | const fBezier & | curve | ) |
绘制贝塞尔曲线
| curve | 贝塞尔曲线 |
| void GFt::Graphics::drawCircle | ( | const fCircle & | circle | ) |
绘制圆
| circle | 圆 |
| void GFt::Graphics::drawEllipse | ( | const fEllipse & | ellipse | ) |
绘制椭圆
| ellipse | 椭圆 |
| void GFt::Graphics::drawFillCircle | ( | const fCircle & | circle | ) |
填充圆
| circle | 圆 |
| void GFt::Graphics::drawFillEllipse | ( | const fEllipse & | rect | ) |
填充椭圆
| rect | 椭圆 |
| void GFt::Graphics::drawFillFitCurve | ( | const fFitCurve & | curve | ) |
填充闭合拟合曲线
| curve | 拟合曲线 |
如果传入的曲线不是闭合的, 则此函数无效果
填充闭合路径
| path | 路径 |
| void GFt::Graphics::drawFillPie | ( | const fRect & | rect, |
| float | startAngle, | ||
| float | sweepAngle ) |
填充扇形
| rect | 扇形所在椭圆的外接矩形 |
| startAngle | 起始角度 |
| sweepAngle | 扫过角度 |
| void GFt::Graphics::drawFillPolygon | ( | const fPolygon & | polygon | ) |
填充多边形
| points | 多边形顶点坐标列表 |
如果传入的多边形不是闭合的, 则此函数无效果
| void GFt::Graphics::drawFillRect | ( | const fRect & | rect | ) |
填充矩形
| rect | 矩形 |
| void GFt::Graphics::drawFillRoundRect | ( | const fRoundRect & | rect | ) |
填充圆角矩形
| rect | 圆角矩形 |
| void GFt::Graphics::drawFitCurve | ( | const fFitCurve & | curve | ) |
绘制拟合曲线
| curve | 拟合曲线 |
绘制位图
| pos | 要绘制的位置 |
| pixelMap | 要绘制的位图 |
绘制位图
若源区域与目标区域的大小不一致,则会执行拉伸操作
| dest | 要绘制的目标区域 |
| src | 要绘制的区域 |
| pixelMap | 要绘制的位图 |
| void GFt::Graphics::drawLine | ( | const fLine & | line | ) |
绘制线段
| line | 线段 |
绘制路径
| path | 路径 |
| pos | 路径起点坐标 |
| void GFt::Graphics::drawPie | ( | const fRect & | rect, |
| float | startAngle, | ||
| float | sweepAngle ) |
绘制扇形线框
| rect | 扇形所在椭圆的外接矩形 |
| startAngle | 起始角度 |
| sweepAngle | 扫过角度 |
| void GFt::Graphics::drawPolygon | ( | const fPolygon & | polygon | ) |
绘制多边形
| polygon | 多边形 |
| void GFt::Graphics::drawRect | ( | const fRect & | rect | ) |
绘制矩形
| rect | 矩形 |
| void GFt::Graphics::drawRoundRect | ( | const fRoundRect & | rect | ) |
绘制圆角矩形
| rect | 圆角矩形 |
| int GFt::Graphics::drawText | ( | const std::wstring & | text, |
| const fPoint & | pos, | ||
| const std::vector< std::wstring > & | fonts = {}, | ||
| bool | show = true ) |
在指定位置绘制文本
| text | 要绘制的文本 |
| pos | 要绘制的位置 |
| fonts | 指定的回滚字体集合 |
| show | 是否显示文本, 若为false则只计算文本的宽度 |
| int GFt::Graphics::drawText | ( | const std::wstring & | text, |
| const fRect & | rect, | ||
| int | flags = TextAlign::Left | TextAlign::Top, | ||
| const std::vector< std::wstring > & | fonts = {} ) |
在指定矩形区域内绘制文本
| text | 要绘制的文本 |
| rect | 要绘制的矩形区域 |
| flags | 文本对齐方式 |
| font | 指定的字体集合 |
若传入了无效的 flags, 则此函数将会忽略它们, 并使用默认的对齐方式(左上对齐)
| PixelMap * GFt::Graphics::getTarget | ( | ) | const |
获取绘图目标
| fMat3x3 GFt::Graphics::getTransform | ( | ) | const |
获取当前应用的变换矩阵
| void GFt::Graphics::reset | ( | ) |
重置所有设置
| void GFt::Graphics::resetTransform | ( | ) |
重置变换矩阵
| void GFt::Graphics::setAntiAliasing | ( | bool | enable | ) |
设置抗锯齿
| enable | 是否启用抗锯齿 |
| void GFt::Graphics::setBackgroundColor | ( | const Color & | color | ) |
设置默认背景色
| color | 背景色 |
| void GFt::Graphics::setTarget | ( | PixelMap * | target | ) |
设置绘图目标
| target | 绘图目标,如果为nullptr,则绘图目标为屏幕 |
| void GFt::Graphics::setTransform | ( | const fMat3x3 & | matrix | ) |
应用变换矩阵
| matrix | 变换矩阵 |
对于传入的矩阵, 默认其已经过齐次变换, 即矩阵的最后一列为 (0, 0, 1)
| int GFt::Graphics::textHeight | ( | const std::wstring & | text, |
| const std::vector< std::wstring > & | fonts = {} ) |
获取指定文本在指定回滚字体集合中的高度
| text | 要获取高度的文本 |
| fonts | 回滚字体集合, 若未指定则使用当前的环境设置 |
| int GFt::Graphics::textHeight | ( | wchar_t | c, |
| const std::vector< std::wstring > & | fonts = {} ) |
获取指定字符在指定回滚字体集合中的高度
| c | 要获取高度的字符 |
| fonts | 回滚字体集合, 若未指定则使用当前的环境设置 |
| int GFt::Graphics::textWidth | ( | const std::wstring & | text, |
| const std::vector< std::wstring > & | fonts = {} ) |
获取指定文本在指定回滚字体集合中的宽度
| text | 要获取宽度的文本 |
| fonts | 回滚字体集合, 若未指定则使用当前的环境设置 |
| int GFt::Graphics::textWidth | ( | wchar_t | c, |
| const std::vector< std::wstring > & | fonts = {} ) |
获取指定字符在指定回滚字体集合中的宽度
| c | 要获取宽度的字符 |
| fonts | 回滚字体集合, 若未指定则使用当前的环境设置 |