affine

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 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 muptiplying 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

func ChangeHSV(c ColorM, 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 ColorMSetElement

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

ColorMSetElement sets an element at (i, j).

type ColorMIdentity

type ColorMIdentity struct{}

func (ColorMIdentity) Apply

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

func (ColorMIdentity) At

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

func (ColorMIdentity) Concat

func (c ColorMIdentity) Concat(other ColorM) ColorM

func (ColorMIdentity) Elements

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

func (ColorMIdentity) Equals

func (c ColorMIdentity) Equals(other ColorM) bool

func (ColorMIdentity) Invert

func (c ColorMIdentity) Invert() ColorM

func (ColorMIdentity) IsIdentity

func (c ColorMIdentity) IsIdentity() bool

func (ColorMIdentity) IsInvertible

func (c ColorMIdentity) IsInvertible() bool

func (ColorMIdentity) Scale

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

func (ColorMIdentity) ScaleOnly

func (c ColorMIdentity) ScaleOnly() bool

func (ColorMIdentity) String

func (c ColorMIdentity) String() string

func (ColorMIdentity) Translate

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