首页 > Windows开发 > 详细

Core Graphics Layer Drawing

时间:2014-02-26 13:45:32      阅读:433      评论:0      收藏:0      [点我收藏+]

Core Graphics Layer Drawing

CGLayer objects (CGLayerRef data type) allow your application to use layers for drawing.

Layers are suited for the following:

  • High-quality offscreen rendering of drawing that you plan to reuse. 
  • Repeated drawing. 
  • Buffering. Although you can use layers for this purpose, you shouldn’t need to because the Quartz Compositor makes buffering on your part unnecessary. If you must draw to a buffer, use a layer instead of a bitmap graphics context.

  CGLayer objects and transparency layers are parallel to CGPath objects and paths created by CGContext functions. In the case of a CGLayer or CGPath object, you paint to an abstract destination and can then later draw the complete painting to another destination, such as a display or a PDF. When you paint to a transparency layer or use the CGContext functions that draw paths, you draw directly to the destination represented by a graphics context. There is no intermediate abstract destination for assembling the painting.

  You need to perform the tasks described in the following section to draw using a CGLayer object:

  1. “Create a CGLayer Object Initialized with an Existing Graphics Context”: CGLayerCreateWithContext
  2. “Get a Graphics Context for the Layer”: CGLayerGetContext
  3. “Draw to the CGLayer Graphics Context”
  4. “Draw the Layer to the Destination Graphics Context”:  CGContextDrawLayerInRect,  CGContextDrawLayerAtPoint,

  Layer就是层,一个层是一个单独可绘制的Canvas,层可被绘制到Graphics Contex上。除了层,Bitmap,Image,Primitives都可被绘制到Graphics Context上。

Core Graphics Layer Drawing

原文:http://www.cnblogs.com/tekkaman/p/3567787.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!