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的更多相关文章

  1. Cocoa Touch(三):图形界面UIKit、Core Animation、Core Graphics

    UIKit 视图树模型 1.视图树模型 计算机图形实际上是一个视图树模型,每个视图都有一个本地坐标系.每个本地坐标系的组成部分是:原点在父坐标系中的位置,每个基在父坐标系中的位置,由此就可以根据向量的 ...

  2. iOS图像处理之Core Graphics和OpenGL ES初见

    http://www.jianshu.com/p/f66a7ca326dd iOS支持两套图形API族:Core Graphics/QuartZ 2D 和OpenGL ES.OpenGL ES是跨平台 ...

  3. Core Graphics 定制UIVIew 处理图片

    许多UIView的子类,如UIButton或UILabel,它们的形状都是系统固定的.但是,对于一些特殊的情况,我们需要绘制产品狗想要的图形.那么等待我们的只有两个选择:第一,可以使用UIImageV ...

  4. iOS 图形处理 Core Graphics Quartz2D 教程

    Core Graphics Framework是一套基于C的API框架,使用了Quartz作为绘图引擎.它提供了低级别.轻量级.高保真度的2D渲染.该框架可以用于基于路径的 绘图.变换.颜色管理.脱屏 ...

  5. iOS圆角view的Swift实现(利用Core Graphics绘制)

    iOS圆角view的Swift实现(利用Core Graphics绘制) 因为app的列表用用到了圆形图片的头像,所以去探究并思考了一下这个问题.首先这个问题有两个方向的解决方案: 把图片弄成圆形的. ...

  6. iOS实现图形编程可以使用三种API(UIKIT、Core Graphics、OpenGL ES及GLKit)

    这些api包含的绘制操作都在一个图形环境中进行绘制.一个图形环境包含绘制参数和所有的绘制需要的设备特定信息,包括屏幕图形环境.offscreen 位图环境和PDF图形环境,用来在屏幕表面.一个位图或一 ...

  7. Chromium网页Graphics Layer Tree创建过程分析

    在前面一文中.我们分析了网页Render Layer Tree的创建过程.在创建Render Layer的同一时候,WebKit还会为其创建Graphics Layer.这些Graphics Laye ...

  8. Core Graphics框架 利用Quartz 2D绘图

    首先,什么是Core Graphics和Quartz 2D? Core Graphics:是基于Quartz 2D绘图引擎的一个C语言的API绘图框架.它也是iOS开发中最基本的框架(Framewor ...

  9. [译]Modern Core Graphics with Swift系列

    第一篇 想象一下你已经完成了你的app并且运行的很好,但是界面看上去太土,你可以在PS里面画好多不同尺寸的自定义控件,Apple并没有4x的retina屏幕. 或者你已经未雨绸缪,在代码中使用Core ...

随机推荐

  1. 发发牢骚,觉得走c#这条路,不该太浮躁。

    发发牢骚,觉得走c#这条路,不该太浮躁.校园招聘结束了,腾讯,华为,百度,完美时空,网易,阿里,让我觉得.NET很受歧视.清一色的C/C++,JAVA,只有网易有一点.Net的,但是都是非核心的运维工 ...

  2. 虚拟化环境下的CentOS7网络环境存在的问题

    http://dgd2010.blog.51cto.com/1539422/1592821/ 为什么要进行一次测试? 在使用CentOS7的过程中发现网络部分有很多与CentOS6所不同的地方. 1. ...

  3. popup控件代码示例

    1.jsp页面input框中的代码 <td class="value"> <input name="demos[0].id" type=&qu ...

  4. Java 基于UDP的类似于QQ的循环通信

    package Day10; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetS ...

  5. UI“三重天”之selenium--封装(二)

    基础示例代码: /** * @author Richered **/ package com.sample; import org.openqa.selenium.By; import org.ope ...

  6. [saiku] 通过管理台配置用户、schema和数据源

    上一篇讲到了如何下载和安装saiku [http://www.cnblogs.com/avivaye/p/4877680.html] 本文简介下saiku用户的配置操作和需要注意的点 一.添加用户 S ...

  7. SpringBoot入门(2)

    一.上一篇 上一篇最后说到,可以把启动类放到非上级目录“@Componentscan这个注解后面指定扫描的包名(value=“com.zbb”)”,这里的value是一个数组,我们可以写多个目录,进行 ...

  8. Navicat 入门使用方法

    Navicat 多重连接数据库的管理工具,支持连接到(MySQL.Oracle.PostgreSQL.SQLite .MariaDB )多类数据库,也支持多类数据库的管理和使用 1.Navicat 主 ...

  9. 很好用的log4j

  10. python greenlet 背景介绍与实现机制

    最近开始研究Python的并行开发技术,包括多线程,多进程,协程等.逐步整理了网上的一些资料,今天整理一下greenlet相关的资料. 并发处理的技术背景 并行化处理目前很受重视, 因为在很多时候,并 ...