Filling a Path 模式
Filling a Path
When you fill the current path, Quartz acts as if each subpath contained in the path were closed. It then uses these closed subpaths and calculates the pixels to fill. There are two ways Quartz can calculate the fill area. Simple paths such as ovals and rectangles have a well-defined area. But if your path is composed of overlapping segments or if the path includes multiple subpaths, such as the concentric circles shown in Figure 3-12, there are two rules you can use to determine the fill area.
The default fill rule is called the nonzero winding number rule. To determine whether a specific point should be painted, start at the point and draw a line beyond the bounds of the drawing. Starting with a count of 0, add 1 to the count every time a path segment crosses the line from left to right, and subtract 1 every time a path segment crosses the line from right to left. If the result is 0, the point is not painted. Otherwise, the point is painted. The direction that the path segments are drawn affects the outcome.Figure 3-12 shows two sets of inner and outer circles that are filled using the nonzero winding number rule. When each circle is drawn in the same direction, both circles are filled. When the circles are drawn in opposite directions, the inner circle is not filled.
You can opt to use the even-odd rule. To determine whether a specific point should be painted, start at the point and draw a line beyond the bounds of the drawing. Count the number of path segments that the line crosses. If the result is odd, the point is painted. If the result is even, the point is not painted. The direction that the path segments are drawn doesn’t affect the outcome. As you can see in Figure 3-12, it doesn’t matter which direction each circle is drawn, the fill will always be as shown.
Figure 3-12 Concentric circles filled using different fill rules
Quartz provides the functions shown in Table 3-5 for filling the current path. Some are convenience functions for stroking rectangles or ellipses.
Function |
Description |
---|---|
|
Fills the current path using the even-odd rule. |
|
Fills the current path using the nonzero winding number rule. |
|
Fills the area that fits inside the specified rectangle. |
|
Fills the areas that fits inside the specified rectangles. |
|
Fills an ellipse that fits inside the specified rectangle. |
|
Fills the current path if you pass |
nonzero winding number rule
非零就画原则 路径从左向右就+1,从右向左-1,如果结果非零就画,反之不画
even-odd rule(奇偶规则)
路径被穿过的次数,总计次数为奇数就画,偶数就不画
Filling a Path 模式的更多相关文章
- SQl 2005 For XMl 简单查询(Raw,Auto,Path模式)(1)
很多人对Xpath可能比较熟悉,但不知道有没有直接操作过数据库,我们都知道 在Sql2005里公支持的几种查询有Raw,Auto模式,页并没有Path和Elements用法等,如果在2000里使用过 ...
- Yii 2 修改 URL 模式为 PATH 模式,并隐藏index.php
在弄yii的url重写,希望能把url改成更好记的形式,同时去掉index.php的部分.转化前后的对比:修改前: http://localhost/index.php?r=site/page?vie ...
- SQL SERVER中XML查询:FOR XML指定PATH
SQL SERVER中XML查询:FOR XML指定PATH 前言 在SQL SERVER中,XML查询能够指定RAW,AUTO,EXPLICIT,PATH.本文用一些实例介绍SQL SERVER中指 ...
- SQL Server FOR XML PATH 语句的应用---列转行
经常在论坛看到高手使用了 for xml path,由于是搜索一下,记录了详细的使用方法.在SQL Server中利用 FOR XML PATH 语句能够把查询的数据生成XML数据,下面是它的一些应用 ...
- Path Creation and Path Painting
[Path Creation and Path Painting] Path creation and path painting are separate tasks. First you crea ...
- SqlServer——for xml path
for xml path 就是将 sql 查询出来的内容以XML的格式显示出来.参考网站MSDN:将 PATH 模式与 FOR XML 一起使用. 先创建测试用的表格: create table SZ ...
- Paths_Quartz2D
Paths中的几个重要元素 Points void CGContextMoveToPoint ( CGContextRef c, CGFloat x, CGFloat y ); 指定 ...
- Paths(转载)
Paths中的几个重要元素 Points void CGContextMoveToPoint ( CGContextRef c, CGFloat x, CGFloat y ); 指定一个点成为curr ...
- IOS-Quartz2D(Paths元素)
Paths中的几个重要元素 Points void CGContextMoveToPoint ( CGContextRef c, CGFloat x, CGFloat y ); 指定 ...
随机推荐
- HDU 1116 || POJ 1386 || ZOJ 2016 Play on Words (欧拉回路+并查集)
题目链接 题意 : 有很多门,每个门上有很多磁盘,每个盘上一个单词,必须重新排列磁盘使得每个单词的第一个字母与前一个单词的最后一个字母相同.给你一组单词问能不能排成上述形式. 思路 :把每个单词看成有 ...
- WCF分布式开发步步为赢(5)服务契约与操作重载
继上一节WCF分布式开发步步为赢系列的(4):WCF服务可靠性传输配置与编程开发,本节我们继续学习WCF分布式开发步步为赢的第(5)节:服务契约与操作重载.这里我们首先讲解OOP面向对象的编程中方法重 ...
- Android核心分析之十九电话系统之GSMCallTacker
GSMCallTracker在本质上是一个Handler.<IGNORE_JS_OP> 1.jpg (1.52 KB, 下载次数: 1) 下载附件 保存到相册 2012-3-22 11: ...
- Linux资源监控命令/工具(调试)
1.直接将指令丢到背景中执行:& [root@linux ~]# tar -zpcvf /tmp/etc.tar.gz /etc > /tmp/log.txt 2>&1 & ...
- 在db2中 两个数据库之间的两个表的联合查询
大家好,今天遇到了在db2中 两个数据库之间的两个表的联合查询 我知道oracle中有dblink,可是不知到db2的两个数据库联合查询怎么处理我找了类似于比如两个数据库: db1,db2用户名密码s ...
- JBOSS集群技术升级版解决方案分享(图示篇)
JBOSS集群技术升级版解决方案分享(实现篇) 前段时间,由于阿堂一直较忙,没有写点什么了,有空时一直在关注"web架构和性能,高并发,Cache层"技术领域的 ...
- SSIS ->> Script Task
利用Script Task,我们可以做一些本身SSIS没能满足我们的,或者实现起来效果不够理想的.比如说我们想做一件这样的事情,去检查某个文件是否为空.如果我们通过Row Count组件来实现,性能上 ...
- DeepLearning常用库简要介绍与对比
网上近日流传一张DL相关库在Github上的受关注度对比(数据应该是2016/03/15左右统计的): 其中tensorflow,caffe,keras和Theano排名比较靠前. 今日组会报告上tj ...
- linux中/etc/init.d [转]
一.关于/etc/init.d 如果你使用过linux系统,那么你一定听说过init.d目录.这个目录到底是干嘛的呢?它归根结底只做了一件事情,但这件事情非同小可,是为整个系统做的,因此它非常重要.i ...
- eclipse中启动tomcat报错 java.lang.ClassNotFoundException
之前启动还好好的,某次启动tomcat就莫名其妙的报了这个java.lang.ClassNotFoundException的错. 检查maven依赖包,发现这个类是存在的. 然后一通clean操作 ...