Table of Contents

Struct ColorMatrix

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

A structure encapsulating a 5x4 matrix used for transforming the color and alpha components of an image.

public struct ColorMatrix : IEquatable<ColorMatrix>
Implements
Inherited Members

Constructors

ColorMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)

Initializes a new instance of the ColorMatrix struct.

public ColorMatrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, float m51, float m52, float m53, float m54)

Parameters

m11 float

The value at row 1, column 1 of the matrix.

m12 float

The value at row 1, column 2 of the matrix.

m13 float

The value at row 1, column 3 of the matrix.

m14 float

The value at row 1, column 4 of the matrix.

m21 float

The value at row 2, column 1 of the matrix.

m22 float

The value at row 2, column 2 of the matrix.

m23 float

The value at row 2, column 3 of the matrix.

m24 float

The value at row 2, column 4 of the matrix.

m31 float

The value at row 3, column 1 of the matrix.

m32 float

The value at row 3, column 2 of the matrix.

m33 float

The value at row 3, column 3 of the matrix.

m34 float

The value at row 3, column 4 of the matrix.

m41 float

The value at row 4, column 1 of the matrix.

m42 float

The value at row 4, column 2 of the matrix.

m43 float

The value at row 4, column 3 of the matrix.

m44 float

The value at row 4, column 4 of the matrix.

m51 float

The value at row 5, column 1 of the matrix.

m52 float

The value at row 5, column 2 of the matrix.

m53 float

The value at row 5, column 3 of the matrix.

m54 float

The value at row 5, column 4 of the matrix.

Fields

M11

Value at row 1, column 1 of the matrix.

public float M11

Field Value

float

M12

Value at row 1, column 2 of the matrix.

public float M12

Field Value

float

M13

Value at row 1, column 3 of the matrix.

public float M13

Field Value

float

M14

Value at row 1, column 4 of the matrix.

public float M14

Field Value

float

M21

Value at row 2, column 1 of the matrix.

public float M21

Field Value

float

M22

Value at row 2, column 2 of the matrix.

public float M22

Field Value

float

M23

Value at row 2, column 3 of the matrix.

public float M23

Field Value

float

M24

Value at row 2, column 4 of the matrix.

public float M24

Field Value

float

M31

Value at row 3, column 1 of the matrix.

public float M31

Field Value

float

M32

Value at row 3, column 2 of the matrix.

public float M32

Field Value

float

M33

Value at row 3, column 3 of the matrix.

public float M33

Field Value

float

M34

Value at row 3, column 4 of the matrix.

public float M34

Field Value

float

M41

Value at row 4, column 1 of the matrix.

public float M41

Field Value

float

M42

Value at row 4, column 2 of the matrix.

public float M42

Field Value

float

M43

Value at row 4, column 3 of the matrix.

public float M43

Field Value

float

M44

Value at row 4, column 4 of the matrix.

public float M44

Field Value

float

M51

Value at row 5, column 1 of the matrix.

public float M51

Field Value

float

M52

Value at row 5, column 2 of the matrix.

public float M52

Field Value

float

M53

Value at row 5, column 3 of the matrix.

public float M53

Field Value

float

M54

Value at row 5, column 4 of the matrix.

public float M54

Field Value

float

Properties

Identity

Gets the multiplicative identity matrix.

public static ColorMatrix Identity { get; }

Property Value

ColorMatrix

IsIdentity

Gets a value indicating whether the matrix is the identity matrix.

public bool IsIdentity { get; }

Property Value

bool

Methods

Equals(ColorMatrix)

public readonly bool Equals(ColorMatrix other)

Parameters

other ColorMatrix

Returns

bool

Equals(object?)

public override readonly bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator +(ColorMatrix, ColorMatrix)

Adds two matrices together.

public static ColorMatrix operator +(ColorMatrix value1, ColorMatrix value2)

Parameters

value1 ColorMatrix

The first source matrix.

value2 ColorMatrix

The second source matrix.

Returns

ColorMatrix

The resulting matrix.

operator ==(ColorMatrix, ColorMatrix)

Returns a boolean indicating whether the given two matrices are equal.

public static bool operator ==(ColorMatrix value1, ColorMatrix value2)

Parameters

value1 ColorMatrix

The first matrix to compare.

value2 ColorMatrix

The second matrix to compare.

Returns

bool

True if the given matrices are equal; False otherwise.

operator !=(ColorMatrix, ColorMatrix)

Returns a boolean indicating whether the given two matrices are not equal.

public static bool operator !=(ColorMatrix value1, ColorMatrix value2)

Parameters

value1 ColorMatrix

The first matrix to compare.

value2 ColorMatrix

The second matrix to compare.

Returns

bool

True if the given matrices are equal; False otherwise.

operator *(ColorMatrix, ColorMatrix)

Multiplies a matrix by another matrix.

public static ColorMatrix operator *(ColorMatrix value1, ColorMatrix value2)

Parameters

value1 ColorMatrix

The first source matrix.

value2 ColorMatrix

The second source matrix.

Returns

ColorMatrix

The result of the multiplication.

operator *(ColorMatrix, float)

Multiplies a matrix by a scalar value.

public static ColorMatrix operator *(ColorMatrix value1, float value2)

Parameters

value1 ColorMatrix

The source matrix.

value2 float

The scaling factor.

Returns

ColorMatrix

The scaled matrix.

operator -(ColorMatrix, ColorMatrix)

Subtracts the second matrix from the first.

public static ColorMatrix operator -(ColorMatrix value1, ColorMatrix value2)

Parameters

value1 ColorMatrix

The first source matrix.

value2 ColorMatrix

The second source matrix.

Returns

ColorMatrix

The result of the subtraction.

operator -(ColorMatrix)

Returns a new matrix with the negated elements of the given matrix.

public static ColorMatrix operator -(ColorMatrix value)

Parameters

value ColorMatrix

The source matrix.

Returns

ColorMatrix

The negated matrix.