你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> paths 整理

paths 整理

編輯:關於IOS

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;

 

1. CGContext類。

2. UIView::DrawRect函數

3. UIGraphicsGetCurrentContext()函數

4. UIView坐標系和Quartz坐標系相反。

5. CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];

6. initWithFrame, intWithCoder, DrawRect

7. CGPDFContextCreateWithURL, CGPDFContextCreate

CFURLCreateWithFileSystemPath(), CGDataConsumerCreateWithURL()

8. iOS 推薦使用 UIGraphicsBeginImageContextWithOptions,它會自動做Quartz和UIKit之間的坐標變換。

9. CGBitmapContextCreate

10. Pixel Format

NULL color space:

- kCGImageAlphaoOnly 8bpp = A8

Gray color space:

- kCGImageAlphaNone 8bpp = L8

- kCGImageAlphaOnly 8bpp = A8

- kCGImageAlphaNone 16bpp = L16

- KCGImageAlphaNone|kCGBitmapfloatComponents = L32F

RGB color space:

- kCGImageAlphaNoneSkipFirst, 16bpp, 5bpc = R5G5B5X1

- kCGImageAlphaNoneSkipFirst, 32bpp, 8bpc = R8G8B8X8

- kCGImageAlphaNoneSkipLast, 32bpp, 8bpc = X8R8G8B8

- kCGImageAlphaPremultipliedFirst, 32bpp, 8bpc = R8G8B8A8

- kCGImageAlphaPremultipliedLast, 32bpp, 8bpc = A8R8G8B8

- kCGImageAlphaPremultipledLast, 64bpp, 16bpc = A16R16G16B16

- kCGImageAlphaNonSkipLast, 64bpp, 16bpc = X16R16G16B16

- kCGImageAlphaNoneSkipLast|kCGBitmapFloatComponents, 128bpp, 32bpc = X32R32G32B32F

- kCGImageAlphaPremultipliedLast | kCGBitmapFloatComponents, 128bpp, 32bpc = A32R32G32B32F

CMYK space:

- kCGImageAlphaNone 32bpp, 8bpc = C8M8Y8K8

- kCGImageAlphaNone 64bpp, 16bpx = C16M16Y16K16

- kCGImageAlphaNone|kCGBitmapFloatComponents = C32M32Y32K32F

11. CGContextSetShouldAntialias for bitmap context, CGContextSetAllowAntialasing for graphics context.

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved