iOS“当前图形上下文“ - 那是什么 [英] iOS " current graphics context" - What is that

查看:98
本文介绍了iOS“当前图形上下文“ - 那是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我绘制线条和形状等时,我会在iOS中获得当前图形上下文。

When I draw lines and shapes etc I get the " current graphics context" in iOS.

究竟什么是当前图形上下文 - 我正在寻找对于30,000英尺的描述。

What exactly though is " current graphics context" - I'm looking for the 30,000 foot description.

现在我只是复制并粘贴UI代码,而不是确切地知道它在做什么。

Right now I just copy and paste UI code, not exactly sure what it's doing.

推荐答案

操作系统需要一个位置来保存信息,例如绘图状态,您不希望在每个CG绘图命令中指定这些信息,例如在哪个位图或视图中绘制,使用的比例或其他变换,指定的最后颜色等。

The OS needs a place to save information, such as drawing state, which you don't want to specify in every single CG drawing command, such as in which bitmap or view to draw, the scale or other transform to use, the last color you specified, etc.

上下文告诉每个CG调用在哪里找到当前所有这些东西绘图电话。为完全相同的绘图调用提供不同的上下文,并且该调用可能会在完全不同的视图中绘制到不同的位图,具有不同的颜色,不同的比例等。

The context tells each CG call where to find all this "stuff" for your current drawing call. Give a different context to the exact same drawing call, and that call might draw to a different bitmap in a completely different view, with a different color, different scale, etc.

这篇关于iOS“当前图形上下文“ - 那是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆