Move the NRGBAColor interface to be with the new FromColor function, since that's where it's used.
This commit is contained in:
parent
721c13c4c6
commit
158268694e
16
oklab.go
16
oklab.go
@ -106,6 +106,14 @@ func FromRGBA(r, g, b, a uint32) Color {
|
||||
return FromNRGBA(r, g, b, a)
|
||||
}
|
||||
|
||||
// NRGBAColor represent a color that can give us non pre-multiplied RGBA components.
|
||||
//
|
||||
// This isn't a standard interface, but we implement it and check for it regardless.
|
||||
type NRGBAColor interface {
|
||||
color.Color
|
||||
NRGBA() (r, g, b, a uint32)
|
||||
}
|
||||
|
||||
// FromColor converts an arbitrary color type to an OKLab [Color], with special handling
|
||||
// for [color.NRGBA], [color.NRGBA64], and anything implementing the [NRGBAColor] interface
|
||||
// to preserve transparent colors.
|
||||
@ -172,14 +180,6 @@ func Distance(a, b Color) float64 {
|
||||
return math.Sqrt(max(sqr(dL), sqr(dL+dA)) + max(sqr(da), sqr(da+dA)) + max(sqr(db), sqr(db+dA)))
|
||||
}
|
||||
|
||||
// NRGBAColor represent a color that can give us non pre-multiplied RGBA components.
|
||||
//
|
||||
// This isn't a standard interface, but we implement it and check for it regardless.
|
||||
type NRGBAColor interface {
|
||||
color.Color
|
||||
NRGBA() (r, g, b, a uint32)
|
||||
}
|
||||
|
||||
func okLabModel(c color.Color) color.Color {
|
||||
return FromColor(c)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user