gpt4 book ai didi

ios - 在 iOS 中实现 Porter-Duff 合成操作

转载 作者:行者123 更新时间:2023-11-29 12:01:08 27 4
gpt4 key购买 nike

iOS SDK 中有Porter-Duff 合成操作吗?

基于 12 种 Porter-Duff 合成操作。 enter image description here

最佳答案

iOS CoreGraphics 框架支持以下类型的混合模式,包括 Porter-Duff

typedef CF_ENUM (int32_t, CGBlendMode) {
/* Available in Mac OS X 10.4 & later. */
kCGBlendModeNormal,
kCGBlendModeMultiply,
kCGBlendModeScreen,
kCGBlendModeOverlay,
kCGBlendModeDarken,
kCGBlendModeLighten,
kCGBlendModeColorDodge,
kCGBlendModeColorBurn,
kCGBlendModeSoftLight,
kCGBlendModeHardLight,
kCGBlendModeDifference,
kCGBlendModeExclusion,
kCGBlendModeHue,
kCGBlendModeSaturation,
kCGBlendModeColor,
kCGBlendModeLuminosity,

/* Available in Mac OS X 10.5 & later. R, S, and D are, respectively,
premultiplied result, source, and destination colors with alpha; Ra,
Sa, and Da are the alpha components of these colors.

The Porter-Duff "source over" mode is called `kCGBlendModeNormal':
R = S + D*(1 - Sa)

Note that the Porter-Duff "XOR" mode is only titularly related to the
classical bitmap XOR operation (which is unsupported by
CoreGraphics). */

kCGBlendModeClear, /* R = 0 */
kCGBlendModeCopy, /* R = S */
kCGBlendModeSourceIn, /* R = S*Da */
kCGBlendModeSourceOut, /* R = S*(1 - Da) */
kCGBlendModeSourceAtop, /* R = S*Da + D*(1 - Sa) */
kCGBlendModeDestinationOver, /* R = S*(1 - Da) + D */
kCGBlendModeDestinationIn, /* R = D*Sa */
kCGBlendModeDestinationOut, /* R = D*(1 - Sa) */
kCGBlendModeDestinationAtop, /* R = S*(1 - Da) + D*Sa */
kCGBlendModeXOR, /* R = S*(1 - Da) + D*(1 - Sa) */
kCGBlendModePlusDarker, /* R = MAX(0, (1 - D) + (1 - S)) */
kCGBlendModePlusLighter /* R = MIN(1, S + D) */
};

以下 Apple 开发人员链接演示了如何实现 Porter-Duff 混合。

https://developer.apple.com/library/ios/samplecode/QuartzDemo/Listings/QuartzDemo_QuartzBlendingViewController_m.html

希望这对您有所帮助。

关于ios - 在 iOS 中实现 Porter-Duff 合成操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36978908/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com