zoukankan      html  css  js  c++  java
  • Core Graphics Layer Drawing

    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上。

  • 相关阅读:
    笔记-[5]-关于JS事件流!
    JS中的模块化开发之Sea.JS
    利用JavaScript如何创建一个table表格[第2种方法]
    二维数组左滑删除某一行
    sdwebimage缓存图片
    scrollView中内部控件的悬停
    (转)将图片保存到相册
    离屏渲染
    标签栏隐藏
    iOS8新特性之交互式通知
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3567787.html
Copyright © 2011-2022 走看看