C# Class Pinta.Core.ColorBgra

Datei anzeigen Open project: xxgreg/Pinta Class Usage Examples

Public Methods

Method Description
BgraToUInt32 ( byte b, byte g, byte r, byte a ) : UInt32

Packs color and alpha values into a 32-bit integer.

BgraToUInt32 ( int b, int g, int r, int a ) : UInt32

Packs color and alpha values into a 32-bit integer.

Blend ( ColorBgra ca, ColorBgra cb, byte cbAlpha ) : ColorBgra

Constructs a new ColorBgra instance from the values in the given Color instance.

Converts this ColorBgra instance to a Color instance.

Smoothly blends between two colors.

Blend ( ColorBgra colors, int count ) : ColorBgra

Smoothly blends the given colors together, assuming equal weighting for each one.

BlendColors4W16IP ( ColorBgra c1, uint w1, ColorBgra c2, uint w2, ColorBgra c3, uint w3, ColorBgra c4, uint w4 ) : ColorBgra

Blends four colors together based on the given weight values.

The weights should be 16-bit fixed point numbers that add up to 65536 ("1.0"). 4W16IP means "4 colors, weights, 16-bit integer precision"

BlendColorsWAIP ( ColorBgra c, uint w ) : ColorBgra

Blends the colors based on the given weight values.

"WAIP" stands for "weights, arbitrary integer precision"

BlendColorsWFP ( ColorBgra c, double w ) : ColorBgra

Blends the colors based on the given weight values.

"WAIP" stands for "weights, floating-point"

ClampToByte ( double x ) : byte
ClampToByte ( float x ) : byte
ClampToByte ( int x ) : byte
Equals ( object obj ) : bool

Compares two ColorBgra instance to determine if they are equal.

FromBgr ( byte b, byte g, byte r ) : ColorBgra

Creates a new ColorBgra instance with the given color values, and 255 for alpha.

FromBgra ( byte b, byte g, byte r, byte a ) : ColorBgra

Creates a new ColorBgra instance with the given color and alpha values.

FromBgraClamped ( float b, float g, float r, float a ) : ColorBgra

Creates a new ColorBgra instance with the given color and alpha values.

FromBgraClamped ( int b, int g, int r, int a ) : ColorBgra

Creates a new ColorBgra instance with the given color and alpha values.

FromUInt32 ( UInt32 bgra ) : ColorBgra

Constructs a new ColorBgra instance with the given 32-bit value.

GetAverageColorChannelValue ( ) : byte

Returns the average of the B, G, and R values. Alpha is ignored.

GetHashCode ( ) : int

Returns a hash code for this color value.

GetIntensity ( ) : double

Gets the luminance intensity of the pixel based on the values of the red, green, and blue components. Alpha is ignored.

GetIntensityByte ( ) : byte

Gets the luminance intensity of the pixel based on the values of the red, green, and blue components. Alpha is ignored.

GetMaxColorChannelValue ( ) : byte

Returns the maximum value out of the B, G, and R values. Alpha is ignored.

Lerp ( ColorBgra from, ColorBgra to, double frac ) : ColorBgra

Linearly interpolates between two color values.

This method does a simple lerp on each color value and on the alpha channel. It does not properly take into account the alpha channel's effect on color blending.

Lerp ( ColorBgra from, ColorBgra to, float frac ) : ColorBgra

Linearly interpolates between two color values.

This method does a simple lerp on each color value and on the alpha channel. It does not properly take into account the alpha channel's effect on color blending.

Lerp ( double from, double to, double frac ) : double
Lerp ( float from, float to, float frac ) : float
NewAlpha ( byte newA ) : ColorBgra

Gets the equivalent GDI+ PixelFormat.

Returns a new ColorBgra with the same color values but with a new alpha component value.

This property always returns PixelFormat.Format32bppArgb.

ParseHexString ( string hexString ) : ColorBgra
ToHexString ( ) : string
ToString ( ) : string
operator ( ) : bool

Compares two ColorBgra instance to determine if they are not equal.

this ( int channel ) : byte

Gets or sets the byte value of the specified color channel.

Private Methods

Method Description
FromRgb ( byte r, byte g, byte b ) : ColorBgra
FromRgba ( byte r, byte g, byte b, byte a ) : ColorBgra

Method Details

BgraToUInt32() public static method

Packs color and alpha values into a 32-bit integer.
public static BgraToUInt32 ( byte b, byte g, byte r, byte a ) : UInt32
b byte
g byte
r byte
a byte
return System.UInt32

BgraToUInt32() public static method

Packs color and alpha values into a 32-bit integer.
public static BgraToUInt32 ( int b, int g, int r, int a ) : UInt32
b int
g int
r int
a int
return System.UInt32

Blend() public static method

Constructs a new ColorBgra instance from the values in the given Color instance. Converts this ColorBgra instance to a Color instance. Smoothly blends between two colors.
public static Blend ( ColorBgra ca, ColorBgra cb, byte cbAlpha ) : ColorBgra
ca ColorBgra
cb ColorBgra
cbAlpha byte
return ColorBgra

Blend() public static method

Smoothly blends the given colors together, assuming equal weighting for each one.
public static Blend ( ColorBgra colors, int count ) : ColorBgra
colors ColorBgra
count int
return ColorBgra

BlendColors4W16IP() public static method

Blends four colors together based on the given weight values.
The weights should be 16-bit fixed point numbers that add up to 65536 ("1.0"). 4W16IP means "4 colors, weights, 16-bit integer precision"
public static BlendColors4W16IP ( ColorBgra c1, uint w1, ColorBgra c2, uint w2, ColorBgra c3, uint w3, ColorBgra c4, uint w4 ) : ColorBgra
c1 ColorBgra
w1 uint
c2 ColorBgra
w2 uint
c3 ColorBgra
w3 uint
c4 ColorBgra
w4 uint
return ColorBgra

BlendColorsWAIP() public static method

Blends the colors based on the given weight values.
"WAIP" stands for "weights, arbitrary integer precision"
public static BlendColorsWAIP ( ColorBgra c, uint w ) : ColorBgra
c ColorBgra The array of color values.
w uint The array of weight values.
return ColorBgra

BlendColorsWFP() public static method

Blends the colors based on the given weight values.
"WAIP" stands for "weights, floating-point"
public static BlendColorsWFP ( ColorBgra c, double w ) : ColorBgra
c ColorBgra The array of color values.
w double The array of weight values.
return ColorBgra

ClampToByte() public static method

public static ClampToByte ( double x ) : byte
x double
return byte

ClampToByte() public static method

public static ClampToByte ( float x ) : byte
x float
return byte

ClampToByte() public static method

public static ClampToByte ( int x ) : byte
x int
return byte

Equals() public method

Compares two ColorBgra instance to determine if they are equal.
public Equals ( object obj ) : bool
obj object
return bool

FromBgr() public static method

Creates a new ColorBgra instance with the given color values, and 255 for alpha.
public static FromBgr ( byte b, byte g, byte r ) : ColorBgra
b byte
g byte
r byte
return ColorBgra

FromBgra() public static method

Creates a new ColorBgra instance with the given color and alpha values.
public static FromBgra ( byte b, byte g, byte r, byte a ) : ColorBgra
b byte
g byte
r byte
a byte
return ColorBgra

FromBgraClamped() public static method

Creates a new ColorBgra instance with the given color and alpha values.
public static FromBgraClamped ( float b, float g, float r, float a ) : ColorBgra
b float
g float
r float
a float
return ColorBgra

FromBgraClamped() public static method

Creates a new ColorBgra instance with the given color and alpha values.
public static FromBgraClamped ( int b, int g, int r, int a ) : ColorBgra
b int
g int
r int
a int
return ColorBgra

FromUInt32() public static method

Constructs a new ColorBgra instance with the given 32-bit value.
public static FromUInt32 ( UInt32 bgra ) : ColorBgra
bgra System.UInt32
return ColorBgra

GetAverageColorChannelValue() public method

Returns the average of the B, G, and R values. Alpha is ignored.
public GetAverageColorChannelValue ( ) : byte
return byte

GetHashCode() public method

Returns a hash code for this color value.
public GetHashCode ( ) : int
return int

GetIntensity() public method

Gets the luminance intensity of the pixel based on the values of the red, green, and blue components. Alpha is ignored.
public GetIntensity ( ) : double
return double

GetIntensityByte() public method

Gets the luminance intensity of the pixel based on the values of the red, green, and blue components. Alpha is ignored.
public GetIntensityByte ( ) : byte
return byte

GetMaxColorChannelValue() public method

Returns the maximum value out of the B, G, and R values. Alpha is ignored.
public GetMaxColorChannelValue ( ) : byte
return byte

Lerp() public static method

Linearly interpolates between two color values.
This method does a simple lerp on each color value and on the alpha channel. It does not properly take into account the alpha channel's effect on color blending.
public static Lerp ( ColorBgra from, ColorBgra to, double frac ) : ColorBgra
from ColorBgra The color value that represents 0 on the lerp number line.
to ColorBgra The color value that represents 1 on the lerp number line.
frac double A value in the range [0, 1].
return ColorBgra

Lerp() public static method

Linearly interpolates between two color values.
This method does a simple lerp on each color value and on the alpha channel. It does not properly take into account the alpha channel's effect on color blending.
public static Lerp ( ColorBgra from, ColorBgra to, float frac ) : ColorBgra
from ColorBgra The color value that represents 0 on the lerp number line.
to ColorBgra The color value that represents 1 on the lerp number line.
frac float A value in the range [0, 1].
return ColorBgra

Lerp() public static method

public static Lerp ( double from, double to, double frac ) : double
from double
to double
frac double
return double

Lerp() public static method

public static Lerp ( float from, float to, float frac ) : float
from float
to float
frac float
return float

NewAlpha() public method

Gets the equivalent GDI+ PixelFormat. Returns a new ColorBgra with the same color values but with a new alpha component value.
This property always returns PixelFormat.Format32bppArgb.
public NewAlpha ( byte newA ) : ColorBgra
newA byte
return ColorBgra

ParseHexString() public static method

public static ParseHexString ( string hexString ) : ColorBgra
hexString string
return ColorBgra

ToHexString() public method

public ToHexString ( ) : string
return string

ToString() public method

public ToString ( ) : string
return string

operator() public static method

Compares two ColorBgra instance to determine if they are not equal.
public static operator ( ) : bool
return bool

this() public method

Gets or sets the byte value of the specified color channel.
public this ( int channel ) : byte
channel int
return byte