Search Results for

    Show / Hide Table of Contents

    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
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.GetType()
    Object.ReferenceEquals(Object, Object)
    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 Source

    HSBColor(Color)

    Constructor to load an HSBColor struct from a system Color struct.

    Declaration
    public HSBColor(Color color)
    Parameters
    Type Name Description
    Color color

    An rgb Color struct containing the equivalent color you want to generate

    | Improve this Doc View Source

    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)

    | Improve this Doc View Source

    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 Source

    A

    The alpha value (opacity), ranging from 0 (transparent) to 255 (opaque).

    Declaration
    public byte A
    Field Value
    Type Description
    Byte
    | Improve this Doc View Source

    B

    The brightness value, ranging from 0 (black) to 255 (white).

    Declaration
    public byte B
    Field Value
    Type Description
    Byte
    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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 Source

    FromRGB()

    Convert a Color value to an equivalent HSBColor value.

    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.

    | Improve this Doc View Source

    FromRGB(Color)

    Convert a Color value to an equivalent HSBColor value.

    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.

    | Improve this Doc View Source

    ToRGB()

    Convert this HSBColor value to an equivalent Color value.

    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.

    | Improve this Doc View Source

    ToRGB(HSBColor)

    Convert an HSBColor value to an equivalent Color value.

    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 Source

    Implicit(HSBColor to Color)

    Implicit conversion operator to convert directly from an HSBColor to a Color struct.

    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

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX