C# Class Smrf.GraphicsLib.ColorGradientMapper

Maps a range of color metric values to colors within a gradient.
Call the Initialize() method to specify the color metric range, the color gradient to map the range to, and the number of discrete colors to split the gradient into. You can then call ColorMetricToColor() to map a color metric within the range to one of the discrete colors within the gradient, or ColorMetricToBrush() to get a corresponding brush.

Call Dispose() when you are done using the object.

Show file Open project: 2014-sed-team3/term-project Class Usage Examples

Protected Properties

Property Type Description
m_aoDiscreteBrushes System.Drawing.Brush[]
m_aoDiscreteColors Color[]
m_dColorMetricsPerDivision Double
m_dMaxColorMetric Double
m_dMinColorMetric Double
m_iDiscreteColorCount System.Int32

Public Methods

Method Description
ColorMetricToBrush ( Double dColorMetric ) : Brush
ColorMetricToColor ( Double dColorMetric ) : Color
Dispose ( ) : void
Initialize ( Double dMinColorMetric, Double dMaxColorMetric, Color oMinColor, Color oMaxColor, Int32 iDiscreteColorCount, System.Boolean bCreateBrushes ) : void

Protected Methods

Method Description
ColorGradientMapper ( ) : System

Initializes a new instance of the ColorGradientMapper class.

ColorMetricToArrayIndex ( Double dColorMetric ) : Int32
CreateDiscreteBrushes ( Color aoDiscreteColors ) : System.Drawing.Brush[]
CreateDiscreteColors ( Color oMinColor, Color oMaxColor, Int32 iDiscreteColorCount ) : Color[]

Method Details

ColorGradientMapper() protected method

Initializes a new instance of the ColorGradientMapper class.
protected ColorGradientMapper ( ) : System
return System

ColorMetricToArrayIndex() protected method

protected ColorMetricToArrayIndex ( Double dColorMetric ) : Int32
dColorMetric Double
return System.Int32

ColorMetricToBrush() public method

public ColorMetricToBrush ( Double dColorMetric ) : Brush
dColorMetric Double
return System.Drawing.Brush

ColorMetricToColor() public method

public ColorMetricToColor ( Double dColorMetric ) : Color
dColorMetric Double
return Color

CreateDiscreteBrushes() protected method

protected CreateDiscreteBrushes ( Color aoDiscreteColors ) : System.Drawing.Brush[]
aoDiscreteColors Color
return System.Drawing.Brush[]

CreateDiscreteColors() protected method

protected CreateDiscreteColors ( Color oMinColor, Color oMaxColor, Int32 iDiscreteColorCount ) : Color[]
oMinColor Color
oMaxColor Color
iDiscreteColorCount System.Int32
return Color[]

Dispose() public method

public Dispose ( ) : void
return void

Initialize() public method

public Initialize ( Double dMinColorMetric, Double dMaxColorMetric, Color oMinColor, Color oMaxColor, Int32 iDiscreteColorCount, System.Boolean bCreateBrushes ) : void
dMinColorMetric Double
dMaxColorMetric Double
oMinColor Color
oMaxColor Color
iDiscreteColorCount System.Int32
bCreateBrushes System.Boolean
return void

Property Details

m_aoDiscreteBrushes protected property

protected Brush[],System.Drawing m_aoDiscreteBrushes
return System.Drawing.Brush[]

m_aoDiscreteColors protected property

protected Color[] m_aoDiscreteColors
return Color[]

m_dColorMetricsPerDivision protected property

protected Double m_dColorMetricsPerDivision
return Double

m_dMaxColorMetric protected property

protected Double m_dMaxColorMetric
return Double

m_dMinColorMetric protected property

protected Double m_dMinColorMetric
return Double

m_iDiscreteColorCount protected property

protected Int32,System m_iDiscreteColorCount
return System.Int32