v0.1.1 minor blend updates, lazy LUT build, example added

This commit is contained in:
2026-07-15 07:51:31 -04:00
parent 79433f872c
commit 49124ee973
4 changed files with 227 additions and 6 deletions
+2 -1
View File
@@ -55,7 +55,8 @@ func (c RGB) Lerp(other RGB, t float64) RGB {
// Luma returns Rec. 601 luminance: R*0.299 + G*0.587 + B*0.114
func Luma(c RGB) uint8 {
return uint8((int(c.R)*299 + int(c.G)*587 + int(c.B)*114) / 1000)
// +500 rounds half-up, uniform rounding across the package
return uint8((int(c.R)*299 + int(c.G)*587 + int(c.B)*114 + 500) / 1000)
}
// RedmeanDistance returns squared perceptually-weighted distance between a and b.