C# Class ARCed.Core.QColorMatrix

Extension of the GDI+ struct ColorMatrix.
Show file Open project: borisblizzard/arcreator Class Usage Examples

Public Methods

Method Description
Color2Vector ( Color color ) : float[]

Converts a Color object to a vector and returns it.

FromColorMatrix ( System.Drawing.Imaging.ColorMatrix colorMatrix ) : void

Translates the matrix from a ColorMatrix.

FromJaggedMatrix ( float matrixData ) : void

Returns the given matrix data as a jagged matrix

Multiply ( QColorMatrix matrix ) : void

Multiplies the given matrix

Multiply ( QColorMatrix matrix, MatrixOrder order ) : void

Multiply the given matrix using the specified matrix order.

QColorMatrix ( ) : System

Default constructor

QColorMatrix ( System.Drawing.Imaging.ColorMatrix colorMatrix ) : System

Constructor specifying matrix data

QColorMatrix ( QColorMatrix matrixData ) : System

Constructor specifying matrix data

QColorMatrix ( float matrixData ) : System

Constructor specifying matrix data

Reset ( ) : void

Set to identity matrix

RotateBlue ( float phi ) : void

Rotate the matrix around the blue color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

RotateBlue ( float phi, MatrixOrder order ) : void

Rotate the matrix around the blue color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

RotateGreen ( float phi ) : void

Rotate the matrix around the green color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

RotateGreen ( float phi, MatrixOrder order ) : void

Rotate the matrix around the green color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

RotateHue ( float phi ) : void

Rotate the hue around the gray axis, keeping luminance fixed. Grays are fixed, all other colors change.

RotateRed ( float phi ) : void

Rotate the matrix around the red color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

RotateRed ( float phi, MatrixOrder order ) : void

Rotate the matrix around the red color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.

Scale ( float scaleRed, float scaleGreen, float scaleBlue, float scaleOpacity ) : void

Update this matrix with the product of itself and a scaling vector.

Scale ( float scaleRed, float scaleGreen, float scaleBlue, float scaleOpacity, MatrixOrder order ) : void

Update this matrix with the product of itself and a scaling vector.

ScaleColors ( float scale ) : void

Scale just the three colors with the same amount, leave opacity unchanged

ScaleColors ( float scale, MatrixOrder order ) : void

Scale just the three colors with the same amount, leave opacity unchanged

ScaleOpacity ( float scaleOpacity ) : void

Scales the matrix opacity

ScaleOpacity ( float scaleOpacity, MatrixOrder order ) : void

Scales the matrix opacity

SetBrightness ( float offset ) : void

Sets the matrix brightness

SetContrast ( float scale ) : void

Sets the matrix contrast

SetSaturation ( float saturation ) : void

Sets the matrix saturation

SetSaturation ( float saturation, MatrixOrder order ) : void

Set the saturation of the matrix. Saturation of 0.0f yields black and white, 1.0f is neutral.

SetSaturation2 ( float saturation ) : void

Sets the matrix saturation using MatrixOrder.MatrixOrderAppend order.

ShearBlue ( float red, float green ) : void

Shear the matrix in the blue color plane. The color is influenced by the other two planes.

ShearBlue ( float red, float green, MatrixOrder order ) : void

Shear the matrix in the blue color plane. The color is influenced by the other two planes.

ShearGreen ( float red, float blue ) : void

Shear the matrix in the green color plane. The color is influenced by the other two planes.

ShearGreen ( float red, float blue, MatrixOrder order ) : void

Shear the matrix in the green color plane. The color is influenced by the other two planes.

ShearRed ( float green, float blue ) : void

Shear the matrix in the red color plane. The color is influenced by the other two planes.

ShearRed ( float green, float blue, MatrixOrder order ) : void

Shear the matrix in the red color plane. The color is influenced by the other two planes.

ToColorMatrix ( ) : System.Drawing.Imaging.ColorMatrix

Converts the matrix to a ColorMatrix and returns it.

ToJaggedMatrix ( ) : float[][]

Converts the matrix to a jagged array of data

TransformColors ( Color colors ) : Color[]

Multiply each color by the matrix.

TransformVector ( float v ) : float[]

Multiply the vector v by the matrix in place. v points to an array of at least four values, representing R, G, B and A.

TransformVector ( float vector, bool normalize ) : float[]

Transforms a vector

Translate ( float offsetRed, float offsetGreen, float offsetBlue, float offsetOpacity ) : void

Update this matrix with the product of itself and a translation vector.

Translate ( float offsetRed, float offsetGreen, float offsetBlue, float offsetOpacity, MatrixOrder order ) : void

Update this matrix with the product of itself and a translation vector.

TranslateColors ( float offset ) : void

Translate matrix colors

TranslateColors ( float offset, MatrixOrder order ) : void

Translate matrix colors

TranslateOpacity ( float offsetOpacity ) : void

Translate matrix opacity

TranslateOpacity ( float offsetOpacity, MatrixOrder order ) : void

Translate matrix opacity

Vector2Color ( float vector ) : Color

Converts a vector array to a Color object.

Private Methods

Method Description
Copy ( QColorMatrix qm ) : void
Copy ( float m ) : void
InitHue ( ) : void
RotateColor ( float phi, int x, int y, MatrixOrder order ) : void

X and Y are the indices of the value to receive the sin(phi) value

ShearColor ( int x, int y1, float d1, int y2, float d2, MatrixOrder order ) : void

Method Details

Color2Vector() public static method

Converts a Color object to a vector and returns it.
public static Color2Vector ( Color color ) : float[]
color Color Color to convert
return float[]

FromColorMatrix() public method

Translates the matrix from a ColorMatrix.
public FromColorMatrix ( System.Drawing.Imaging.ColorMatrix colorMatrix ) : void
colorMatrix System.Drawing.Imaging.ColorMatrix ColorMatrix to translate from
return void

FromJaggedMatrix() public method

Returns the given matrix data as a jagged matrix
public FromJaggedMatrix ( float matrixData ) : void
matrixData float Matrix data
return void

Multiply() public method

Multiplies the given matrix
public Multiply ( QColorMatrix matrix ) : void
matrix QColorMatrix Matrix to multiply
return void

Multiply() public method

Multiply the given matrix using the specified matrix order.
public Multiply ( QColorMatrix matrix, MatrixOrder order ) : void
matrix QColorMatrix Matrix to multiply
order MatrixOrder Order to multiply with
return void

QColorMatrix() public method

Default constructor
public QColorMatrix ( ) : System
return System

QColorMatrix() public method

Constructor specifying matrix data
public QColorMatrix ( System.Drawing.Imaging.ColorMatrix colorMatrix ) : System
colorMatrix System.Drawing.Imaging.ColorMatrix Matrix data to initialize with
return System

QColorMatrix() public method

Constructor specifying matrix data
public QColorMatrix ( QColorMatrix matrixData ) : System
matrixData QColorMatrix Matrix data to initialize with
return System

QColorMatrix() public method

Constructor specifying matrix data
public QColorMatrix ( float matrixData ) : System
matrixData float Matrix data to initialize with
return System

Reset() public method

Set to identity matrix
public Reset ( ) : void
return void

RotateBlue() public method

Rotate the matrix around the blue color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateBlue ( float phi ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
return void

RotateBlue() public method

Rotate the matrix around the blue color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateBlue ( float phi, MatrixOrder order ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
order MatrixOrder Matrix order
return void

RotateGreen() public method

Rotate the matrix around the green color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateGreen ( float phi ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
return void

RotateGreen() public method

Rotate the matrix around the green color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateGreen ( float phi, MatrixOrder order ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
order MatrixOrder Matrix order
return void

RotateHue() public method

Rotate the hue around the gray axis, keeping luminance fixed. Grays are fixed, all other colors change.
public RotateHue ( float phi ) : void
phi float Degrees to rotate
return void

RotateRed() public method

Rotate the matrix around the red color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateRed ( float phi ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
return void

RotateRed() public method

Rotate the matrix around the red color axes. The color of the rotation axis is unchanged, the other two colors are rotated in color space.
public RotateRed ( float phi, MatrixOrder order ) : void
phi float Angle in degrees to rotate (-180.0f... 180.0f).
order MatrixOrder Matrix order
return void

Scale() public method

Update this matrix with the product of itself and a scaling vector.
public Scale ( float scaleRed, float scaleGreen, float scaleBlue, float scaleOpacity ) : void
scaleRed float Red scaling value
scaleGreen float Green scaling value
scaleBlue float Blue scaling value
scaleOpacity float Alpha scaling value
return void

Scale() public method

Update this matrix with the product of itself and a scaling vector.
public Scale ( float scaleRed, float scaleGreen, float scaleBlue, float scaleOpacity, MatrixOrder order ) : void
scaleRed float Red scaling value
scaleGreen float Green scaling value
scaleBlue float Blue scaling value
scaleOpacity float Alpha scaling value
order MatrixOrder Matrix order
return void

ScaleColors() public method

Scale just the three colors with the same amount, leave opacity unchanged
public ScaleColors ( float scale ) : void
scale float Scale value
return void

ScaleColors() public method

Scale just the three colors with the same amount, leave opacity unchanged
public ScaleColors ( float scale, MatrixOrder order ) : void
scale float Scale value
order MatrixOrder Matrix order
return void

ScaleOpacity() public method

Scales the matrix opacity
public ScaleOpacity ( float scaleOpacity ) : void
scaleOpacity float Alpha scaling value
return void

ScaleOpacity() public method

Scales the matrix opacity
public ScaleOpacity ( float scaleOpacity, MatrixOrder order ) : void
scaleOpacity float Alpha scaling value
order MatrixOrder Matrix order
return void

SetBrightness() public method

Sets the matrix brightness
public SetBrightness ( float offset ) : void
offset float Brightness offset value
return void

SetContrast() public method

Sets the matrix contrast
public SetContrast ( float scale ) : void
scale float Constrast scale value
return void

SetSaturation() public method

Sets the matrix saturation
public SetSaturation ( float saturation ) : void
saturation float Saturation value
return void

SetSaturation() public method

Set the saturation of the matrix. Saturation of 0.0f yields black and white, 1.0f is neutral.
public SetSaturation ( float saturation, MatrixOrder order ) : void
saturation float Saturation value
order MatrixOrder Matrix order
return void

SetSaturation2() public method

Sets the matrix saturation using MatrixOrder.MatrixOrderAppend order.
public SetSaturation2 ( float saturation ) : void
saturation float Saturation value.
return void

ShearBlue() public method

Shear the matrix in the blue color plane. The color is influenced by the other two planes.
public ShearBlue ( float red, float green ) : void
red float Red color plane
green float Green color plane
return void

ShearBlue() public method

Shear the matrix in the blue color plane. The color is influenced by the other two planes.
public ShearBlue ( float red, float green, MatrixOrder order ) : void
red float Red color plane
green float Green color plane
order MatrixOrder Matrix order
return void

ShearGreen() public method

Shear the matrix in the green color plane. The color is influenced by the other two planes.
public ShearGreen ( float red, float blue ) : void
red float Red color plane
blue float Blue color plane
return void

ShearGreen() public method

Shear the matrix in the green color plane. The color is influenced by the other two planes.
public ShearGreen ( float red, float blue, MatrixOrder order ) : void
red float Red color plane
blue float Blue color plane
order MatrixOrder Matrix order
return void

ShearRed() public method

Shear the matrix in the red color plane. The color is influenced by the other two planes.
public ShearRed ( float green, float blue ) : void
green float Green color plane
blue float Blue color plane
return void

ShearRed() public method

Shear the matrix in the red color plane. The color is influenced by the other two planes.
public ShearRed ( float green, float blue, MatrixOrder order ) : void
green float Green color plane
blue float Blue color plane
order MatrixOrder Matrix order
return void

ToColorMatrix() public method

Converts the matrix to a ColorMatrix and returns it.
public ToColorMatrix ( ) : System.Drawing.Imaging.ColorMatrix
return System.Drawing.Imaging.ColorMatrix

ToJaggedMatrix() public method

Converts the matrix to a jagged array of data
public ToJaggedMatrix ( ) : float[][]
return float[][]

TransformColors() public method

Multiply each color by the matrix.
public TransformColors ( Color colors ) : Color[]
colors Color
return Color[]

TransformVector() public method

Multiply the vector v by the matrix in place. v points to an array of at least four values, representing R, G, B and A.
public TransformVector ( float v ) : float[]
v float
return float[]

TransformVector() public method

Transforms a vector
public TransformVector ( float vector, bool normalize ) : float[]
vector float Vector to transform
normalize bool Flag to normalize data before returning
return float[]

Translate() public method

Update this matrix with the product of itself and a translation vector.
public Translate ( float offsetRed, float offsetGreen, float offsetBlue, float offsetOpacity ) : void
offsetRed float Red offset value
offsetGreen float Green offset value
offsetBlue float Blue offset value
offsetOpacity float Alpha offset value
return void

Translate() public method

Update this matrix with the product of itself and a translation vector.
public Translate ( float offsetRed, float offsetGreen, float offsetBlue, float offsetOpacity, MatrixOrder order ) : void
offsetRed float Red offset value
offsetGreen float Green offset value
offsetBlue float Blue offset value
offsetOpacity float Alpha offset value
order MatrixOrder Matrix order
return void

TranslateColors() public method

Translate matrix colors
public TranslateColors ( float offset ) : void
offset float Offset value
return void

TranslateColors() public method

Translate matrix colors
public TranslateColors ( float offset, MatrixOrder order ) : void
offset float Offset value
order MatrixOrder Matrix order
return void

TranslateOpacity() public method

Translate matrix opacity
public TranslateOpacity ( float offsetOpacity ) : void
offsetOpacity float Alpha offset value
return void

TranslateOpacity() public method

Translate matrix opacity
public TranslateOpacity ( float offsetOpacity, MatrixOrder order ) : void
offsetOpacity float Alpha offset value
order MatrixOrder Matrix order
return void

Vector2Color() public static method

Converts a vector array to a Color object.
public static Vector2Color ( float vector ) : Color
vector float Floar array vector
return Color