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. linux之 LVM扩容

    1. 查看本机现在磁盘的情况[root@oralce10g ~]# df Filesystem 1K-blocks Used Available Use% Mounted on/dev/mapper/ ...

  2. bzoj1013球形空间

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1013 根据距离式子,两个点的话,两边平方再消掉x^2之后有: a1^2 - 2*a1*x1 ...

  3. WIN10下搭建react-native开发Android环境

    最近公司要求使用react-native进行移动端开发,据说macOS上开发坑会少的多,但我们是windows,莫法,直接抗吧!周末配置环境遇到很多问题,谨以此文做个记录... 准备 安装Chocol ...

  4. 马士兵Spring-声明式事务管理-XML

    1.com.cy.model中User.java  和 Log.java 实体 和上一节一样: 2.DAO的实现类com.cy.dao.impl中的UserDAOImpl.LogDAOImpl.jav ...

  5. 保持一个会话 添加 HTTP Cookie管理器

    在线程组中添加 http cookie manager即可 场景:登录后点击刷新简历

  6. 汇编_指令_FLAGS

    标志名                                       标志 1           标志 0 OF   (溢出标志)                     OV     ...

  7. Linux环境崩溃生成core文件以及调试

    Linux环境崩环境溃生成core文件以及调试 gdb结合coredump定位崩溃进程 Linux 使用core file文件快速定位程序崩溃代码行 http://www.cnblogs.com/ha ...

  8. laravel下载文件

    public function jobDownload(){ $realPath = public_path('download/job/postForm.xls'); $filename = '应聘 ...

  9. css常用属性总结:背景background下篇

    前言:这段时间天天加班到10:30之后,简直是x了. 在上一篇文章中,分别解析了background各个属性的用法和注意细节.如果我们在项目上使用背景效果,如果使用下面的写法,你可能抓狂. body{ ...

  10. confd test

    vi /etc/confd/confd.toml backend = "consul"confdir = "/etc/confd"log-level = &qu ...