什么是图形背景? (IOS) [英] What is a graphic context? (iOS)

查看:132
本文介绍了什么是图形背景? (IOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图形背景究竟是什么?使用Core Graphic绘图时,我们会获得对上下文的引用。当我查看文档时,它似乎是一个对象,无论是用于打印,设备,pdf等,都要处理正确的绘图。

What exactly is a graphic context? When drawing with Core Graphic we get a reference to the context. When I look at the documentation it seems like it is an object or so that take care of the correct drawing whether it is for printing, device, pdf and so on.

任何人都可以帮我理解上下文的真实含义吗?我试过阅读文档,但我不明白。它是否包含有关系统或其他内容的信息(元数据)?

Could anyone help me to understand what a context really is? I tried reading the documentation but I do not understand. Is it an object that contains information(meta-data) about a system or something?

提前致谢

推荐答案

它似乎是一个或多个对象,无论是用于打印,设备,PDF格式等,都要处理正确的图纸。

"it seems like it is an object or so that take care of the correct drawing whether it is for printing, device, pdf and so on."

完全正确。

您只需编写真正做一些绘图的例程(但它可以是任何地方,任何类型的事物或设备)。你不必担心任何事情,除了画抽象...线条,圆圈,排版,颜色和其他这样的废话。

You simply write routines that "really" do some drawing (but it could be to anywhere, to any type of thing or device). You don't have to worry about ANYTHING other than drawing in the abstract ... lines, circles, typography, colours and other such nonsense.

-(void)happyDrawing
-(void)sadDrawing
-(void)fancyDrawing

然后 - 令人惊讶的是 - 你可以在任何地方使用它们。

Then -- amazingly -- you can use those anywhere.

-(void)makeSomeFiles
   {
   .. set up a context for making files
   .. happyDrawing
   }
-(void)makeATruGrayScaleBitmap
   {
   .. set up a context for making a gray bitmap
   .. happyDrawing
   }
-(void)drawRect
   {
   .. drawing on your Lisa screen
   .. happyDrawing
   }
-(void)drawRect
   {
   .. drawing on your iPad screen
   .. happyDrawing
   }
-(void)printAPage
   {
   .. set up a context for printing
   .. happyDrawing
   }

我希望它有所帮助!

这篇关于什么是图形背景? (IOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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