[aarch64] Add support for -mcpu=grace
[official-gcc.git] / libgo / go / image / names.go
blob17b06588ac52e597067a7491046b56e7e6cf7d62
1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package image
7 import (
8 "image/color"
11 var (
12 // Black is an opaque black uniform image.
13 Black = NewUniform(color.Black)
14 // White is an opaque white uniform image.
15 White = NewUniform(color.White)
16 // Transparent is a fully transparent uniform image.
17 Transparent = NewUniform(color.Transparent)
18 // Opaque is a fully opaque uniform image.
19 Opaque = NewUniform(color.Opaque)
22 // Uniform is an infinite-sized Image of uniform color.
23 // It implements the color.Color, color.Model, and Image interfaces.
24 type Uniform struct {
25 C color.Color
28 func (c *Uniform) RGBA() (r, g, b, a uint32) {
29 return c.C.RGBA()
32 func (c *Uniform) ColorModel() color.Model {
33 return c
36 func (c *Uniform) Convert(color.Color) color.Color {
37 return c.C
40 func (c *Uniform) Bounds() Rectangle { return Rectangle{Point{-1e9, -1e9}, Point{1e9, 1e9}} }
42 func (c *Uniform) At(x, y int) color.Color { return c.C }
44 func (c *Uniform) RGBA64At(x, y int) color.RGBA64 {
45 r, g, b, a := c.C.RGBA()
46 return color.RGBA64{uint16(r), uint16(g), uint16(b), uint16(a)}
49 // Opaque scans the entire image and reports whether it is fully opaque.
50 func (c *Uniform) Opaque() bool {
51 _, _, _, a := c.C.RGBA()
52 return a == 0xffff
55 // NewUniform returns a new Uniform image of the given color.
56 func NewUniform(c color.Color) *Uniform {
57 return &Uniform{c}