func (c NGrayA) RGBA() (uint32, uint32, uint32, uint32) {
	y := uint32(c.Y) * 0x101
	if c.A == 0xff {
		return y, y, y, 0xffff
	}
	if c.A == 0 {
		return 0, 0, 0, 0
	}
	a := uint32(c.A) * 0x101
	y = y * a / 0xffff
	return y, y, y, a
}
RGBA implements color.Color interface's method.
package color
import (
	"image/color"
	"math"
)
func fromFloat(v, gamma float64) uint32 {
	x := math.Pow(v, gamma)
	switch {
	case x >= 1:
		return 0xffff
	case x <= 0:
		return 0
	default:
		return uint32(x * 0xffff)
	}
}
func toFloat(v uint32, gamma float64) float64 {
	return math.Pow(float64(v)/0xffff, gamma)
}
type Gray1 struct {
	Y bool
}
func (c Gray1) RGBA() (r, g, b, a uint32) {
	if c.Y {
		return 0xffff, 0xffff, 0xffff, 0xffff
	}
	return 0, 0, 0, 0xffff
}
func gray1Model(c color.Color) color.Color {
	if _, ok := c.(Gray1); ok {
		return c
	}
	r, g, b, _ := c.RGBA()
	y := (299*r + 587*g + 114*b + 500) / 1000
	return Gray1{y >= 0x8000}
}
type Gray32 struct {
	Y float32
}
func (c Gray32) RGBA() (r, g, b, a uint32) {
	const gamma = 1.0 / 2.2
	y := fromFloat(float64(c.Y), gamma)
	return y, y, y, 0xffff
}
func gray32Model(c color.Color) color.Color {
	if _, ok := c.(Gray32); ok {
		return c
	}
	r, g, b, _ := c.RGBA()
	y := (299*r + 587*g + 114*b + 500) / 1000
	const gamma = 2.2
	return Gray32{float32(toFloat(y, gamma))}
}
type NGrayA struct {
	Y uint8
	A uint8
}