问题描述
定义了各种alpha存储模式的可用性:
The Quartz 2D programming guide defines the availability of the various alpha storage modes:
我们应该将哪些用于RGB上下文,为什么?
Which ones should we use for RGB contexts, and why?
对于非不透明的上下文, kCGImageAlphaPremultipliedFirst
或 kCGImageAlphaPremultipliedLast
?
For non-opaque contexts, kCGImageAlphaPremultipliedFirst
or kCGImageAlphaPremultipliedLast
?
对于不透明的上下文, kCGImageAlphaNoneSkipFirst
或 kCGImageAlphaNoneSkipLast
?
For opaque contexts, kCGImageAlphaNoneSkipFirst
or kCGImageAlphaNoneSkipLast
?
价值的选择会影响效果吗?
通常,我看到<$对于不透明的上下文,c $ c> kCGImageAlphaPremultipliedFirst 用于非opaque和 kCGImageAlphaNoneSkipFirst
。有些人表示这些表现更好,但我没有看到任何关于此的确凿证据或文件。
Typically, I see kCGImageAlphaPremultipliedFirst
for non-opaque and kCGImageAlphaNoneSkipFirst
for opaque contexts. Some state that these perform better but I haven't seen any hard evidence or documentation about this.
快速GitHub搜索显示开发者青睐 kCGImageAlphaPremultipliedFirst
over kCGImageAlphaPremultipliedLast
和 kCGImageAlphaNoneSkipLast
over kCGImageAlphaNoneSkipFirst
。可悲的是,这只不过是轶事证据。
A quick GitHub search shows that developers favor kCGImageAlphaPremultipliedFirst
over kCGImageAlphaPremultipliedLast
and kCGImageAlphaNoneSkipLast
over kCGImageAlphaNoneSkipFirst
. Sadly, this is little more than anecdotal evidence.
推荐答案
2014年WWDC的Apple工程师确认我们应该使用 kCGImageAlphaPremultipliedFirst
或 kCGImageAlphaNoneSkipFirst
,它确实会影响性能。
Confirmed by an Apple engineer at WWDC 2014 that we should use kCGImageAlphaPremultipliedFirst
or kCGImageAlphaNoneSkipFirst
, and that it does affect performance.
这篇关于我们应该使用哪个CGImageAlphaInfo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!