C# Class RemoteLedMatrix.Helpers.ColorExtensions

Class of extensions to make dealing with Colors easier
显示文件 Open project: ms-iot/LEDMatrix

Public Methods

Method Description
ApplyGamma ( this source, double gamma ) : Color

Gamma shifts a color by a given amount

FlipEvenColumns ( this pixels, int pixelsPerColumn ) : List

Flips alternating columns of colors in an image

Get21BitPixelBytes ( this colors ) : IEnumerable

Converts an IEnumerable of colors into an IEnumerable of bytes

GetHue ( this color ) : float

Gets the hue as a 0-360 value, representing the degree of rotation

GetIntensity ( this color ) : float

Gets the HSI intensity of the color

GetSaturation ( this color ) : float

Gets the HSI saturation of the color

To21BitPixelBytes ( this color ) : IEnumerable

Extension method for converting a color to three 7-bit bytes

ToColorList ( this bitmap ) : List

Gets a list of all the pixels in a bitmap, serialized to a flat list

ToPerceptual ( this source ) : Color

Shifts a color's intensity so that it looks perceptually correct when displayed on RGB leds.

Private Methods

Method Description
ApplyGammaToChannel ( byte value, double gamma ) : byte

Applies a gamma shift to a byte value

PerceptualTransformA ( double hue, float saturation, float intensity ) : byte

Transform one of three for converting a HSI-based color to a perceptually adjusted RGB value

PerceptualTransformB ( double hue, float saturation, float intensity ) : byte

Transform two of three for converting a HSI-based color to a perceptually adjusted RGB value

PerceptualTransformC ( double hue, float saturation, float intensity ) : byte

Transform three of three for converting a HSI-based color to a perceptually adjusted RGB value

Method Details

ApplyGamma() public static method

Gamma shifts a color by a given amount
public static ApplyGamma ( this source, double gamma ) : Color
source this Source pixel to gamma shift
gamma double Amount to gamma shift by
return Color

FlipEvenColumns() public static method

Flips alternating columns of colors in an image
public static FlipEvenColumns ( this pixels, int pixelsPerColumn ) : List
pixels this Color data to flip columns for
pixelsPerColumn int How many pixels are in each column
return List

Get21BitPixelBytes() public static method

Converts an IEnumerable of colors into an IEnumerable of bytes
public static Get21BitPixelBytes ( this colors ) : IEnumerable
colors this List of colors to get bytes for
return IEnumerable

GetHue() public static method

Gets the hue as a 0-360 value, representing the degree of rotation
public static GetHue ( this color ) : float
color this Color to get the hue of
return float

GetIntensity() public static method

Gets the HSI intensity of the color
public static GetIntensity ( this color ) : float
color this Color to get the intensity of
return float

GetSaturation() public static method

Gets the HSI saturation of the color
public static GetSaturation ( this color ) : float
color this Color to get the saturation of
return float

To21BitPixelBytes() public static method

Extension method for converting a color to three 7-bit bytes
public static To21BitPixelBytes ( this color ) : IEnumerable
color this Color to convert to bytes
return IEnumerable

ToColorList() public static method

Gets a list of all the pixels in a bitmap, serialized to a flat list
public static ToColorList ( this bitmap ) : List
bitmap this Bitmap to serialize into a list of colors
return List

ToPerceptual() public static method

Shifts a color's intensity so that it looks perceptually correct when displayed on RGB leds.
public static ToPerceptual ( this source ) : Color
source this Unadjusted color to shift
return Color