C# Class Pinta.Core.ColorBgra

Afficher le fichier Open project: xxgreg/Pinta Class Usage Examples

Méthodes publiques

Méthode 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

Méthode Description
FromRgb ( byte r, byte g, byte b ) : ColorBgra
FromRgba ( byte r, byte g, byte b, byte a ) : ColorBgra

Method Details

BgraToUInt32() public static méthode

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
Résultat System.UInt32

BgraToUInt32() public static méthode

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
Résultat System.UInt32

Blend() public static méthode

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
Résultat ColorBgra

Blend() public static méthode

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

BlendColors4W16IP() public static méthode

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
Résultat ColorBgra

BlendColorsWAIP() public static méthode

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.
Résultat ColorBgra

BlendColorsWFP() public static méthode

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.
Résultat ColorBgra

ClampToByte() public static méthode

public static ClampToByte ( double x ) : byte
x double
Résultat byte

ClampToByte() public static méthode

public static ClampToByte ( float x ) : byte
x float
Résultat byte

ClampToByte() public static méthode

public static ClampToByte ( int x ) : byte
x int
Résultat byte

Equals() public méthode

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

FromBgr() public static méthode

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
Résultat ColorBgra

FromBgra() public static méthode

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
Résultat ColorBgra

FromBgraClamped() public static méthode

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
Résultat ColorBgra

FromBgraClamped() public static méthode

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
Résultat ColorBgra

FromUInt32() public static méthode

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

GetAverageColorChannelValue() public méthode

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

GetHashCode() public méthode

Returns a hash code for this color value.
public GetHashCode ( ) : int
Résultat int

GetIntensity() public méthode

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

GetIntensityByte() public méthode

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

GetMaxColorChannelValue() public méthode

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

Lerp() public static méthode

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].
Résultat ColorBgra

Lerp() public static méthode

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].
Résultat ColorBgra

Lerp() public static méthode

public static Lerp ( double from, double to, double frac ) : double
from double
to double
frac double
Résultat double

Lerp() public static méthode

public static Lerp ( float from, float to, float frac ) : float
from float
to float
frac float
Résultat float

NewAlpha() public méthode

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
Résultat ColorBgra

ParseHexString() public static méthode

public static ParseHexString ( string hexString ) : ColorBgra
hexString string
Résultat ColorBgra

ToHexString() public méthode

public ToHexString ( ) : string
Résultat string

ToString() public méthode

public ToString ( ) : string
Résultat string

operator() public static méthode

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

this() public méthode

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