Added a function to convert any color to color.RGBA
This commit is contained in:
parent
14c4db9d16
commit
b0108e6e0b
@ -7,3 +7,14 @@ func Transparent (c color.Color) bool {
|
|||||||
_, _, _, a := c.RGBA()
|
_, _, _, a := c.RGBA()
|
||||||
return a != 0xFFFF
|
return a != 0xFFFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToRGBA converts any color to a color.RGBA value.
|
||||||
|
func ToRGBA (c color.Color) color.RGBA {
|
||||||
|
r, g, b, a := c.RGBA()
|
||||||
|
return color.RGBA {
|
||||||
|
uint8(r >> 8),
|
||||||
|
uint8(g >> 8),
|
||||||
|
uint8(b >> 8),
|
||||||
|
uint8(a >> 8),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user