首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >《Quartz 2D编程指南》之图形上下文的作用、分类、状态的保持、恢复、 上下文的矩阵操作(修改上下文的形变)

《Quartz 2D编程指南》之图形上下文的作用、分类、状态的保持、恢复、 上下文的矩阵操作(修改上下文的形变)

作者头像
公众号iOS逆向
发布2021-04-15 16:08:20
3730
发布2021-04-15 16:08:20
举报
文章被收录于专栏:iOS逆向与安全iOS逆向与安全

引言

原文:

https://kunnan.blog.csdn.net/article/details/113057688

  • The Graphics Context:数据类型为CGContextRef

You can think of a graphics context as a drawing destination. A graphics context encapsulates all of the information needed to draw to an underlying canvas,including the current drawing attributes and a device-specific representation of the digital paint on the canvas.In Cocoa, graphics contexts are represented by the NSGraphicsContext class and are used to represent the following drawing destinations: 1、Windows (and their views) 2、Images (including bitmaps of all kinds) 3、Printers 4、Files (PDF, EPS) 5、OpenGL surfaces

I、作用

  • 保持绘图的信息
  • 决定绘图的输出目标(PDF、bitmap、layer、printer、window)

相同的一套绘图序列,指定不同的Graphics Context,就可将相同的图像绘制到不同的目标上

这里写图片描述

II、drawing destination(分类)

Quartz2D提供了以下几种类型的Graphics Context:

  • Bitmap Graphics Context
  • PDF Graphics Context
  • Window Graphics Context
  • Layer Graphics Context
  • Printer Graphics Context

III、The Graphics State:绘图状态

In addition to managing the drawing destination, an NSGraphicsContext object also manages the graphics state associated with the current drawing destination.

The graphics state consists of attributes that affect the way content is drawn, such as the line width, stroke color, and fill color.

For more information about the attributes that comprise the current graphics state, and the objects that manage them, see Graphics State Information.

IV、 图形上下文栈的操作:状态的保持、恢复

The current graphics state can be saved on a stack that is maintained by the current graphics context object.

Any subsequent changes to the graphics state can then be undone quickly by simply restoring the previous graphics state.

  • 将当前的上下文copy一份,保存到栈顶(那个栈叫做”图形上下文栈”)
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-04-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 iOS逆向 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 引言
  • I、作用
  • II、drawing destination(分类)
  • III、The Graphics State:绘图状态
  • IV、 图形上下文栈的操作:状态的保持、恢复
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档