Struct ColorMatrix
A structure encapsulating a 5x4 matrix used for transforming the color and alpha components of an image.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public struct ColorMatrix : IEquatable<ColorMatrix>
Constructors
| Improve this Doc View SourceColorMatrix(Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single)
Initializes a new instance of the ColorMatrix struct.
Declaration
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
Type | Name | Description |
---|---|---|
Single | m11 | The value at row 1, column 1 of the matrix. |
Single | m12 | The value at row 1, column 2 of the matrix. |
Single | m13 | The value at row 1, column 3 of the matrix. |
Single | m14 | The value at row 1, column 4 of the matrix. |
Single | m21 | The value at row 2, column 1 of the matrix. |
Single | m22 | The value at row 2, column 2 of the matrix. |
Single | m23 | The value at row 2, column 3 of the matrix. |
Single | m24 | The value at row 2, column 4 of the matrix. |
Single | m31 | The value at row 3, column 1 of the matrix. |
Single | m32 | The value at row 3, column 2 of the matrix. |
Single | m33 | The value at row 3, column 3 of the matrix. |
Single | m34 | The value at row 3, column 4 of the matrix. |
Single | m41 | The value at row 4, column 1 of the matrix. |
Single | m42 | The value at row 4, column 2 of the matrix. |
Single | m43 | The value at row 4, column 3 of the matrix. |
Single | m44 | The value at row 4, column 4 of the matrix. |
Single | m51 | The value at row 5, column 1 of the matrix. |
Single | m52 | The value at row 5, column 2 of the matrix. |
Single | m53 | The value at row 5, column 3 of the matrix. |
Single | m54 | The value at row 5, column 4 of the matrix. |
Fields
| Improve this Doc View SourceM11
Value at row 1, column 1 of the matrix.
Declaration
public float M11
Field Value
Type | Description |
---|---|
Single |
M12
Value at row 1, column 2 of the matrix.
Declaration
public float M12
Field Value
Type | Description |
---|---|
Single |
M13
Value at row 1, column 3 of the matrix.
Declaration
public float M13
Field Value
Type | Description |
---|---|
Single |
M14
Value at row 1, column 4 of the matrix.
Declaration
public float M14
Field Value
Type | Description |
---|---|
Single |
M21
Value at row 2, column 1 of the matrix.
Declaration
public float M21
Field Value
Type | Description |
---|---|
Single |
M22
Value at row 2, column 2 of the matrix.
Declaration
public float M22
Field Value
Type | Description |
---|---|
Single |
M23
Value at row 2, column 3 of the matrix.
Declaration
public float M23
Field Value
Type | Description |
---|---|
Single |
M24
Value at row 2, column 4 of the matrix.
Declaration
public float M24
Field Value
Type | Description |
---|---|
Single |
M31
Value at row 3, column 1 of the matrix.
Declaration
public float M31
Field Value
Type | Description |
---|---|
Single |
M32
Value at row 3, column 2 of the matrix.
Declaration
public float M32
Field Value
Type | Description |
---|---|
Single |
M33
Value at row 3, column 3 of the matrix.
Declaration
public float M33
Field Value
Type | Description |
---|---|
Single |
M34
Value at row 3, column 4 of the matrix.
Declaration
public float M34
Field Value
Type | Description |
---|---|
Single |
M41
Value at row 4, column 1 of the matrix.
Declaration
public float M41
Field Value
Type | Description |
---|---|
Single |
M42
Value at row 4, column 2 of the matrix.
Declaration
public float M42
Field Value
Type | Description |
---|---|
Single |
M43
Value at row 4, column 3 of the matrix.
Declaration
public float M43
Field Value
Type | Description |
---|---|
Single |
M44
Value at row 4, column 4 of the matrix.
Declaration
public float M44
Field Value
Type | Description |
---|---|
Single |
M51
Value at row 5, column 1 of the matrix.
Declaration
public float M51
Field Value
Type | Description |
---|---|
Single |
M52
Value at row 5, column 2 of the matrix.
Declaration
public float M52
Field Value
Type | Description |
---|---|
Single |
M53
Value at row 5, column 3 of the matrix.
Declaration
public float M53
Field Value
Type | Description |
---|---|
Single |
M54
Value at row 5, column 4 of the matrix.
Declaration
public float M54
Field Value
Type | Description |
---|---|
Single |
Properties
| Improve this Doc View SourceIdentity
Gets the multiplicative identity matrix.
Declaration
public static readonly ColorMatrix Identity { get; }
Property Value
Type | Description |
---|---|
ColorMatrix |
IsIdentity
Gets a value indicating whether the matrix is the identity matrix.
Declaration
public readonly bool IsIdentity { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceEquals(ColorMatrix)
Declaration
public bool Equals(ColorMatrix other)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
Operators
| Improve this Doc View SourceAddition(ColorMatrix, ColorMatrix)
Adds two matrices together.
Declaration
public static ColorMatrix operator +(ColorMatrix value1, ColorMatrix value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The first source matrix. |
ColorMatrix | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
ColorMatrix | The resulting matrix. |
Equality(ColorMatrix, ColorMatrix)
Returns a boolean indicating whether the given two matrices are equal.
Declaration
public static bool operator ==(ColorMatrix value1, ColorMatrix value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The first matrix to compare. |
ColorMatrix | value2 | The second matrix to compare. |
Returns
Type | Description |
---|---|
Boolean | True if the given matrices are equal; False otherwise. |
Inequality(ColorMatrix, ColorMatrix)
Returns a boolean indicating whether the given two matrices are not equal.
Declaration
public static bool operator !=(ColorMatrix value1, ColorMatrix value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The first matrix to compare. |
ColorMatrix | value2 | The second matrix to compare. |
Returns
Type | Description |
---|---|
Boolean | True if the given matrices are equal; False otherwise. |
Multiply(ColorMatrix, ColorMatrix)
Multiplies a matrix by another matrix.
Declaration
public static ColorMatrix operator *(ColorMatrix value1, ColorMatrix value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The first source matrix. |
ColorMatrix | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
ColorMatrix | The result of the multiplication. |
Multiply(ColorMatrix, Single)
Multiplies a matrix by a scalar value.
Declaration
public static ColorMatrix operator *(ColorMatrix value1, float value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The source matrix. |
Single | value2 | The scaling factor. |
Returns
Type | Description |
---|---|
ColorMatrix | The scaled matrix. |
Subtraction(ColorMatrix, ColorMatrix)
Subtracts the second matrix from the first.
Declaration
public static ColorMatrix operator -(ColorMatrix value1, ColorMatrix value2)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value1 | The first source matrix. |
ColorMatrix | value2 | The second source matrix. |
Returns
Type | Description |
---|---|
ColorMatrix | The result of the subtraction. |
UnaryNegation(ColorMatrix)
Returns a new matrix with the negated elements of the given matrix.
Declaration
public static ColorMatrix operator -(ColorMatrix value)
Parameters
Type | Name | Description |
---|---|---|
ColorMatrix | value | The source matrix. |
Returns
Type | Description |
---|---|
ColorMatrix | The negated matrix. |