HSL Structure |
Namespace: Accord.Imaging
The HSL type exposes the following members.
Name | Description | |
---|---|---|
Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType.) | |
FromRGB(RGB) |
Convert from RGB to HSL color space.
| |
FromRGB(RGB, HSL) |
Convert from RGB to HSL color space.
| |
GetHashCode | Returns the hash code for this instance. (Inherited from ValueType.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToRGB |
Convert the color to RGB color space.
| |
ToRGB(HSL, RGB) |
Convert from HSL to RGB color space.
| |
ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
Name | Description | |
---|---|---|
(HSL to RGB) |
Performs an explicit conversion from HSL to RGB.
| |
(HSL to YCbCr) |
Performs an explicit conversion from HSL to YCbCr.
|
Name | Description | |
---|---|---|
Hue |
Hue component.
| |
Luminance |
Luminance value.
| |
Saturation |
Saturation component.
|
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The following examples show how to convert to and from various pixel representations:
// This example shows how to convert to and from various // pixel representations. For example, let's say we start // with a RGB pixel with the value (24, 250, 153): RGB rgb = new RGB(red: 24, green: 250, blue: 153); // The value of this pixel in HSL format would be: HSL hsl = HSL.FromRGB(rgb); // should be (154, 0.9576271, 0.5372549) // The value of this pixel in YCbCr format would be: YCbCr yCbCr = YCbCr.FromRGB(rgb); // should be (0.671929836, -0.0406815559, -0.412097245) // Note: we can also convert using casting: HSL a = (HSL)rgb; YCbCr b = (YCbCr)rgb;
// This example shows how to convert to and from various // pixel representations. For example, let's say we start // with a HSL pixel with the value (123, 0.4, 0.8): HSL hsl = new HSL(hue: 123, saturation: 0.4f, luminance: 0.8f); // The value of this pixel in RGB format would be: RGB rgb = hsl.ToRGB(); // should be (183, 224, 185) // The value of this pixel in YCbCr format would be: YCbCr yCbCr = YCbCr.FromRGB(rgb); // should be (0.8128612, -0.0493462719, -0.0679121539) // Note: we can also convert using casting: RGB a = (RGB)hsl; YCbCr b = (YCbCr)hsl;
// This example shows how to convert to and from various // pixel representations. For example, let's say we start // with a YCbCr pixel with the value (0.8, 0.2, 0.5): YCbCr yCbCr = new YCbCr(y: 0.8f, cb: 0.2f, cr: 0.5f); // The value of this pixel in RGB format would be: RGB rgb = yCbCr.ToRGB(); // should be (255, 95, 255) // The value of this pixel in HSL format would be: HSL hsl = HSL.FromRGB(rgb); // should be (299, 0.99999994, 0.6862745) // Note: we can also convert using casting: RGB a = (RGB)yCbCr; HSL b = (HSL)yCbCr;