affine

package
v1.12.12 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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 added in v1.6.0

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 added in v1.12.0

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 added in v1.12.0

func (c *ColorM) Invert() *ColorM

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

func (*ColorM) IsInvertible added in v1.12.0

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 added in v1.8.0

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)

Jump to

Keyboard shortcuts

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