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

  • 相关阅读:
    数据库设计中的四个范式(转)
    几个SQL
    一个整形数组,找其中第二大值
    装箱与拆箱
    继承与隐藏方法
    C++/C# 最基本的Marshal和Ptr
    C++/C#结构体转化-传string给C++
    C++/C#结构体转化-二维数组-bytes To Strings
    C# 懒人常用异步方法
    jsplumb 的初次使用
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3567787.html
Copyright © 2011-2022 走看看