Struct HSBColor
Hue-Saturation-Brightness Color class to store a color value, and to manage conversions to and from RGB colors in the Color struct.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public struct HSBColor
Remarks
This class is based on code from http://www.cs.rit.edu/~ncs/color/ by Eugene Vishnevsky. This struct stores the hue, saturation, brightness, and alpha values internally as Byte values from 0 to 255. The hue represents a fraction of the 360 degrees of color space available. The saturation is the color intensity, where 0 represents gray scale and 255 is the most colored. For the brightness, 0 represents black and 255 represents white.
Constructors
| Improve this Doc View SourceHSBColor(Color)
Declaration
public HSBColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | An rgb Color struct containing the equivalent color you want to generate |
HSBColor(Int32, Int32, Int32)
Constructor to load an HSBColor struct from hue, saturation and brightness values
Declaration
public HSBColor(int h, int s, int b)
Parameters
Type | Name | Description |
---|---|---|
Int32 | h | The color hue value, ranging from 0 to 255 |
Int32 | s | The color saturation (intensity) value, ranging from 0 (gray scale) to 255 (most colored) |
Int32 | b | The brightness value, ranging from 0 (black) to 255 (white) |
HSBColor(Int32, Int32, Int32, Int32)
Constructor to load an HSBColor struct from hue, saturation, brightness, and alpha values
Declaration
public HSBColor(int a, int h, int s, int b)
Parameters
Type | Name | Description |
---|---|---|
Int32 | a | The alpha value (opacity), ranging from 0 (transparent) to 255 (opaque) |
Int32 | h | The color hue value, ranging from 0 to 255 |
Int32 | s | The color saturation (intensity) value, ranging from 0 (gray scale) to 255 (most colored) |
Int32 | b | The brightness value, ranging from 0 (black) to 255 (white) |
Fields
| Improve this Doc View SourceA
The alpha value (opacity), ranging from 0 (transparent) to 255 (opaque).
Declaration
public byte A
Field Value
Type | Description |
---|---|
Byte |
B
The brightness value, ranging from 0 (black) to 255 (white).
Declaration
public byte B
Field Value
Type | Description |
---|---|
Byte |
H
The color hue value, ranging from 0 to 255.
Declaration
public byte H
Field Value
Type | Description |
---|---|
Byte |
Remarks
This property is actually a rescaling of the 360 degrees on the color wheel to 255 possible values. Therefore, every 42.5 units is a new sector, with the following convention: red=0, yellow=42.5, green=85, cyan=127.5, blue=170, magenta=212.5
S
The color saturation (intensity) value, ranging from 0 (gray scale) to 255 (most colored).
Declaration
public byte S
Field Value
Type | Description |
---|---|
Byte |
Methods
| Improve this Doc View SourceFromRGB()
Declaration
public HSBColor FromRGB()
Returns
Type | Description |
---|---|
HSBColor | An equivalent HSBColor struct |
Remarks
This method is based on code from http://www.cs.rit.edu/~ncs/color/ by Eugene Vishnevsky.
FromRGB(Color)
Declaration
public static HSBColor FromRGB(Color rgbColor)
Parameters
Type | Name | Description |
---|---|---|
Color | rgbColor | The Color struct to be converted |
Returns
Type | Description |
---|---|
HSBColor | An equivalent HSBColor struct |
Remarks
This method is based on code from http://www.cs.rit.edu/~ncs/color/ by Eugene Vishnevsky.
ToRGB()
Declaration
public Color ToRGB()
Returns
Type | Description |
---|---|
Color | An equivalent Color struct, compatible with the GDI+ library |
Remarks
This method is based on code from http://www.cs.rit.edu/~ncs/color/ by Eugene Vishnevsky.
ToRGB(HSBColor)
Declaration
public static Color ToRGB(HSBColor hsbColor)
Parameters
Type | Name | Description |
---|---|---|
HSBColor | hsbColor | The HSBColor struct to be converted |
Returns
Type | Description |
---|---|
Color | An equivalent Color struct, compatible with the GDI+ library |
Remarks
This method is based on code from http://www.cs.rit.edu/~ncs/color/ by Eugene Vishnevsky.
Operators
| Improve this Doc View SourceImplicit(HSBColor to Color)
Declaration
public static implicit operator Color(HSBColor hsbColor)
Parameters
Type | Name | Description |
---|---|---|
HSBColor | hsbColor | The HSBColor struct to be converted |
Returns
Type | Description |
---|---|
Color | An equivalent Color struct that can be used in the GDI+ graphics library |