Paths

1. 向量绘制,用路径来描述图形,可以是闭合也可以不是闭合。

2. Building Blocks:

- 点: CGContextMoveToPoint

-线: CGContextAddLineToPoint, CGContextAddLines

-圆弧:CGContextAddArc,CGContextAddArcToPoint

-曲线:Quadratic/Cubic Bezier曲线, CGContextAddCurveToPoint, CGContextAddQuadCurveToPoint

- CGContextClosePath会被某些操作默认执行。

- 椭圆:CGContextAddEllipseInRect;

- 矩形: CGContextAddRect;

3. 创建Path CGContextBeginPath + CGContextMoveToPoint

4. Painting Path != Create Path

5. Mutable Path: Path对象,独立于Context存在。CGContextAddPath来使用它。

- CGPathCreateMutable = CGContextBeginPath

- CGPathMoveToPoint = CGContextMoveToPoint

- CGPathAddLineToPoint = CGContextAddLineToPoint

- CGPathAddCurveToPoint = CGContextAddCurveToPoint

- CGPathAddEllipseInRect = CGContextAddEllipseInRect

- CGPathAddArc = CGContextAddArc

- CGPathAddRect = CGContextAddRect

- CGPathCloseSubPath = CGContextCloseSubPath

6. 描边

- 线宽:

- 连接方式:Miter尖角,Round圆角,Bevel平角

- 线头:Butt平头,Round圆头,Projecting扩展平头

- 角限:限制尖角连接的范围

- 点划模板:

- 颜色空间:

- 颜色:

- StrokePattern?

CGContextStrokePath/CGContextStrokeRect/CGContextStrokeRectWithWidth/CGContextStrokeEllipseInRect/CGContextStrokeLineSegment/CGContextDrawPath

7.填充规则:

- nonzero winding:CGContextFillPath从某点出发向图形边缘做一条射线,如果射线和图形某条边相交,且该边从坐向右穿过射线,则相交计数+1,如果该边从右向左穿过射线,则相交计数-1。如果最后相交计数为1,则该点在图形内。

- even odd:CGContextEOFillPath从某点出发向图形边缘做一条射线,如果射线和图形边相交点数为奇数,则该点在图形内。

8. CGContextFillPath/CGContextEOFillPath/CGContextFillRect/CGContextFillRects/CGContextFillEllipseInRect/CGContextDrawPath

9. 混合:CGContextSetBlendMode - GraphicsState, 通常:

- Normal: result  = result = (alpha*fore) + (1.0-alpha)*back;

- Multiply: result = fore*back;

- Screen: result = 1.0-(1.0-fore)*(1.0-back);

- Overlay: result = gray(back)>0.5?(1.0-2.0*(1.0-back)*(1.0-fore):fore*back*2.0f;

- Darken: result = min(fore,back);

- Lighten: result = max(fore,back);

- Color Dodge: result = back/(1.0-fore);

- Color Burn: result = 1.0 - (1.0-back)/fore;

- Soft Light: result = gray(fore)>0.5? 1.0 - (1.0-back)*(1.5 - fore):back*(fore+0.5);

- Hard Light: result = gray(fore)>0.5?1.0 - 2.0*(1.0-back)*(1.0-fore):2.0*back*fore;

- Difference: result = abs(fore-back);

- Exclusion: result = 0.5 - 2.0*(fore - 0.5)*(back-0.5);

- Hue: result = lum(back), sat(back),hue(fore);

- Saturtation: result = lum(back),sat(fore),hue(back);

- Color: result = lum(back),sat(fore),hue(fore);

- Luminosity: result = lum(fore),sat(back),hue(back);

10.裁剪: CGConextClip/CGContextEOClip/CGContextClipToRect/CGContextClipToRects/CGContextClipToMask;

转载于:https://www.cnblogs.com/appDev/archive/2011/07/09/2101571.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值