做家务的手抄报
Qt实现多边形内环裁剪纤的组词
最近使⽤Qt作为绘图引擎时,在使⽤clipPath的过程中遇到了⼀些问题。
1、Qt的裁剪原理是每次tClipPath都默认对已存在的path进⾏替换
2、如果需要实现多边形内环的裁剪,即扣岛,需要将多边形外环、内环都设置在⼀个path⾥⾯,然后裁剪类型设置为Qt::ClipOperation::InterctClip
安徒生故事100篇故事全集⽰例如下:
宿舍卫生管理制度void QtCanvas::clip(Polygon* polygon)
{
_canvasPtr->tClipping(true);
QPainterPath path;
QPolygon out_polygon;
auto outter_points = polygon->exteriorRing()->points();
auto outter_points_count = outter_points->pointCount();
为虺弗摧
for(int i = 0; i < outter_points_count; ++i)
{
const dan::SGPoint& point = outter_points->point(i);
out_polygon.append(QPoint(point.x(), point.y()));
}
path.addPolygon(out_polygon);
int inner_clip_count = polygon->numInteriorRings();
for(int o = 0; o < inner_clip_count; ++o)
{
物流运输管理auto inner_ring = polygon->interiorRing(o)->points();
auto point_count = inner_ring->pointCount();
if(point_count == 0)
{污的段子
continue;
}
QPolygon qPolygon;
for(int i = 0; i < point_count; ++i)
{
const dan::SGPoint& point = inner_ring->point(i);
qPolygon.append(QPoint(point.x(), point.y()));
}
有关春天的诗词
path.addPolygon(qPolygon);
}
auto clip = Qt::ClipOperation::InterctClip;
_canvasPtr->tClipPath(path, clip);
}