affine

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 3 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 interface {
	String() string

	IsIdentity() bool
	ScaleOnly() bool
	At(i, j int) float32
	Elements(body []float32, translate []float32)
	Apply(clr color.Color) color.Color

	// IsInvertible returns a boolean value indicating
	// whether the matrix c is invertible or not.
	IsInvertible() bool

	// Invert inverts the matrix.
	// If c is not invertible, Invert panics.
	Invert() ColorM

	Equals(other ColorM) bool

	// Concat multiplies a color matrix with the other color matrix.
	// This is same as multiplying the matrix other and the matrix c in this order.
	Concat(other ColorM) ColorM

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

	// Translate translates the matrix by (r, g, b, a).
	Translate(r, g, b, a float32) ColorM
	// contains filtered or unexported methods
}

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

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.

func ChangeHSV added in v2.2.0

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

ChangeHSV changes HSV (Hue-Saturation-Value) elements. hueTheta is a radian value to rotate 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 ColorMSetElement added in v2.2.0

func ColorMSetElement(c ColorM, i, j int, element float32) ColorM

ColorMSetElement sets an element at (i, j).

type ColorMIdentity added in v2.2.0

type ColorMIdentity struct{}

func (ColorMIdentity) Apply added in v2.2.0

func (c ColorMIdentity) Apply(clr color.Color) color.Color

func (ColorMIdentity) At added in v2.2.0

func (c ColorMIdentity) At(i, j int) float32

func (ColorMIdentity) Concat added in v2.2.0

func (c ColorMIdentity) Concat(other ColorM) ColorM

func (ColorMIdentity) Elements added in v2.2.0

func (c ColorMIdentity) Elements(body []float32, translate []float32)

func (ColorMIdentity) Equals added in v2.2.0

func (c ColorMIdentity) Equals(other ColorM) bool

func (ColorMIdentity) Invert added in v2.2.0

func (c ColorMIdentity) Invert() ColorM

func (ColorMIdentity) IsIdentity added in v2.2.0

func (c ColorMIdentity) IsIdentity() bool

func (ColorMIdentity) IsInvertible added in v2.2.0

func (c ColorMIdentity) IsInvertible() bool

func (ColorMIdentity) Scale added in v2.2.0

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

func (ColorMIdentity) ScaleOnly added in v2.2.0

func (c ColorMIdentity) ScaleOnly() bool

func (ColorMIdentity) String added in v2.4.0

func (c ColorMIdentity) String() string

func (ColorMIdentity) Translate added in v2.2.0

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

Jump to

Keyboard shortcuts

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