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
| Edit this page View SourceColorMatrix(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.
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 |
|---|---|---|
| float | m11 | The value at row 1, column 1 of the matrix. |
| float | m12 | The value at row 1, column 2 of the matrix. |
| float | m13 | The value at row 1, column 3 of the matrix. |
| float | m14 | The value at row 1, column 4 of the matrix. |
| float | m21 | The value at row 2, column 1 of the matrix. |
| float | m22 | The value at row 2, column 2 of the matrix. |
| float | m23 | The value at row 2, column 3 of the matrix. |
| float | m24 | The value at row 2, column 4 of the matrix. |
| float | m31 | The value at row 3, column 1 of the matrix. |
| float | m32 | The value at row 3, column 2 of the matrix. |
| float | m33 | The value at row 3, column 3 of the matrix. |
| float | m34 | The value at row 3, column 4 of the matrix. |
| float | m41 | The value at row 4, column 1 of the matrix. |
| float | m42 | The value at row 4, column 2 of the matrix. |
| float | m43 | The value at row 4, column 3 of the matrix. |
| float | m44 | The value at row 4, column 4 of the matrix. |
| float | m51 | The value at row 5, column 1 of the matrix. |
| float | m52 | The value at row 5, column 2 of the matrix. |
| float | m53 | The value at row 5, column 3 of the matrix. |
| float | m54 | The value at row 5, column 4 of the matrix. |
Fields
| Edit this page View SourceM11
Value at row 1, column 1 of the matrix.
Declaration
public float M11
Field Value
| Type | Description |
|---|---|
| float |
M12
Value at row 1, column 2 of the matrix.
Declaration
public float M12
Field Value
| Type | Description |
|---|---|
| float |
M13
Value at row 1, column 3 of the matrix.
Declaration
public float M13
Field Value
| Type | Description |
|---|---|
| float |
M14
Value at row 1, column 4 of the matrix.
Declaration
public float M14
Field Value
| Type | Description |
|---|---|
| float |
M21
Value at row 2, column 1 of the matrix.
Declaration
public float M21
Field Value
| Type | Description |
|---|---|
| float |
M22
Value at row 2, column 2 of the matrix.
Declaration
public float M22
Field Value
| Type | Description |
|---|---|
| float |
M23
Value at row 2, column 3 of the matrix.
Declaration
public float M23
Field Value
| Type | Description |
|---|---|
| float |
M24
Value at row 2, column 4 of the matrix.
Declaration
public float M24
Field Value
| Type | Description |
|---|---|
| float |
M31
Value at row 3, column 1 of the matrix.
Declaration
public float M31
Field Value
| Type | Description |
|---|---|
| float |
M32
Value at row 3, column 2 of the matrix.
Declaration
public float M32
Field Value
| Type | Description |
|---|---|
| float |
M33
Value at row 3, column 3 of the matrix.
Declaration
public float M33
Field Value
| Type | Description |
|---|---|
| float |
M34
Value at row 3, column 4 of the matrix.
Declaration
public float M34
Field Value
| Type | Description |
|---|---|
| float |
M41
Value at row 4, column 1 of the matrix.
Declaration
public float M41
Field Value
| Type | Description |
|---|---|
| float |
M42
Value at row 4, column 2 of the matrix.
Declaration
public float M42
Field Value
| Type | Description |
|---|---|
| float |
M43
Value at row 4, column 3 of the matrix.
Declaration
public float M43
Field Value
| Type | Description |
|---|---|
| float |
M44
Value at row 4, column 4 of the matrix.
Declaration
public float M44
Field Value
| Type | Description |
|---|---|
| float |
M51
Value at row 5, column 1 of the matrix.
Declaration
public float M51
Field Value
| Type | Description |
|---|---|
| float |
M52
Value at row 5, column 2 of the matrix.
Declaration
public float M52
Field Value
| Type | Description |
|---|---|
| float |
M53
Value at row 5, column 3 of the matrix.
Declaration
public float M53
Field Value
| Type | Description |
|---|---|
| float |
M54
Value at row 5, column 4 of the matrix.
Declaration
public float M54
Field Value
| Type | Description |
|---|---|
| float |
Properties
| Edit this page View SourceIdentity
Gets the multiplicative identity matrix.
Declaration
public static ColorMatrix Identity { get; }
Property Value
| Type | Description |
|---|---|
| ColorMatrix |
IsIdentity
Gets a value indicating whether the matrix is the identity matrix.
Declaration
public bool IsIdentity { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceEquals(ColorMatrix)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(ColorMatrix other)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorMatrix | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
| Edit this page View SourceGetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
Operators
| Edit this page View Sourceoperator +(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. |
operator ==(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 |
|---|---|
| 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.
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 |
|---|---|
| bool | True if the given matrices are equal; False otherwise. |
operator *(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. |
operator *(ColorMatrix, float)
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. |
| float | value2 | The scaling factor. |
Returns
| Type | Description |
|---|---|
| ColorMatrix | The scaled matrix. |
operator -(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. |
operator -(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. |