def filter.blend.channel
gralha-svg-render@0.1.0.1 · svg.bend:4552
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
4552def filter.blend.channel(+a: F32, +b: F32, kind: U32) -> F32:
4553 match kind:
4554 case 1: (a * b : F32)
4555 case 2: (a + b - a * b : F32)
4556 case 3: U.min(a, b)
4557 case 4: U.max(a, b)
4558 case 5: filter.blend.hard(b, a)
4559 case 6: U.choose(F32, F32.is_le(b, 0.0), 0.0, U.choose(F32, F32.is_ge(a, 1.0), 1.0, U.min(1.0, (b / U.max(0.0000001, (1.0 - a : F32)) : F32))))
4560 case 7: U.choose(F32, F32.is_ge(b, 1.0), 1.0, U.choose(F32, F32.is_le(a, 0.0), 0.0, (1.0 - U.min(1.0, ((1.0 - b) / U.max(0.0000001, a) : F32)) : F32)))
4561 case 8: filter.blend.hard(a, b)
4562 case 9: filter.blend.soft(a, b)
4563 case 10: F32.abs((a - b : F32))
4564 case 11: (a + b - 2.0 * a * b : F32)
4565 case _: a