C# Class LibNoise.Renderer.GradientColor

Defines a color gradient. A color gradient is a list of gradually-changing colors. A color gradient is defined by a list of gradient points. Each gradient point has a position and a color. In a color gradient, the colors between two adjacent gradient points are linearly interpolated. To add a gradient point to the color gradient, pass its position and color to the AddGradientPoint() method. To retrieve a color from a specific position in the color gradient, pass that position to the GetColor() method. This class is a useful tool for coloring height maps based on elevation. Gradient example Suppose a gradient object contains the following gradient points: - -1.0 maps to black. - 0.0 maps to white. - 1.0 maps to red. If an application passes -0.5 to the GetColor() method, this method will return a gray color that is halfway between black and white. If an application passes 0.25 to the GetColor() method, this method will return a very light pink color that is one quarter of the way between white and red.
Afficher le fichier Open project: everbytes/LibNoise

Méthodes publiques

Méthode Description
AddGradientPoint ( GradientPoint point ) : void

Adds a gradient point to this gradient object. No two gradient points have the same position. @throw System.ArgumentException if two control points have the same position. It does not matter which order these gradient points are added.

AddGradientPoint ( float position, IColor color ) : void

Adds a gradient point to this gradient object. No two gradient points have the same position. @throw System.ArgumentException if two control points have the same position. It does not matter which order these gradient points are added.

Clear ( ) : void

Deletes all the gradient points from this gradient object. All gradient points from this gradient object are deleted.

CountGradientPoints ( ) : int

Return the size of the GradientPoint list

GetColor ( float position ) : IColor

Returns the color at the specified position in the color gradient.

GetGradientPoints ( ) : IList

Returns a read-only IList{GradientPoint} wrapper for the current GradientPoint list.

GradientColor ( ) : System

Create an empty GradientColor

GradientColor ( IColor color ) : System

Create a new GradientColor with one color

GradientColor ( IColor start, IColor end ) : System

Create a new GradientColor betwwen start and end

Method Details

AddGradientPoint() public méthode

Adds a gradient point to this gradient object. No two gradient points have the same position. @throw System.ArgumentException if two control points have the same position. It does not matter which order these gradient points are added.
public AddGradientPoint ( GradientPoint point ) : void
point GradientPoint The gradient point to add
Résultat void

AddGradientPoint() public méthode

Adds a gradient point to this gradient object. No two gradient points have the same position. @throw System.ArgumentException if two control points have the same position. It does not matter which order these gradient points are added.
public AddGradientPoint ( float position, IColor color ) : void
position float The position of this gradient point
color IColor The color of this gradient point
Résultat void

Clear() public méthode

Deletes all the gradient points from this gradient object. All gradient points from this gradient object are deleted.
public Clear ( ) : void
Résultat void

CountGradientPoints() public méthode

Return the size of the GradientPoint list
public CountGradientPoints ( ) : int
Résultat int

GetColor() public méthode

Returns the color at the specified position in the color gradient.
public GetColor ( float position ) : IColor
position float The specified position
Résultat IColor

GetGradientPoints() public méthode

Returns a read-only IList{GradientPoint} wrapper for the current GradientPoint list.
public GetGradientPoints ( ) : IList
Résultat IList

GradientColor() public méthode

Create an empty GradientColor
public GradientColor ( ) : System
Résultat System

GradientColor() public méthode

Create a new GradientColor with one color
public GradientColor ( IColor color ) : System
color IColor color at position -1 and 1
Résultat System

GradientColor() public méthode

Create a new GradientColor betwwen start and end
public GradientColor ( IColor start, IColor end ) : System
start IColor The start color at position -1
end IColor The end color at position 1
Résultat System