Documentation

Index

Constants

const ColorMDim = 5

ColorMDim is a dimension of a ColorM.


Variables

This section is empty.

Functions

This section is empty.

Types

type ColorM

type ColorM struct {
	// contains filtered or unexported fields
}

A ColorM represents a matrix to transform coloring when rendering an image.

A ColorM is applied to the source alpha color while an Image's pixels' format is alpha premultiplied. Before applying a matrix, a color is un-multiplied, and after applying the matrix, the color is multiplied again.

The nil and initial value is identity.

func (*ColorM) Add

func (c *ColorM) Add(other *ColorM) *ColorM

Add is deprecated.

func (*ColorM) Apply

func (c *ColorM) Apply(clr color.Color) color.Color

func (*ColorM) ChangeHSV

func (c *ColorM) ChangeHSV(hueTheta float64, saturationScale float32, valueScale float32) *ColorM

ChangeHSV changes HSV (Hue-Saturation-Value) elements. hueTheta is a radian value to ratate hue. saturationScale is a value to scale saturation. valueScale is a value to scale value (a.k.a. brightness).

This conversion uses RGB to/from YCrCb conversion.

func (*ColorM) Concat

func (c *ColorM) Concat(other *ColorM) *ColorM

Concat multiplies a color matrix with the other color matrix. This is same as muptiplying the matrix other and the matrix c in this order.

func (*ColorM) Element

func (c *ColorM) Element(i, j int) float32

Element returns a value of a matrix at (i, j).

func (*ColorM) Equals

func (c *ColorM) Equals(other *ColorM) bool

func (*ColorM) Invert

func (c *ColorM) Invert() *ColorM

Invert inverts the matrix. If c is not invertible, Invert panics.

func (*ColorM) IsInvertible

func (c *ColorM) IsInvertible() bool

IsInvertible returns a boolean value indicating whether the matrix c is invertible or not.

func (*ColorM) Scale

func (c *ColorM) Scale(r, g, b, a float32) *ColorM

Scale scales the matrix by (r, g, b, a).

func (*ColorM) ScaleOnly

func (c *ColorM) ScaleOnly() bool

func (*ColorM) SetElement

func (c *ColorM) SetElement(i, j int, element float32) *ColorM

SetElement sets an element at (i, j).

func (*ColorM) Translate

func (c *ColorM) Translate(r, g, b, a float32) *ColorM

Translate translates the matrix by (r, g, b, a).

func (*ColorM) UnsafeElements

func (c *ColorM) UnsafeElements() ([]float32, []float32)