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 System.Drawing.Color struct.

    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.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 System.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 System.Drawing.Color struct.

    Declaration
    public HSBColor(Color color)
    Parameters
    Type Name Description
    System.Drawing.Color color

    An rgb System.Drawing.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
    System.Int32 h

    The color hue value, ranging from 0 to 255

    System.Int32 s

    The color saturation (intensity) value, ranging from 0 (gray scale) to 255 (most colored)

    System.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
    System.Int32 a

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

    System.Int32 h

    The color hue value, ranging from 0 to 255

    System.Int32 s

    The color saturation (intensity) value, ranging from 0 (gray scale) to 255 (most colored)

    System.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
    System.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
    System.Byte
    | Improve this Doc View Source

    H

    The color hue value, ranging from 0 to 255.

    Declaration
    public byte H
    Field Value
    Type Description
    System.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
    System.Byte

    Methods

    | Improve this Doc View Source

    FromRGB()

    Convert a System.Drawing.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 System.Drawing.Color value to an equivalent HSBColor value.

    Declaration
    public static HSBColor FromRGB(Color rgbColor)
    Parameters
    Type Name Description
    System.Drawing.Color rgbColor

    The System.Drawing.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 System.Drawing.Color value.

    Declaration
    public Color ToRGB()
    Returns
    Type Description
    System.Drawing.Color

    An equivalent System.Drawing.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 System.Drawing.Color value.

    Declaration
    public static Color ToRGB(HSBColor hsbColor)
    Parameters
    Type Name Description
    HSBColor hsbColor

    The HSBColor struct to be converted

    Returns
    Type Description
    System.Drawing.Color

    An equivalent System.Drawing.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 System.Drawing.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
    System.Drawing.Color

    An equivalent System.Drawing.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