conicalgradient2d QML Value Type
提供与QCanvasConicalGradient 相匹配的conicalgradient2d类型。更多内容...
| Import Statement: | import QtCanvas2D |
| Since: | Qt 6.12 |
| Status: | Technology preview |
此类型处于技术预览阶段,可能会有变动。
方法
- void addColorStop(real offset, string color)
- point centerPosition()
- void setCenterPosition(real x, real y)
- void setCenterPosition(point center)
- void setStartAngle(real angle)
- real startAngle()
详细说明
此值类型由QtCanvas2D 导入提供。
另请参阅 QCanvasConicalGradient 。
方法文档
void addColorStop(real offset, string color)
在指定位置offset 的渐变中添加一个具有给定color 的颜色停点。0.0 表示渐变一端的偏移量,1.0 表示渐变另一端的偏移量。
例如:
const gradient = ctx.createConicalGradient(100, 100, Math.PI / 2);
gradient.addColorStop(0.0, Qt.rgba(1, 0, 0, 1));
gradient.addColorStop(0.5, "#ff8040");
gradient.addColorStop(1.0, "red");point centerPosition()
返回锥形渐变的中心点。
另请参阅 setCenterPosition()。
void setCenterPosition(real x, real y)
将锥形渐变的中心点设置为 (x,y)。
另请参阅 centerPosition()。
void setCenterPosition(point center)
将锥形渐变的中心点设置为center 。
这是一个重载函数。
void setStartAngle(real angle)
将锥形渐变的起始角度设置为angle (单位为弧度)。该角度以从中心向右水平延伸的直线为起点,并按顺时针方向延伸。
另请参阅 startAngle()。
real startAngle()
返回锥形渐变的起始角度(单位为弧度)。
另请参阅 setStartAngle()。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.