TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IColorRamp in Tinman.Terrain.Util

Base interface for classes that provide a color ramp.

interface IColorRamp extends IConfigurable
  IEquatable<IColorRamp>
  ISerializable
  base of ColorRampBase

Remarks

A color ramp has zero or more color slots, where each slot has an input coordinate and an associated color value.

Attributes

Range

Returns the coordinate range of this color ramp.

property Range { get }
type RangeD
value The coordinate range.

SerialType

Returns the serial type of this object.

property SerialType { get }
type ISerialTypeInfo
value [not-null] The serial type.
inherited ISerializable.SerialType

SerialVersion

Returns the serial data version.

property SerialVersion { get }
type int32
value [>=1] The serial data version tag.
inherited ISerializable.SerialVersion

Remarks:

An ISerializable implementation is required to support all versions up to the one returned by SerialVersion.

See also:

ISerializable.Serialize
ISerializable.Deserialize

Extensions

ToColorBuffer

Converts this color ramp into a color buffer with a height of one.

method ToColorBuffer (int32 n = 256)
type ColorBuffer
params n [>0] The number of palette colors. Defaults to 256.
returns [not-null] The created color buffer.

See also:

Range

Converts this color ramp into a color buffer with a height of one.

method ToColorBuffer (float64 x1, float64 x2, int32 n = 256)
type ColorBuffer
params x1 X-coordinate of first palette color.
  x2 X-coordinate of last palette color.
  n [>0] The number of palette colors. Defaults to 256.
returns [not-null] The created color buffer.

ToColorPalette

Converts this color ramp into a color palette.

method ToColorPalette (int32 n = 256)
type int64[]
params n [>0] The number of palette colors. Defaults to 256.
returns [not-null] The created color palette.

See also:

Range

Converts this color ramp into a color palette.

method ToColorPalette (float64 x1, float64 x2, int32 n = 256)
type int64[]
params x1 X-coordinate of first palette color.
  x2 X-coordinate of last palette color.
  n [>0] The number of palette colors. Defaults to 256.
returns [not-null] The created color palette.

Methods

Deserialize

Initializes the state of this object from the given data stream.

method Deserialize (int32 serialVersion, ISerializer data)
type ISerializable
params serialVersion [>=1] The serial data version.
  data [not-null] The serial data stream.
returns [not-null] The deserialized object. This will typically be this, but in some circumstances, another instance may be returned (e.g. singletons).
inherited ISerializable.Deserialize

Remarks:

The Deserialize method will be called immediately after the object has been instantiated via its default constructor.

The provided serialVersion number is guaranteed to be equal to or less than the SerialVersion returned by this object (i.e. ISerializable object must provide backwards compatibility).

See also:

ISerializable.Serialize
ISerializable.SerialVersion

Exceptions:

Equals

Compares this object with the given one.

[Pure]
method Equals (IColorRamp other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
inherited IEquatable.Equals

Get

Returns an interpolated color on this color ramp.

method Get (float64 x)
type int64
params x Coordinate of color to return.
returns The color value.

Index

Returns a color index on this color ramp.

method Index (float64 x)
type float64
params x Coordinate of color to return.
returns The color index.

Modulate

Modulates the colors in this color ramp.

method Modulate (int64 color)
type IColorRamp
params color The color to modulate with.
returns [not-null] The resulting color ramp.

Serialize

Serializes the current state of this object to the given data stream.

method Serialize (ISerializer data)
params data [not-null] The serial data stream.
inherited ISerializable.Serialize

See also:

ISerializable.Deserialize
ISerializable.SerialVersion

Exceptions:

ToConfig

Returns the configuration value that describes this object.

method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
inherited IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Exceptions:

Transform

Transforms the input coordinate of this color ramp.

method Transform (float64 offset, float64 scale = 1)
type IColorRamp
params offset Offset value to add to scaled input X-coordinates.
  scale Scale factor to apply to input X-coordinates. Defaults to 1.
returns [not-null] The resulting color ramp.

Remarks:

Input X-coordinates are transformed as follows:

xOut = offset + scale * xIn
xIn  = (xOut - offset) / scale
     = xOut / scale - offset / scale
where xIn refers to the coordinate passed to the returned color ramp and xOut is the coordinate that is passed to this color ramp.