Direct2D 几何计算和几何变幻
D2D不仅可以绘制,还可以对多个几何图形对象进行空间运算。这功能应该在GIS界比较吃香。
这些计算包括:
- 合并几何对象,可以设置求交还是求并,CombineWithGeometry
- 边界,加宽边界,查询边界。Widen、GetBounds、GetWidenedBounds
- 几何对象填充的区域是否包含指定点,FillContainsPoint
- 笔画是否包含点,StrokeContainsPoint
- 几何对象与指定几何对象之间的交集,CompareWithGeometry
- 创建仅包含直线和(可选)三次方贝塞尔曲线的简化版本的几何对象,Simplify
- 网格化,创建一组顺时针缠绕的三角形,Tessellate
- 计算几何对象的轮廓(移除交集),Outline
- 几何对象上指定距离处的点和正切矢量,ComputePointAtLength
- 计算几何对象的面积,ComputeArea
- 计算几何对象的长度,ComputeLength
pRenderTarget->BeginDraw(); //clear screen
pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White)); //define 2 ellipse
const D2D1_ELLIPSE ellipse1 = Ellipse(Point2F(200,300),150,150);
const D2D1_ELLIPSE ellipse2 = Ellipse(Point2F(200,250),100,200); //define ellipse geometry for compute
ID2D1EllipseGeometry* pEllipse1 = NULL;
ID2D1EllipseGeometry* pEllipse2 = NULL;
//define path for render the combine result
ID2D1PathGeometry* pPathGeo = NULL;
//define a path container
ID2D1GeometrySink* pGeometrySink = NULL; //initialize the ellipses and path.
hr = pD2DFactory->CreateEllipseGeometry(ellipse1, &pEllipse1);
hr = pD2DFactory->CreateEllipseGeometry(ellipse2, &pEllipse2);
hr = pD2DFactory->CreatePathGeometry(&pPathGeo); //begin add path
pPathGeo->Open(&pGeometrySink);
//combine the 2 ellipse and the result go into the sink
pEllipse1->CombineWithGeometry(pEllipse2, D2D1_COMBINE_MODE_UNION, NULL, NULL, pGeometrySink);
//end add path
pGeometrySink->Close();
//draw the path
pRenderTarget->DrawGeometry(pPathGeo, pBlackBrush); pRenderTarget->EndDraw();
除此之外,D2D还支持对几何对象的变幻,包括:
- 旋转,
- 缩放,
- 平移,
Direct2D 几何计算和几何变幻的更多相关文章
- 1549: Navigition Problem (几何计算+模拟 细节较多)
1549: Navigition Problem Submit Page Summary Time Limit: 1 Sec Memory Limit: 256 Mb Su ...
- Jack Straws POJ - 1127 (几何计算)
Jack Straws Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5428 Accepted: 2461 Descr ...
- Envelope几何对象 Curve对象几何对象 Multipatch几何对象 Geometry集合接口 IGeometryCollection接口
Envelope是所有几何对象的外接矩形,用于表示几何对象的最小边框,所有的几何对象都有一个Envelope对象,IEnvelope是Envelope对象的主要接口,通过它可以获取几何对象的XMax, ...
- SPEC 2000 整形和浮点性能测试结果是各项基准程序得分的几何平均值,几何平均值是 n 个数连乘之 后再开 n 次根号
SPEC 2000 能够生成多种格式的测试结果报表,包括 asc,ps,raw,pdf,html 等格式,报 表所在目录为/home/sepc2000all/result. 整形和浮点性能测试结果是 ...
- Direct2D教程VII——变换几何(TransformedGeometry)对象
目前博客园中成系列的Direct2D的教程有 1.万一的 Direct2D 系列,用的是Delphi 2009 2.zdd的 Direct2D 系列,用的是VS中的C++ 3.本文所在的 Direct ...
- hdu1115(计算多边形几何重心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1115 题意:给出一些点,求这些点围成的多边形的重心: 思路: 方法1:直接分别求所有点的x坐标的平均值 ...
- UVALive 6092 Catching Shade in Flatland --枚举+几何计算
题意:x=[-200,200],y=[-200,200]的平面,一天中太阳从不同角度射到长椅(原点(0,0))上,有一些树(用圆表示),问哪个时刻(分钟为单位)太阳光线与这些圆所交的弦长总和最长.太阳 ...
- Jack Straws POJ - 1127 (简单几何计算 + 并查集)
In the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table ...
- HDU——2056Rectangles(几何计算)
Rectangles Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
随机推荐
- hdu1754 基础线段树
I Hate It Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- activiti笔记四 关于部署信息表act_re_deployment
一.简要描述 部署流程定义时需要被持久化保存下来的信息.二.表结构说明 字段名称 字段描述 数据类型 主键 为空 取值说明 ID_ ID_ nvarchar(64) √ 主键ID NAME_ 部署名称 ...
- Jquery网页选项卡应用
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- python selenium初入
ubuntu python3.4 1.安装selenium, pip 安装 pip install selenium 2.selenium版本2.53.x 试过从官网下载的selenium3,但是fi ...
- X windows的底层实现机制
Qt在Linux上运行崩溃了,很可能的原因是对于X11机制的不了解.很可能是UI代码里面对窗口的操作不规范而导致Qt内部的BUG暴露出来.具体UI实现代码我也没有看.是别人维护的.打算今天去看下代码, ...
- relative与absolute相结合
relative会把别人挤下去, absolute会跑偏. 两者结合就会很好的解决问题. <span class='pic_selected' style='position:relative; ...
- 转:C# 中的委托和事件
引言 委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易.它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去 ...
- Java 舍入模式 数字的格式化
舍入模式: UP向远离0的方向舍入 始终对非零舍弃部分前面的数字加 1.此舍入模式始终不会减少计算值的绝对值. 例如:1.6 → 2 -1.6 → -2 1.1 → 2 ...
- UVA 10152-ShellSort(映射+栈)
题意: 给出一堆乌龟名字,乌龟能从本身位置爬到顶端. 要求求出从原本的顺序到目标顺序的最小操作.输出每次操作移到顶端的乌龟的名字. 解析:名字用映射对应编号,把目标状态的乌龟从上到下的编号按1到N编好 ...
- 【sql语句】好用的sql语句之项目数据库学习总结
转载请注明出处:http://blog.csdn.net/pearyangyang/article/details/41115491 这几天学习公司系统的数据流向.主要涉及到几个表的数据. 可是表中的 ...