我们应该使用哪个CGImageAlphaInfo? [英] Which CGImageAlphaInfo should we use?

查看:350
本文介绍了我们应该使用哪个CGImageAlphaInfo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Quartz 2D编程指南定义了各种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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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