CGLayer和CALayer有什么区别和兼容性? [英] What's the difference and compatibility of CGLayer and CALayer?

查看:200
本文介绍了CGLayer和CALayer有什么区别和兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑 CGLayer CALayer 。它们看起来类似,为什么有单独的实现? CGLayer CALayer


之间有什么区别和兼容性?



完全不同,

$ b $

b

严格来说是巧合,在名称中使用layer这个词;



CGLayers是一种特殊的高性能的东西。



你可以考虑他们像位图,但更好。



苹果坐下来说:我们生病的人使用位图,让我们做得更好! : - )



确实,您只能使用CGLayers



重复一遍,CGLayers完全在屏幕外使用。



一旦准备好,你就可以将它们放到你的实际屏幕上

:注意:CGLayers经常被单独使用。当我说他们被单独使用,我的意思是他们用于:图像处理或数学计算。在这种情况下,CGLayers从来不在屏幕上,他们完全没有连接到屏幕世界。)



相反... CALayers只是in视图中的事情。 CALayers就是视图的工作原理。



这两个概念完全不同。



CALAYERS只是在视图中的东西。 相反,CGLayers是Apple的酷炫的屏幕外,高性能,计算机器。



完全没有视图的连接,没有与视图的关联。 (当然,你可以将一个CGLayer粘贴到一个视图,但是,然后,你可以粘贴说排版或一个图像到视图中排版和图像不是视图,CGLayers不是视图。)



典型的例子是:



你想画一些复杂的东西,屏幕。这个问题的答案恰恰是CGLayers。你的工作区将是一个CGLayer;



为了清楚起见,我认为苹果应该选择不同的名称 ...



一个好的名称将是CGCalculationSpace。



名字包含单词layer,让你想起NSLayers。



重复一遍:绝对没有任何关系,无论如何。 CGLayers甚至没有模糊的层与相关。



没有连接。这是一个耻辱!



CGLayers应该被称为工作空间或计算范式或



希望它有帮助,希望你还在读!


I'm confusing CGLayer and CALayer. They look similar, so why are there separate implementations? What's the difference between, and compatibility of, CGLayer and CALayer?

解决方案

They are completely different, and not compatible.

To be absolutely clear:

it is strictly a coincidence that the word "layer" is used in both names; they are completely unrelated.

CGLayers are a "special" "high performance" thingy.

You could consider them "like bitmaps, but better."

Apple sat down and said "We're sick of people using bitmaps, let's make something better!" :-)

Indeed, you only work with CGLayers offscreen.

To repeat, CGLayers are entirely used offscreen.

Once they are ready, you can then blast them on to your actual screen (that is to say: blast them on to one of your views).

(However: note that: CGLayers are often used "alone." When I say they are used "alone," I mean they are used for: image processing or mathematical calculations. In that case, CGLayers are never seen onscreen, and they have utterly no connection to the onscreen world.)

In contrast ... CALayers are simply the things "in" views. CALayers are just how views work.

So the two concepts are totally different.

CALayers are just the things "in" views. In contrast CGLayers are Apple's cool "offscreen, high performance, calculation machinery."

To be clear, CGLayers have utterly no connection to views, and no association with views. (Sure, you could paste a CGLayer in to a view, but then, you can paste say "typography" or "an image" in to a view. Typography and images are not views, and CGLayers are not views.)

The typical example is this:

you want to draw something complicated once, and then draw that thing many times on-screen. The answer to that problem is exactly CGLayers. Your "work area" would be a CGLayer; you could then blit it on to a printer, on to the screen, or whatever.

To be clear, in my opinion Apple should have chosen a different name ...

a good name would be "CGCalculationSpace."

The fact that the name contains the word "layer," makes you think of NSLayers.

To repeat: there is absolutely no relationship, whatsoever, in any way. CGLayers are not even vaguely related to layers.

There is no connection, at all. It is really confusing that the letters "l a y e r" are used in the name - it's a shame!!

CGLayers should be called perhaps "workspaces" or "calculation paradigms" or something like that.

Hope it helps and hope you're still reading!

这篇关于CGLayer和CALayer有什么区别和兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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