image

package
v0.0.0-...-cec5250 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2017 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// White color
	White = Color{R: 1, G: 1, B: 1}
	// Black color
	Black = Color{R: 0, G: 0, B: 0}
	// Red color
	Red = Color{R: 1, G: 0, B: 0}
	// Green color
	Green = Color{R: 0, G: 1, B: 0}
	// Blue color
	Blue = Color{R: 0, G: 0, B: 1}
	// Magenta color
	Magenta = Color{R: 1, G: 0, B: 1}
	// Yellow color
	Yellow = Color{R: 1, G: 1, B: 0}
	// Cyan color
	Cyan = Color{R: 0, G: 1, B: 1}
)

Functions

This section is empty.

Types

type Color

type Color struct {
	R float64 `json:"r"`
	G float64 `json:"g"`
	B float64 `json:"b"`
}

Color defines an RGB color with floating point precision

func ColorFromMap

func ColorFromMap(m map[string]float64) Color

ColorFromMap returns the color defined in the map

func (*Color) Add

func (c *Color) Add(c2 *Color) *Color

Add returns a color result of adding both colors elementwise

func (*Color) CMultiply

func (c *Color) CMultiply(c2 *Color) *Color

CMultiply returns a color result of multiplying both colors by channel

func (*Color) Divide

func (c *Color) Divide(v float64) *Color

Divide returns a color result of dividing this color by a float

func (*Color) Multiply

func (c *Color) Multiply(v float64) *Color

Multiply returns a color result of multiplying this color by a float

func (*Color) RGBA

func (c *Color) RGBA() (r, g, b, a uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the color. Each value ranges within [0, 0xffff], but is represented by a uint32 so that multiplying by a blend factor up to 0xffff will not overflow. Complies with the color interface.

func (*Color) String

func (c *Color) String() string

func (*Color) ToNRGBA

func (c *Color) ToNRGBA() stdcol.NRGBA

ToNRGBA returns the NRGBA representation for this color

type Image

type Image struct {
	stdimg.NRGBA
}

Image defines an RGB image

func New

func New(width int, height int) *Image

New returns a new Image with the pixel slice initialized

func (*Image) Save

func (img *Image) Save(filename string)

Save saves the image as a png file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL