Beispiel #1
0
// CMYK returns a valid CMYK color
func (f Faker) CMYK() color.CMYK {
	r := uint8(randomIntBetween(0, 255))
	g := uint8(randomIntBetween(0, 255))
	b := uint8(randomIntBetween(0, 255))

	c, m, y, k := color.RGBToCMYK(r, g, b)

	return color.CMYK{C: c, M: m, Y: y, K: k}
}
Beispiel #2
0
Datei: color.go Projekt: oov/psd
func nCMYKAModel(c color.Color) color.Color {
	if _, ok := c.(NCMYKA); ok {
		return c
	}
	r, g, b, a := c.RGBA()
	cc, mm, yy, kk := color.RGBToCMYK(uint8(r>>8), uint8(g>>8), uint8(b>>8))
	cc = uint8((uint32(cc) * 0xffff) / a)
	mm = uint8((uint32(mm) * 0xffff) / a)
	yy = uint8((uint32(yy) * 0xffff) / a)
	kk = uint8((uint32(kk) * 0xffff) / a)
	return NCMYKA{255 - cc, 255 - mm, 255 - yy, 255 - kk, uint8(a >> 8)}
}