ColorRamp

Description

sealed class Tinman.Terrain.Util.ColorRamp

Derived from

ColorRampBase abstract

This class represents a color ramp.

A color ramp consists of one or more color ramp slots; each slot holds an X-coordinate and a color value.

Public / Constants

Earth


[ShutdownSurvive]
public static readonly attribute Earth → (IColorRamp)

A color ramp for Earth with intuitive colors.

Use ellipsoid/geoid heights as input for the color ramp: -1000m .. 8000m.

Mars


[ShutdownSurvive]
public static readonly attribute Mars → (IColorRamp)

A rainbow color ramp for Mars.

Use areoid heights as input for the color ramp: -7500m .. 15000m.

Mask


[ShutdownSurvive]
public static readonly attribute Mask → (IColorRamp)

A simple mask shape.

To create an equivalent color ramp, call Shape, passing 0 to the first parameter and the default values to the remaining ones.

Moon


[ShutdownSurvive]
public static readonly attribute Moon → (IColorRamp)

A rainbow color ramp for the Moon.

Use reference sphere heights as input for the color ramp: -9000m .. 10000m.

Outline


[ShutdownSurvive]
public static readonly attribute Outline → (IColorRamp)

A simple outline shape.

To create an equivalent color ramp, call Shape, the default parameter values.

Planet


[ShutdownSurvive]
public static readonly attribute Planet → (IColorRamp)

A rainbow color ramp for a planet.

Use normalized heights as input for the color ramp: -1 .. +1.

Pluto


[ShutdownSurvive]
public static readonly attribute Pluto → (IColorRamp)

A rainbow color ramp for Pluto.

Use reference sphere heights as input for the color ramp: -3000m .. 4000m.

Public / Constructors

Color

2 overloads


public static method Color1 → (1)

color in : int64

The color ramp color.

returns → IColorRamp

The created ColorRamp.

Creates a color ramp with a single color.

The color is placed at the X-coordinate 0.0.


public static method Color2 → (4)

colorA in : int64

The first color ramp color.

colorB in : int64

The second color ramp color.

coordA opt : float64 = 0

Coordinate of colorA in.

coordB opt : float64 = 1

Coordinate of colorB in.

returns → IColorRamp

The created ColorRamp.

Creates a color ramp with two colors.

Color​Ramp

2 overloads


public constructor ColorRamp1 → ()

Creates a new instance of ColorRamp.


public constructor ColorRamp2 → (1)

initialCapacity in : int32

[>=0]
The initial capacity of the color ramp.

Creates a new instance of ColorRamp.

Rainbow


public static method Rainbow → (2)

minimum in : float64

The minimum input value of the color ramp. Will be mapped to violet/blue.

maximum in : float64

The maximum input value of the color ramp. Will be mapped to red/white.

returns → IColorRamp

The rainbow color ramp.

Creates a rainbow-like color ramp.

Shape


public static method Shape → (4)

thickness opt : float64 = 1

[>=0]
The thickness of the shape border. Set to 0 to remove the border.

border opt : int64 = Colors.Black & Colors.Opaque25

The color of the shape border. Set to 0 to remove the border.

fill opt : int64 = Colors.White

The fill color of the shape interior. Set to 0 to remove the interior fill.

epsilon opt : float64 = 1E-5

The small offset to use for the innermost and outermost colors of the ramp.

returns → IColorRamp

The created ColorRamp.

Creates a color ramp for drawing the interior and/or border of a shape.

Here are some common usage scenarios for this method:

  • ColorRamp.Shape()
    Draw the shape with a single pixel black border and white fill (good for debug / test).

  • ColorRamp.Shape(0)
    Draw the shape without border and white fill (good for modulation / clip masks).

  • ColorRamp.Shape(0,0,fill)
    Draw the shape without border and the given fill color.

  • ColorRamp.Shape(thickness,border,0)
    Draw the shape with a border of the given thickness and color, without fill.

The returned color ramps contains four colors:

 X      | Y
--------+--------
 -h - e | fill
 -h     | border
 +h     | border
 +h + e | empty

where h is half of thickness opt, e is epsilon opt and empty is the same color as border opt with its alpha channel set to zero.

Vertical


public static method Vertical → (2)

range in : VerticalRange

The vertical range, in the given unit opt.

unit opt : UnitOfMeasure = null

The vertical unit. If null, UnitOfMeasure.Metre is used.

returns → IColorRamp

The default color ramp, using vertical coordinates in unit opt as input.

Returns a default color ramp for the given vertical range.

Public / Methods

Add


public method Add → (2)

coordinate in : float64

Coordinate of color ramp slot.

color in : int64

Color value of color ramp slot (see Colors).

returns → ColorRamp

this

Adds a color on this color ramp.

The color ramp slots must be set so that the following condition is met:

x[i] >= x[i-1]

The X-coordinate of a color ramp slot must be greater than or equal to the X-coordinate of the preceding slot.

Set


public method Set → (3)

idx in : int32

[>=0]
Index of color ramp slot.

coordinate in : float64

Coordinate of color ramp slot.

color in : int64

Color value of color ramp slot (see Colors).

returns → ColorRamp

this

Sets a color on this color ramp.

The color ramp slots must be set so that the following condition is met:

x[i] >= x[i-1]

The X-coordinate of a color ramp slot must be greater than or equal to the X-coordinate of the preceding slot.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IColorRamp>

[not-null]
The configurator object.

The configurator object for this type.

Serialization

Serial​Id


public static readonly attribute SerialId → (ISerialTypeInfo)

Serialization information about this type.