VectSharp
2.2.1
A light library for C# vector graphics
|
Represents a colour transformation matrix. More...
Public Member Functions | |
ColourMatrix | WithAlpha (double alpha) |
Creates a new ColourMatrix whose alpha coefficients are multiplied by the specified value. More... | |
ColourMatrix (double[,] matrix) | |
Creates a new ColourMatrix with the specified coefficients. More... | |
Colour | Apply (Colour colour) |
Applies the ColourMatrix to the specified Colour. More... | |
void | Apply (ref byte R, ref byte G, ref byte B, ref byte A) |
Applies the ColourMatrix to the specified colour, represented as four bytes, and stores the resulting colour in the same variables as the original RGBA values. More... | |
void | Apply (ref byte R, ref byte G, ref byte B) |
Applies the ColourMatrix to the specified colour, represented as three bytes, and stores the resulting colour in the same variables as the original RGB values. More... | |
void | Apply (byte R, byte G, byte B, byte A, out byte r, out byte g, out byte b, out byte a) |
Applies the ColourMatrix to the specified colour, represented as four bytes, and stores the resulting colour in the specified output bytes. More... | |
void | Apply (byte R, byte G, byte B, out byte r, out byte g, out byte b) |
Applies the ColourMatrix to the specified colour, represented as three bytes, and stores the resulting colour in the specified output bytes. More... | |
Static Public Member Functions | |
static ColourMatrix | ToColour (Colour colour, bool useAlpha=false) |
Creates a ColourMatrix that turns every colour to which it is applied into the specified colour . More... | |
static ColourMatrix | LuminanceToColour (Colour colour, bool useAlpha=false) |
Creates a ColourMatrix that turns every colour to which it is applied into a shade of the specified colour . The brightness of the output colour depends on the luminance of the input colour. More... | |
static ColourMatrix | LuminanceToAlpha (bool preserveColour=false) |
Creates a ColourMatrix that transforms the alpha value of the colour it is applied to into a value depending on the luminance of the input colour. More... | |
static ColourMatrix | operator* (ColourMatrix matrix1, ColourMatrix matrix2) |
Concatenates two matrices. The resulting ColourMatrix is equivalent to first applying matrix2 , and then matrix1 . More... | |
Static Public Attributes | |
static ColourMatrix | Identity = new ColourMatrix(new double[,] { { 1, 0, 0, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 0, 1, 0, 0 }, { 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix that whose output colour is always the same as the input colour. More... | |
static ColourMatrix | GreyScale = new ColourMatrix(new double[,] { { 0.2126, 0.7152, 0.0722, 0, 0 }, { 0.2126, 0.7152, 0.0722, 0, 0 }, { 0.2126, 0.7152, 0.0722, 0, 0 }, { 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix that transforms every colour in a shade of grey with approximately the same luminance. More... | |
static ColourMatrix | Pastel = new ColourMatrix(new double[,] { { 0.75, 0.25, 0.25, 0, 0 }, { 0.25, 0.75, 0.25, 0, 0 }, { 0.25, 0.25, 0.75, 0, 0 }, { 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix producing a "pastel" (desaturation) effect. More... | |
static ColourMatrix | Inversion = new ColourMatrix(new double[,] { { -1, 0, 0, 0, 1 }, { 0, -1, 0, 0, 1 }, { 0, 0, -1, 0, 1 }, { 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix that inverts every colour, leaving the alpha component intact. More... | |
static ColourMatrix | AlphaInversion = new ColourMatrix(new double[,] { { 1, 0, 0, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 0, 1, 0, 0 }, { 0, 0, 0, -1, 1 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix that inverts the alpha component, leaving the other components intact. More... | |
static ColourMatrix | InvertedAlphaShift = new ColourMatrix(new double[,] { { 1, 0, 0, -1, 1 }, { 0, 1, 0, -1, 1 }, { 0, 0, 1, -1, 1 }, { 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 1 } }) |
A ColourMatrix that shifts every colour component by an amount corresponding to the inverted alpha value. The alpha component is left intact. More... | |
Properties | |
double | R1 [get, set] |
The coefficient relating the R component of the output colour to the R component of the input colour. More... | |
double | R2 [get, set] |
The coefficient relating the R component of the output colour to the G component of the input colour. More... | |
double | R3 [get, set] |
The coefficient relating the R component of the output colour to the B component of the input colour. More... | |
double | R4 [get, set] |
The coefficient relating the R component of the output colour to the A component of the input colour. More... | |
double | R5 [get, set] |
The bias (translation) applied to the R component of the output colour. More... | |
double | G1 [get, set] |
The coefficient relating the G component of the output colour to the R component of the input colour. More... | |
double | G2 [get, set] |
The coefficient relating the G component of the output colour to the G component of the input colour. More... | |
double | G3 [get, set] |
The coefficient relating the G component of the output colour to the B component of the input colour. More... | |
double | G4 [get, set] |
The coefficient relating the G component of the output colour to the A component of the input colour. More... | |
double | G5 [get, set] |
The bias (translation) applied to the R component of the output colour. More... | |
double | B1 [get, set] |
The coefficient relating the B component of the output colour to the R component of the input colour. More... | |
double | B2 [get, set] |
The coefficient relating the B component of the output colour to the G component of the input colour. More... | |
double | B3 [get, set] |
The coefficient relating the B component of the output colour to the B component of the input colour. More... | |
double | B4 [get, set] |
The coefficient relating the B component of the output colour to the A component of the input colour. More... | |
double | B5 [get, set] |
The bias (translation) applied to the B component of the output colour. More... | |
double | A1 [get, set] |
The coefficient relating the A component of the output colour to the R component of the input colour. More... | |
double | A2 [get, set] |
The coefficient relating the A component of the output colour to the G component of the input colour. More... | |
double | A3 [get, set] |
The coefficient relating the A component of the output colour to the B component of the input colour. More... | |
double | A4 [get, set] |
The coefficient relating the A component of the output colour to the A component of the input colour. More... | |
double | A5 [get, set] |
The bias (translation) applied to the A component of the output colour. More... | |
double | this[int y, int x] [get] |
Gets or sets the requested element of the matrix. Elements of the last row of the matrix can be read, but not set. More... | |
Represents a colour transformation matrix.
Definition at line 26 of file ColourMatrixFilter.cs.
VectSharp.Filters.ColourMatrix.ColourMatrix | ( | double | matrix[,] | ) |
Creates a new ColourMatrix with the specified coefficients.
matrix | The coefficients of the ColourMatrix. |
Definition at line 454 of file ColourMatrixFilter.cs.
void VectSharp.Filters.ColourMatrix.Apply | ( | byte | R, |
byte | G, | ||
byte | B, | ||
byte | A, | ||
out byte | r, | ||
out byte | g, | ||
out byte | b, | ||
out byte | a | ||
) |
Applies the ColourMatrix to the specified colour, represented as four bytes, and stores the resulting colour in the specified output bytes.
R | The R component of the input colour. |
G | The G component of the input colour. |
B | The B component of the input colour. |
A | The A component of the input colour. |
r | After this method returns, this will contain the R component of the output colour. |
g | After this method returns, this will contain the G component of the output colour. |
b | After this method returns, this will contain the B component of the output colour. |
a | After this method returns, this will contain the A component of the output colour. |
Definition at line 538 of file ColourMatrixFilter.cs.
void VectSharp.Filters.ColourMatrix.Apply | ( | byte | R, |
byte | G, | ||
byte | B, | ||
out byte | r, | ||
out byte | g, | ||
out byte | b | ||
) |
Applies the ColourMatrix to the specified colour, represented as three bytes, and stores the resulting colour in the specified output bytes.
R | The R component of the input colour. |
G | The G component of the input colour. |
B | The B component of the input colour. |
r | After this method returns, this will contain the R component of the output colour. |
g | After this method returns, this will contain the G component of the output colour. |
b | After this method returns, this will contain the B component of the output colour. |
Definition at line 556 of file ColourMatrixFilter.cs.
Applies the ColourMatrix to the specified Colour.
colour | The Colour to which the ColourMatrix should be applied. |
Definition at line 470 of file ColourMatrixFilter.cs.
void VectSharp.Filters.ColourMatrix.Apply | ( | ref byte | R, |
ref byte | G, | ||
ref byte | B | ||
) |
Applies the ColourMatrix to the specified colour, represented as three bytes, and stores the resulting colour in the same variables as the original RGB values.
R | The R component of the input colour. After this method returns, this will contain the R component of the output colour. |
G | The G component of the input colour. After this method returns, this will contain the G component of the output colour. |
B | The B component of the input colour. After this method returns, this will contain the B component of the output colour. |
Definition at line 515 of file ColourMatrixFilter.cs.
void VectSharp.Filters.ColourMatrix.Apply | ( | ref byte | R, |
ref byte | G, | ||
ref byte | B, | ||
ref byte | A | ||
) |
Applies the ColourMatrix to the specified colour, represented as four bytes, and stores the resulting colour in the same variables as the original RGBA values.
R | The R component of the input colour. After this method returns, this will contain the R component of the output colour. |
G | The G component of the input colour. After this method returns, this will contain the G component of the output colour. |
B | The B component of the input colour. After this method returns, this will contain the B component of the output colour. |
A | The A component of the input colour. After this method returns, this will contain the A component of the output colour. |
Definition at line 495 of file ColourMatrixFilter.cs.
|
static |
Creates a ColourMatrix that transforms the alpha value of the colour it is applied to into a value depending on the luminance of the input colour.
preserveColour | If this is true , the values of the red, green and blue components of the input colour are preserved in the output colour. If this is false, the output colour will always be black. |
Definition at line 404 of file ColourMatrixFilter.cs.
|
static |
Creates a ColourMatrix that turns every colour to which it is applied into a shade of the specified colour . The brightness of the output colour depends on the luminance of the input colour.
colour | The colour whose shades will be produced by the ColourMatrix. |
useAlpha | If this is true , the transformation will also be applied to the alpha channel. If this is false, the alpha value of the input pixels is preserved. |
Definition at line 387 of file ColourMatrixFilter.cs.
|
static |
Concatenates two matrices. The resulting ColourMatrix is equivalent to first applying matrix2 , and then matrix1 .
matrix1 | The matrix that acts second. |
matrix2 | The matrix that acts first. |
Definition at line 432 of file ColourMatrixFilter.cs.
|
static |
Creates a ColourMatrix that turns every colour to which it is applied into the specified colour .
colour | The colour that will be produced by the ColourMatrix. |
useAlpha | If this is true , all output pixels will have the same alpha value as the supplied colour . If this is false, the alpha value of the input pixels is preserved. |
Definition at line 369 of file ColourMatrixFilter.cs.
ColourMatrix VectSharp.Filters.ColourMatrix.WithAlpha | ( | double | alpha | ) |
Creates a new ColourMatrix whose alpha coefficients are multiplied by the specified value.
alpha | The value that will be used to multiply all the alpha coefficients of the ColourMatrix. |
Definition at line 421 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix that inverts the alpha component, leaving the other components intact.
Definition at line 356 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix that transforms every colour in a shade of grey with approximately the same luminance.
Definition at line 341 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix that whose output colour is always the same as the input colour.
Definition at line 336 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix that inverts every colour, leaving the alpha component intact.
Definition at line 351 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix that shifts every colour component by an amount corresponding to the inverted alpha value. The alpha component is left intact.
Definition at line 361 of file ColourMatrixFilter.cs.
|
static |
A ColourMatrix producing a "pastel" (desaturation) effect.
Definition at line 346 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the A component of the output colour to the R component of the input colour.
Definition at line 106 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the A component of the output colour to the G component of the input colour.
Definition at line 111 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the A component of the output colour to the B component of the input colour.
Definition at line 116 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the A component of the output colour to the A component of the input colour.
Definition at line 121 of file ColourMatrixFilter.cs.
|
getset |
The bias (translation) applied to the A component of the output colour.
Definition at line 126 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the B component of the output colour to the R component of the input colour.
Definition at line 81 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the B component of the output colour to the G component of the input colour.
Definition at line 86 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the B component of the output colour to the B component of the input colour.
Definition at line 91 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the B component of the output colour to the A component of the input colour.
Definition at line 96 of file ColourMatrixFilter.cs.
|
getset |
The bias (translation) applied to the B component of the output colour.
Definition at line 101 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the G component of the output colour to the R component of the input colour.
Definition at line 56 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the G component of the output colour to the G component of the input colour.
Definition at line 61 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the G component of the output colour to the B component of the input colour.
Definition at line 66 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the G component of the output colour to the A component of the input colour.
Definition at line 71 of file ColourMatrixFilter.cs.
|
getset |
The bias (translation) applied to the R component of the output colour.
Definition at line 76 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the R component of the output colour to the R component of the input colour.
Definition at line 31 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the R component of the output colour to the G component of the input colour.
Definition at line 36 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the R component of the output colour to the B component of the input colour.
Definition at line 41 of file ColourMatrixFilter.cs.
|
getset |
The coefficient relating the R component of the output colour to the A component of the input colour.
Definition at line 46 of file ColourMatrixFilter.cs.
|
getset |
The bias (translation) applied to the R component of the output colour.
Definition at line 51 of file ColourMatrixFilter.cs.
|
get |
Gets or sets the requested element of the matrix. Elements of the last row of the matrix can be read, but not set.
y | The row of the matrix. |
x | The column of the matrix. |
ArgumentOutOfRangeException | An attempt has been made to access an element out of the bounds of the matrix. |
Definition at line 135 of file ColourMatrixFilter.cs.