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. pthread信号

    信号是典型的异步事件.内核在某个信号出现时有三种处理方式: 忽略信号,除了SIGKILL和SIGSTOP信号不能忽略外,其他大部分信号都可以被忽略: 捕捉信号,也就是在信号发生时调用一个用户函数,注意 ...

  2. 将DHT11移植到Linux系统上(转)

    由于项目需要,需要将DHT11移植到Linux.驱动程序如下 #include <linux/kernel.h> #include <linux/module.h> #incl ...

  3. Linux 解压zip need PK compat. v4.5 (can do v2.1)

    p7z 当使用7zip压缩大于4G的文件后,在linux下解压时,出现下面的提示,无法解压: [root@localhost root]# unzip Wrestlemania20.zip Archi ...

  4. moodle搭建相关的笔记

    关于moodle内网外网访问问题的解决方案(转) http://blog.chinaunix.net/uid-656828-id-3106027.html

  5. 工欲善其事必先利其器系列之:更换Visual Studio主题.

    前言:如果你厌烦的vs2010的蓝色风格主题,可以使用Visual Studio Color Theme Editor这款插件来改变主题风格,不过我还是喜欢METRO风格. 效果图预览: Windwo ...

  6. mysql 计算经纬度函数(米)

    ) CHARSET utf8mb4 begin return ROUND( * ASIN( SQRT( POW( SIN( ( lat1 ) ), ) ) ) * POW( SIN( ( lon1 ) ...

  7. C++ 函数特性_参数默认值

    函数参数默认值写法 有默认参数值的参数必须在参数表的最右边 ,) // 这是正确的写法 , int k) // 这是错误写法 先声明,后定义 在写函数时要先在代码前面声明,然后再去定义. 函数默认参数 ...

  8. [转]C# int.ToString()

    原文链接:https://msdn.microsoft.com/zh-cn/library/dwhawy9k 原文链接:https://msdn.microsoft.com/zh-cn/library ...

  9. nc工具用法

    http://man.linuxde.net/nc_netcat nc命令用法举例 什么是nc

  10. python 多态、多继承、函数重写、迭代器

    用于类的函数 issubclass(cls,class_or_tuple) 判断一个类是否继承自其他的类,如果此类cls是class或tuole中的一个派生(子类)则返回True,否则返回False ...