Documentation
¶
Overview ¶
Package gradient provides linear and radial gradient images.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gradient ¶
type Gradient struct {
Shape Shape
Spread Spread
// Pix2Grad transforms coordinates from pixel space (the arguments to the
// Image.At method) to gradient space. Gradient space is where a linear
// gradient ranges from x == 0 to x == 1, and a radial gradient has center
// (0, 0) and radius 1.
//
// This is an affine transform, so it can represent elliptical gradients in
// pixel space, including non-axis-aligned ellipses.
//
// For a linear gradient, the bottom row is ignored.
Pix2Grad f64.Aff3
Ranges []Range
// First and Last are the first and last stop's colors.
First, Last color.RGBA64
}
Gradient is a very large image.Image (the same size as an image.Uniform) whose colors form a gradient.
func (*Gradient) ColorModel ¶
ColorModel satisfies the image.Image interface.
type Range ¶
type Range struct {
Offset0 float64
Offset1 float64
Width float64
R0 float64
R1 float64
G0 float64
G1 float64
B0 float64
B1 float64
A0 float64
A1 float64
}
Range is the range between two stops.
func AppendRanges ¶
AppendRanges appends to a the ranges defined by a's implicit final stop (if any exist) and stops.
type Spread ¶
type Spread uint8
Spread is the gradient spread, or how to spread a gradient past its nominal bounds (from offset being 0.0 to offset being 1.0).
const ( // SpreadNone means that offsets outside of the [0, 1] range map to // transparent black. SpreadNone Spread = iota // SpreadPad means that offsets below 0 and above 1 map to the colors that // 0 and 1 would map to. SpreadPad // SpreadReflect means that the offset mapping is reflected start-to-end, // end-to-start, start-to-end, etc. SpreadReflect // SpreadRepeat means that the offset mapping is repeated start-to-end, // start-to-end, start-to-end, etc. SpreadRepeat )
Click to show internal directories.
Click to hide internal directories.