74 srcAlpha = mul(srcAlpha, maskAlpha, opacity);
76 if (isZeroValueFuzzy(srcAlpha)) {
81 if(!isZeroValueFuzzy(dstAlpha)) {
83 if(i !=
alpha_pos && (allChannelFlags || channelFlags.testBit(i))) {
85 CompositeOpFunctor::clampSourceChannelValue(
86 BlendingPolicy::toAdditiveSpace(
89 CompositeOpFunctor::clampDestinationChannelValue(
90 BlendingPolicy::toAdditiveSpace(
93 dst[i] = BlendingPolicy::fromAdditiveSpace(
95 CompositeOpFunctor::composeChannel(srcInBlendSpace, dstInBlendSpace),
102 }
else if (isZeroValueFuzzy(dstAlpha)) {
104 if(i !=
alpha_pos && (allChannelFlags || channelFlags.testBit(i))) {
105 dst[i] = BlendingPolicy::fromAdditiveSpace(
106 CompositeOpFunctor::clampSourceChannelValue(
107 BlendingPolicy::toAdditiveSpace(src[i])));
111 }
else if (isUnitValueFuzzy(dstAlpha)) {
113 if(i !=
alpha_pos && (allChannelFlags || channelFlags.testBit(i))) {
115 CompositeOpFunctor::clampSourceChannelValue(
116 BlendingPolicy::toAdditiveSpace(
119 CompositeOpFunctor::clampDestinationChannelValue(
120 BlendingPolicy::toAdditiveSpace(
123 dst[i] = BlendingPolicy::fromAdditiveSpace(
124 lerp(dstInBlendSpace,
125 CompositeOpFunctor::composeChannel(srcInBlendSpace, dstInBlendSpace),
129 return unitValue<channels_type>();
130 }
else if (isUnitValueFuzzy(srcAlpha)) {
132 if(i !=
alpha_pos && (allChannelFlags || channelFlags.testBit(i))) {
134 CompositeOpFunctor::clampSourceChannelValue(
135 BlendingPolicy::toAdditiveSpace(
138 CompositeOpFunctor::clampDestinationChannelValue(
139 BlendingPolicy::toAdditiveSpace(
142 dst[i] = BlendingPolicy::fromAdditiveSpace(
143 lerp(srcInBlendSpace,
144 CompositeOpFunctor::composeChannel(srcInBlendSpace, dstInBlendSpace),
148 return unitValue<channels_type>();
150 channels_type newDstAlpha = unionShapeOpacity(srcAlpha, dstAlpha);
152 if (!isZeroValueFuzzy(newDstAlpha)) {
155 if(i !=
alpha_pos && (allChannelFlags || channelFlags.testBit(i))) {
157 CompositeOpFunctor::clampSourceChannelValue(
158 BlendingPolicy::toAdditiveSpace(
161 CompositeOpFunctor::clampDestinationChannelValue(
162 BlendingPolicy::toAdditiveSpace(
166 blend(srcInBlendSpace, srcAlpha,
167 dstInBlendSpace, dstAlpha,
168 CompositeOpFunctor::composeChannel(srcInBlendSpace, dstInBlendSpace));
170 dst[i] = BlendingPolicy::fromAdditiveSpace(div(result, newDstAlpha));