GDI+函数之 Region::Complement
来源:互联网 发布:2016年网络犯罪案例 编辑:程序博客网 时间:2024/04/28 21:05
TheComplement method updates this region to the portion of the specifiedpath's interior that does not intersect this region.
这个函数用来更新当前Region
用path包含的、同时不在当前区域内的区域(即path区域减去开始region)来更新当前区域。
Msdn的例子比较明白:
代码:
{ Graphics graphics(hdc); SolidBrush solidBrush(Color(255, 255, 0, 0));Pen pen(Color(255,0,255,0)); Point points[] = { Point(110, 20), Point(120, 30), Point(100, 60), Point(120, 70), Point(150, 60), Point(140, 10)}; Rect rect(65, 15, 70, 45);graphics.DrawRectangle(&pen,rect); GraphicsPath path; path.AddClosedCurve(points, 6);graphics.DrawPath(&pen,&path); // Create a region from a rectangle. Region region(rect); // Update the region so that it consists of all points inside a path but // outside the rectangular region. region.Complement(&path); graphics.FillRegion(&solidBrush, ®ion);}
我对它的一个实际应用:
//ptCircleCenter - 扇形的圆心//nRadius - 半径//fAngleStart - 开始的角度//fSweepAngle - 扇形的总角度//rgnPie - 得到的区域void CtestGDIView::GetPieRgnGdiplus(CDC* pDC,CPoint ptCircleCenter,int nRadius,float fAngleStart,float fSweepAngle,__out Region&rgnPie){//第一步,计算矩形POINT topLeft;topLeft.x = (LONG)(ptCircleCenter.x-nRadius);topLeft.y = (LONG)(ptCircleCenter.y-nRadius);Rect rectPie(topLeft.x,topLeft.y,nRadius,nRadius);Graphics graphics(pDC->GetSafeHdc());Pen pen(Color(255,255,0,0));graphics.DrawRectangle(&pen,rectPie);GraphicsPath path;path.AddPie(rectPie,fAngleStart,fSweepAngle);rgnPie.Complement(&path);}
调用:
Rect rect1(0,0,0,0); Region rgn(rect1);CPoint point(200,200);GetPieRgnGdiplus(pDC,point,100,-90,360,rgn); SolidBrush brush(Color(255,255,0,0)); graphics.FillRegion(&brush,&rgn);
Rect rect1(0,0,0,0); Region rgn(rect1);CPoint point(200,200);GetPieRgnGdiplus(pDC,point,100,-90,-90,rgn); SolidBrush brush(Color(255,255,0,0)); graphics.FillRegion(&brush,&rgn);
0 0
- GDI+函数之 Region::Complement
- C++ GDI+ Region区域
- GDI+ Region 的 古怪Bug.
- LeetCode之Number Complement
- LeetCode之Number Complement
- LeetCode之Number Complement
- LeetCode之Number Complement
- GDI函数
- GDI 函数
- HBase学习之region
- HBase学习之Region
- windows程序设计之绘图基础之GDI函数调用
- GDI,CxImage,GDI+之比较
- GDI,CxImage,GDI+之比较
- GDI,CxImage,GDI+之比较
- GDI,CxImage,GDI+之比较
- LeetCode之路:476. Nubmer Complement
- Prism简介 Prism之Region
- QuickSort1 - Partition
- 【朋乐信息技术】如何快速设置IP地址,用批处理文件设置IP地址
- setAnimationTransition:forView:cache: 执行动画时背景色问题
- 编译器 STVD 与 IAR 的区别 个人体验
- C++类的const、static和const static数据成员的初始化
- GDI+函数之 Region::Complement
- js中setTimeout的用法
- [LeetCode] Remove Duplicates from Sorted Array
- UDT4协议源码分析之数据的发送和接收
- Linux终端命令-程序文件相关命令(2)
- 操作系统总结之文件系统实现
- android显示大图片的一些技巧
- 概率图模型(PGM)学习笔记(三)模式推断与概率图流
- spring mvc 拦截器需要实现HandlerInterceptor接口