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
floatThe value at row 1, column 1 of the matrix.
m12
floatThe value at row 1, column 2 of the matrix.
m13
floatThe value at row 1, column 3 of the matrix.
m14
floatThe value at row 1, column 4 of the matrix.
m21
floatThe value at row 2, column 1 of the matrix.
m22
floatThe value at row 2, column 2 of the matrix.
m23
floatThe value at row 2, column 3 of the matrix.
m24
floatThe value at row 2, column 4 of the matrix.
m31
floatThe value at row 3, column 1 of the matrix.
m32
floatThe value at row 3, column 2 of the matrix.
m33
floatThe value at row 3, column 3 of the matrix.
m34
floatThe value at row 3, column 4 of the matrix.
m41
floatThe value at row 4, column 1 of the matrix.
m42
floatThe value at row 4, column 2 of the matrix.
m43
floatThe value at row 4, column 3 of the matrix.
m44
floatThe value at row 4, column 4 of the matrix.
m51
floatThe value at row 5, column 1 of the matrix.
m52
floatThe value at row 5, column 2 of the matrix.
m53
floatThe value at row 5, column 3 of the matrix.
m54
floatThe 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
M12
Value at row 1, column 2 of the matrix.
public float M12
Field Value
M13
Value at row 1, column 3 of the matrix.
public float M13
Field Value
M14
Value at row 1, column 4 of the matrix.
public float M14
Field Value
M21
Value at row 2, column 1 of the matrix.
public float M21
Field Value
M22
Value at row 2, column 2 of the matrix.
public float M22
Field Value
M23
Value at row 2, column 3 of the matrix.
public float M23
Field Value
M24
Value at row 2, column 4 of the matrix.
public float M24
Field Value
M31
Value at row 3, column 1 of the matrix.
public float M31
Field Value
M32
Value at row 3, column 2 of the matrix.
public float M32
Field Value
M33
Value at row 3, column 3 of the matrix.
public float M33
Field Value
M34
Value at row 3, column 4 of the matrix.
public float M34
Field Value
M41
Value at row 4, column 1 of the matrix.
public float M41
Field Value
M42
Value at row 4, column 2 of the matrix.
public float M42
Field Value
M43
Value at row 4, column 3 of the matrix.
public float M43
Field Value
M44
Value at row 4, column 4 of the matrix.
public float M44
Field Value
M51
Value at row 5, column 1 of the matrix.
public float M51
Field Value
M52
Value at row 5, column 2 of the matrix.
public float M52
Field Value
M53
Value at row 5, column 3 of the matrix.
public float M53
Field Value
M54
Value at row 5, column 4 of the matrix.
public float M54
Field Value
Properties
Identity
Gets the multiplicative identity matrix.
public static ColorMatrix Identity { get; }
Property Value
IsIdentity
Gets a value indicating whether the matrix is the identity matrix.
public bool IsIdentity { get; }
Property Value
Methods
Equals(ColorMatrix)
public readonly bool Equals(ColorMatrix other)
Parameters
other
ColorMatrix
Returns
Equals(object?)
public override readonly bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator +(ColorMatrix, ColorMatrix)
Adds two matrices together.
public static ColorMatrix operator +(ColorMatrix value1, ColorMatrix value2)
Parameters
value1
ColorMatrixThe first source matrix.
value2
ColorMatrixThe 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
ColorMatrixThe first matrix to compare.
value2
ColorMatrixThe 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
ColorMatrixThe first matrix to compare.
value2
ColorMatrixThe 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
ColorMatrixThe first source matrix.
value2
ColorMatrixThe 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
ColorMatrixThe source matrix.
value2
floatThe 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
ColorMatrixThe first source matrix.
value2
ColorMatrixThe 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
ColorMatrixThe source matrix.
Returns
- ColorMatrix
The negated matrix.