...
Source file
src/tawesoft.co.uk/go/ximage/xcolor/red.go
Documentation:
src/tawesoft.co.uk/go/ximage/xcolor/red.go
1
2
3
4
5
6 package xcolor
7
8 import (
9 "image/color"
10 )
11
12
13 type Red struct {
14 R uint8
15 }
16
17 func (c Red) RGBA() (r, g, b, a uint32) {
18 r = uint32(c.R)
19 r |= r << 8
20 return r, 0, 0, 0xFFFF
21 }
22
23
24 var RedModel color.Model = color.ModelFunc(redModel)
25
26 func redModel(c color.Color) color.Color {
27 if _, ok := c.(color.RGBA); ok {
28 return c
29 }
30 r, _, _, _ := c.RGBA()
31 return Red{uint8(r >> 8)}
32 }
33
View as plain text