actually much faster

This commit is contained in:
Ryan Oldenburg 2021-01-28 22:36:38 -06:00
parent 9ea66864b1
commit 01fd4eed6d

View file

@ -1,5 +1,5 @@
## Blending modes.
import chroma, math
import chroma, math, common
when defined(amd64) and not defined(pixieNoSimd):
import nimsimd/sse2
@ -384,8 +384,10 @@ proc hardLight(backdrop, source: uint32): uint8 {.inline.} =
screen(backdrop, 2 * source - 255)
proc blendNormal(backdrop, source: ColorRGBA): ColorRGBA =
result = source
result = alphaFix(backdrop, source, result)
blendNormalPremultiplied(
backdrop.toPremultipliedAlpha(),
source.toPremultipliedAlpha()
).toStraightAlpha()
proc blendDarken(backdrop, source: ColorRGBA): ColorRGBA =
result.r = min(backdrop.r, source.r)