GraphicsContext for IOS developmentThe application class is the content to be introduced in this article, mainly to understand and learnGraphicsContextFor more information about how to use the application class, see this article.
1. CGContext class.
2. UIView: DrawRect Function
3. UIGraphicsGetCurrentContext () function
4. The UIView coordinate system is opposite to the Quartz coordinate system.
5. CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
6. initWithFrame, intWithCoder, DrawRect
7. cgw.contextcreatewithurl, cgw.contextcreate
- CFURLCreateWithFileSystemPath(), CGDataConsumerCreateWithURL()
8. We recommend that you use uigraphicsbeginimagecontextwitexceptions for iOS, which automatically performs coordinate transformation between Quartz and 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.
Summary: DetailsGraphicsContext for IOS developmentThe application class has been introduced. I hope this article will help you!