...
Source file src/pkg/image/names.go
1
2
3
4
5 package image
6
7 import (
8 "image/color"
9 )
10
11 var (
12
13 Black = NewUniform(color.Black)
14
15 White = NewUniform(color.White)
16
17 Transparent = NewUniform(color.Transparent)
18
19 Opaque = NewUniform(color.Opaque)
20 )
21
22
23
24 type Uniform struct {
25 C color.Color
26 }
27
28 func (c *Uniform) RGBA() (r, g, b, a uint32) {
29 return c.C.RGBA()
30 }
31
32 func (c *Uniform) ColorModel() color.Model {
33 return c
34 }
35
36 func (c *Uniform) Convert(color.Color) color.Color {
37 return c.C
38 }
39
40 func (c *Uniform) Bounds() Rectangle { return Rectangle{Point{-1e9, -1e9}, Point{1e9, 1e9}} }
41
42 func (c *Uniform) At(x, y int) color.Color { return c.C }
43
44
45 func (c *Uniform) Opaque() bool {
46 _, _, _, a := c.C.RGBA()
47 return a == 0xffff
48 }
49
50 func NewUniform(c color.Color) *Uniform {
51 return &Uniform{c}
52 }
53
View as plain text