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 ); 指定 ...
随机推荐
- DB2学习
1.为了使用ORG_ID,由于OCRM_F_MM_MKT_PLAN a 没有ORG_ID,但是OCRM_F_MM_EXECUTE_INST_DESC d 表里面有,可以使a表连接b表,创建临时表t. ...
- ExtJs之DHTML,DOM,EXTJS的事件绑定区别
<!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...
- 解决安装rpm时lib冲突:libstdc++-2-libc6.1-1-2.9.0.so from install of compat-libstdc++-7.3-2.96.118 conflicts with file from ...
sudo rpm -ivh xxx.rpm -aid --force [oracle@localhost Oracle]$ .i386.rpm compat-libstdc++-devel-.i386 ...
- android学习--radiogroup学习
这个阶段在学习android的相关基本UI现将相关练习的代码粘贴在此便于后期学习之用(radio控件) 效果图: main_layout.xml <?xml version="1. ...
- GDB调试方法精粹
http://blog.chinaunix.net/uid-26922071-id-3756018.html 一.多线程调试 1. 多线程调试,最重要的几个命令: info threads ...
- Cornerstone问题
// Cornerstone锁 Cornerstone locks a working copy whenever it performs operations suchs as commits, u ...
- 在CentOS 7中安装与配置Tomcat-8方法
安装前提 在CentOS 7中安装与配置JDK8 安装tomcat apache-tomcat-8.0.14.tar.gz文件上传到/usr/local中执行以下操作: [root@localhos ...
- 借助adb与gdb确认app内存缓存中是否存在用户敏感数据
一.环境准备 1. 搭建adb调试桥 可参考文章<ADB调试桥安装(方式二)> 2. 安装调试gdb工具 可参考文章<移动设备中导入gdb调试工具> 二.测试执行 root@G ...
- git忽略文件【转】
转自: http://cwind.iteye.com/blog/1666646 有很多文件不必使用git管理.例如Eclipse或其他IDE生成的项目文件,编译生成的各种目标或临时文件等.使用git ...
- Ubuntu Server搭建svn服务以及迁移方法【转】
转自:http://www.linuxidc.com/Linux/2013-05/84693.htm Ubuntu Server搭建svn服务以及迁移方法 采用apache+svn,http访问方式. ...