C# Class Imager.sPixel

A pixel (dword) 32Bits wide, 8 Bits for red, green, blue and alpha values.
Afficher le fichier Open project: soywiz/cspspemu Class Usage Examples

Méthodes publiques

Свойство Type Description
AllowThresholds bool
Black sPixel
ColorExtractionFactor double
Purple sPixel
White sPixel

Méthodes publiques

Méthode Description
AbsDifference ( sPixel pixel ) : uint

Calculates the absolute difference between to pixels.

Clone ( ) : object

Creates a new object that is a copy of the current instance.

Equals ( object o ) : bool

Determines whether the specified System.Object is equal to this instance.

Equals ( sPixel pixel ) : bool

Determines whether the specified sPixel is equal to this instance.

FromFloat ( float red, float green, float blue, float alpha = 1f ) : sPixel
FromGrey ( byte grey, byte alpha = 255 ) : sPixel

Factory to create a sPixel instance from grey value.

FromRGBA ( byte red, byte green, byte blue, byte alpha = 255 ) : sPixel

Factory to create a sPixel instance from red, green and blue value.

FromRGBA ( int red, int green, int blue, int alpha = 255 ) : sPixel

Factory to create a sPixel instance from red, green and blue value.

GetHashCode ( ) : int

Returns a hash code for this instance.

GetObjectData ( SerializationInfo serializationInfo, StreamingContext _ ) : void

Serializes this instance.

Interpolate ( sPixel pixel1, sPixel pixel2 ) : sPixel

Interpolates two sPixel instances.

Interpolate ( sPixel pixel1, sPixel pixel2, byte quantifier1, byte quantifier2 ) : sPixel

Weighted interpolation of two sPixel instances.

Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3 ) : sPixel

Interpolates three sPixel instances.

Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, byte quantifier1, byte quantifier2, byte quantifier3 ) : sPixel

Weighted interpolation of three sPixel instances.

Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, sPixel pixel4 ) : sPixel

Interpolates four sPixel instances.

Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, sPixel pixel4, byte quantifier1, byte quantifier2, byte quantifier3, byte quantifier4 ) : sPixel

Weighted interpolation of four sPixel instances.

IsLike ( sPixel pixel ) : bool

Determines whether the specified sPixel instance is similar to this instance.

IsNotLike ( sPixel pixel ) : bool

Determines whether this instance is not like the specified sPixel instance.

ToString ( ) : string

Returns a System.String that represents this instance.

operator ( ) : bool

Test for inequality of at least one color component.

operator ( ) : sPixel

Inverts the given color.

sPixel ( Color color ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by using an instance of a the Color class.

sPixel ( SerializationInfo serializationInfo, StreamingContext _ ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by deserializing it.

sPixel ( byte grey, byte alpha = 255 ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by using a grey value.

sPixel ( byte red, byte green, byte blue, byte alpha = 255 ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by using red, green and blue component.

sPixel ( double red, double green, double blue, double alpha = 1 ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by using red, green and blue component.

sPixel ( sPixel pixel ) : System.Diagnostics.Contracts

Initializes a new instance of the sPixel struct by using an existing one.

Private Methods

Méthode Description
_Byte2Double ( byte value ) : double

Converts a byte color component to double floating point.

_Byte2Single ( byte value ) : float

Converts a byte color component to single floating point.

_Float2Byte ( float value ) : byte

Clips a float value within 0-255 range and returns it.

_GetAlpha ( uint rgbBytes ) : byte

Gets the value for alpha, hopefully the compiler inlines that.

_GetBlue ( uint rgbBytes ) : byte

Gets the value for blue, hopefully the compiler inlines that.

_GetGreen ( uint rgbBytes ) : byte

Gets the value for green, hopefully the compiler inlines that.

_GetRed ( uint rgbBytes ) : byte

Gets the value for red, hopefully the compiler inlines that.

sPixel ( dword rgbData ) : System.Diagnostics.Contracts

Prevents a default instance of the sPixel struct from being created.

Method Details

AbsDifference() public méthode

Calculates the absolute difference between to pixels.
public AbsDifference ( sPixel pixel ) : uint
pixel sPixel The pixel to differ to.
Résultat uint

Clone() public méthode

Creates a new object that is a copy of the current instance.
public Clone ( ) : object
Résultat object

Equals() public méthode

Determines whether the specified System.Object is equal to this instance.
public Equals ( object o ) : bool
o object The to compare with this instance.
Résultat bool

Equals() public méthode

Determines whether the specified sPixel is equal to this instance.
public Equals ( sPixel pixel ) : bool
pixel sPixel The to compare with this instance.
Résultat bool

FromFloat() public static méthode

public static FromFloat ( float red, float green, float blue, float alpha = 1f ) : sPixel
red float
green float
blue float
alpha float
Résultat sPixel

FromGrey() public static méthode

Factory to create a sPixel instance from grey value.
public static FromGrey ( byte grey, byte alpha = 255 ) : sPixel
grey byte The grey value.
alpha byte The alpha value.
Résultat sPixel

FromRGBA() public static méthode

Factory to create a sPixel instance from red, green and blue value.
public static FromRGBA ( byte red, byte green, byte blue, byte alpha = 255 ) : sPixel
red byte The red-value.
green byte The green-value.
blue byte The blue-value.
alpha byte The alpha-value.
Résultat sPixel

FromRGBA() public static méthode

Factory to create a sPixel instance from red, green and blue value.
public static FromRGBA ( int red, int green, int blue, int alpha = 255 ) : sPixel
red int The red-value.
green int The green-value.
blue int The blue-value.
alpha int The alpha-value.
Résultat sPixel

GetHashCode() public méthode

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

GetObjectData() public méthode

Serializes this instance.
public GetObjectData ( SerializationInfo serializationInfo, StreamingContext _ ) : void
serializationInfo System.Runtime.Serialization.SerializationInfo The serialization info.
_ System.Runtime.Serialization.StreamingContext The streaming context.
Résultat void

Interpolate() public static méthode

Interpolates two sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2 ) : sPixel
pixel1 sPixel The first pixel instance.
pixel2 sPixel The second pixel instance.
Résultat sPixel

Interpolate() public static méthode

Weighted interpolation of two sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2, byte quantifier1, byte quantifier2 ) : sPixel
pixel1 sPixel The first instance.
pixel2 sPixel The second instance.
quantifier1 byte The quantifier for the first instance.
quantifier2 byte The quantifier for the second instance.
Résultat sPixel

Interpolate() public static méthode

Interpolates three sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3 ) : sPixel
pixel1 sPixel The first pixel instance.
pixel2 sPixel The second pixel instance.
pixel3 sPixel The third pixel instance.
Résultat sPixel

Interpolate() public static méthode

Weighted interpolation of three sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, byte quantifier1, byte quantifier2, byte quantifier3 ) : sPixel
pixel1 sPixel The first instance.
pixel2 sPixel The second instance.
pixel3 sPixel The third instance.
quantifier1 byte The quantifier for the first instance.
quantifier2 byte The quantifier for the second instance.
quantifier3 byte The quantifier for the third instance.
Résultat sPixel

Interpolate() public static méthode

Interpolates four sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, sPixel pixel4 ) : sPixel
pixel1 sPixel The first pixel instance.
pixel2 sPixel The second pixel instance.
pixel3 sPixel The third pixel instance.
pixel4 sPixel The fourth pixel instance.
Résultat sPixel

Interpolate() public static méthode

Weighted interpolation of four sPixel instances.
public static Interpolate ( sPixel pixel1, sPixel pixel2, sPixel pixel3, sPixel pixel4, byte quantifier1, byte quantifier2, byte quantifier3, byte quantifier4 ) : sPixel
pixel1 sPixel The first instance.
pixel2 sPixel The second instance.
pixel3 sPixel The third instance.
pixel4 sPixel The fourth instance.
quantifier1 byte The quantifier for the first instance.
quantifier2 byte The quantifier for the second instance.
quantifier3 byte The quantifier for the third instance.
quantifier4 byte The quantifier for the fourth instance.
Résultat sPixel

IsLike() public méthode

Determines whether the specified sPixel instance is similar to this instance.
public IsLike ( sPixel pixel ) : bool
pixel sPixel The instance to compare to.
Résultat bool

IsNotLike() public méthode

Determines whether this instance is not like the specified sPixel instance.
public IsNotLike ( sPixel pixel ) : bool
pixel sPixel The instance to compare to.
Résultat bool

ToString() public méthode

Returns a System.String that represents this instance.
public ToString ( ) : string
Résultat string

operator() public static méthode

Test for inequality of at least one color component.
public static operator ( ) : bool
Résultat bool

operator() public static méthode

Inverts the given color.
public static operator ( ) : sPixel
Résultat sPixel

sPixel() public méthode

Initializes a new instance of the sPixel struct by using an instance of a the Color class.
public sPixel ( Color color ) : System.Diagnostics.Contracts
color Color The color.
Résultat System.Diagnostics.Contracts

sPixel() public méthode

Initializes a new instance of the sPixel struct by deserializing it.
public sPixel ( SerializationInfo serializationInfo, StreamingContext _ ) : System.Diagnostics.Contracts
serializationInfo System.Runtime.Serialization.SerializationInfo The serialization info.
_ System.Runtime.Serialization.StreamingContext The streaming context.
Résultat System.Diagnostics.Contracts

sPixel() public méthode

Initializes a new instance of the sPixel struct by using a grey value.
public sPixel ( byte grey, byte alpha = 255 ) : System.Diagnostics.Contracts
grey byte The grey value.
alpha byte The alpha value.
Résultat System.Diagnostics.Contracts

sPixel() public méthode

Initializes a new instance of the sPixel struct by using red, green and blue component.
public sPixel ( byte red, byte green, byte blue, byte alpha = 255 ) : System.Diagnostics.Contracts
red byte The red-value.
green byte The green-value.
blue byte The blue-value.
alpha byte The alpha-value.
Résultat System.Diagnostics.Contracts

sPixel() public méthode

Initializes a new instance of the sPixel struct by using red, green and blue component.
public sPixel ( double red, double green, double blue, double alpha = 1 ) : System.Diagnostics.Contracts
red double The red-value.
green double The green-value.
blue double The blue-value.
alpha double The alpha.
Résultat System.Diagnostics.Contracts

sPixel() public méthode

Initializes a new instance of the sPixel struct by using an existing one.
public sPixel ( sPixel pixel ) : System.Diagnostics.Contracts
pixel sPixel The pixel instance to copy from.
Résultat System.Diagnostics.Contracts

Property Details

AllowThresholds public_oe static_oe property

true when IsLike and IsNotLike should allow little differencies in comparison; otherwise, false.
public static bool AllowThresholds
Résultat bool

Black public_oe static_oe property

Black
public static sPixel,Imager Black
Résultat sPixel

ColorExtractionFactor public_oe static_oe property

Factor that is used to avoid noise in color extraction. The higher the factor, the lesser colors will be detected.
public static double ColorExtractionFactor
Résultat double

Purple public_oe static_oe property

Purple
public static sPixel,Imager Purple
Résultat sPixel

White public_oe static_oe property

White
public static sPixel,Imager White
Résultat sPixel