mirror of https://github.com/adamdruppe/arsd.git
Implement "divide" blend-mode
This commit is contained in:
parent
9a4f8467f8
commit
ca6dd1bb90
|
@ -463,6 +463,8 @@ enum BlendMode {
|
||||||
|
|
||||||
darken,
|
darken,
|
||||||
lighten,
|
lighten,
|
||||||
|
|
||||||
|
divide,
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -533,6 +535,17 @@ void blendPixel(BlendMode mode, BlendAccuracy accuracy = BlendAccuracy.rgba)(
|
||||||
)(target, source);
|
)(target, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ditto
|
||||||
|
void blendPixel(BlendMode mode, BlendAccuracy accuracy = BlendAccuracy.rgba)(
|
||||||
|
ref Pixel target,
|
||||||
|
const Pixel source,
|
||||||
|
) if (mode == Blend.divide) {
|
||||||
|
|
||||||
|
return alphaBlend!(accuracy,
|
||||||
|
(b, f) => (f == 0) ? ubyte(0xFF) : clamp255(0xFF * b / f)
|
||||||
|
)(target, source);
|
||||||
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
Blends the pixel data of `source` into `target`.
|
Blends the pixel data of `source` into `target`.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue