GraphicsContext application for IOS development

Source: Internet
Author: User

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

 
 
  1. 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

 
 
  1. NULL color space:  
  2. kCGImageAlphaoOnly 8bpp = A8 

Gray color space:

 
 
  1. kCGImageAlphaNone 8bpp = L8 
  2. kCGImageAlphaOnly 8bpp = A8 
  3. kCGImageAlphaNone 16bpp = L16 
  4. KCGImageAlphaNone|kCGBitmapfloatComponents = L32F 

RGB color space:

 
 
  1. kCGImageAlphaNoneSkipFirst, 16bpp, 5bpc = R5G5B5X1 
  2. kCGImageAlphaNoneSkipFirst, 32bpp, 8bpc = R8G8B8X8 
  3. kCGImageAlphaNoneSkipLast, 32bpp, 8bpc = X8R8G8B8 
  4. kCGImageAlphaPremultipliedFirst, 32bpp, 8bpc = R8G8B8A8 
  5. kCGImageAlphaPremultipliedLast, 32bpp, 8bpc = A8R8G8B8 
  6. kCGImageAlphaPremultipledLast, 64bpp, 16bpc = A16R16G16B16 
  7. kCGImageAlphaNonSkipLast, 64bpp, 16bpc = X16R16G16B16 
  8. kCGImageAlphaNoneSkipLast|kCGBitmapFloatComponents, 128bpp, 32bpc = X32R32G32B32F 
  9. kCGImageAlphaPremultipliedLast | kCGBitmapFloatComponents, 128bpp, 32bpc = A32R32G32B32F 

CMYK space:

 
 
  1. - kCGImageAlphaNone 32bpp, 8bpc = C8M8Y8K8 
  2. kCGImageAlphaNone 64bpp, 16bpx = C16M16Y16K16 
  3. kCGImageAlphaNone|kCGBitmapFloatComponents = C32M32Y32K32F 

11,

 
 
  1. CGContextSetShouldAntialias for bitmap context,   
  2. CGContextSetAllowAntialasing for graphics context. 

Summary: DetailsGraphicsContext for IOS developmentThe application class has been introduced. I hope this article will help you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.