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. ballerina 学习二十四 监控ballerina

    ballerina 服务的监控还是比较方便的,以及集成了Prometheus Grafana Jaeger Elastic Stack 监控服务监控的集成 主要包含以下几个步骤 a. 安装docker ...

  2. 【linux】ls常用参数

    1. 命令格式: ls [选项] [目录名] 2. 命令功能: 列出目标目录中所有的子目录和文件. 3. 常用参数: -a, –-all 列出目录下的所有文件,包括以 . 开头的隐含文件 -d, –- ...

  3. Django视图View

    1.什么是Django的视图函数 一个视图函数(或者一个类),简称视图 是python的一个简单的函数,他是接受web请求 并且 处理逻辑 进而返回 响应 响应可以是一张网页的HTML内容,一个重定向 ...

  4. 将jar包安装到maven仓库

    <!-- https://mvnrepository.com/artifact/ojdbc/ojdbc --><!-- (参数一):下载到本地的ojdbc-10.2.0.4.0.ja ...

  5. ubantu的下载和在虚拟机VM中的安装

    一.下载Ubuntu镜像文件 下载地址:http://www.ubuntu.com 打开上面的连接,我们来到如下页面,点击download: 下一步,到如下页面,点击Ubuntu Desktop: 然 ...

  6. 关于json_encode转义斜杠的问题

    加上参数  JSON_UNESCAPED_SLASHES即可 echo json_encode($data,JSON_UNESCAPED_SLASHES);

  7. 551. Student Attendance Record I + Student Attendance Record II

    ▶ 一个学生的考勤状况是一个字符串,其中各字符的含义是:A 缺勤,L 迟到,P 正常.如果一个学生考勤状况中 A 不超过一个,且没有连续两个 L(L 可以有多个,但是不能连续),则称该学生达标(原文表 ...

  8. js解决弹窗问题实现班级跳转DIV示例

    js解决弹窗问题实现班级跳转DIV 1.js代码如下: <%--实现班级跳转DIV--%>  <div id="displayClassDiv" style=&q ...

  9. ACM Dance Recital(dfs+剪枝)

    The Production Manager of a dance company has been tasked with determining the cost for the seasonal ...

  10. 取消Eclipse的Error Reporting

    选择Preferences->General->Error Reporting,Send Mode选择Never send reports