GripGradient

GradientReferences
[IoId("00000000-078F-4D74-9913-1149129256C2")] public sealed class GripGradient : Gradient, IEquatable<GripGradient>
A one dimensional colour gradient based on positional grips.

Constructors

GripGradient

#
public GripGradient(IReader reader)
Deserialization constructor.
reader (IReader)Reader to deserialize from.

GripGradient

#
public GripGradient(Progression progression, Space3 space, IEnumerable<double> parameters, IEnumerable<Color> colours)
Create a new gradient from parameters and colours.
progression (Progression)Interpolation for this gradient.
space (Space3)Colour space for gradient.
parameters (IEnumerable<double>)Grip parameters.
colours (IEnumerable<Color>)Grip colours.

GripGradient

#
public GripGradient(Progression progression, Space3 space, params GradientGrip[] grips)
Create a new gradient from grips.
progression (Progression)Interpolation for this gradient.
space (Space3)Colour space for gradient.
grips (params GradientGrip[])Grips for this gradient.

Properties

ApparentDomain

public (double lower, double upper) ApparentDomain { get; }
Gets the domain based on the Gradient.Mapping of this gradient. Note that this domain may be decreasing.
inherited fromGradient

GripCount

#
public int GripCount { get; }
Gets the number of grips in this gradient.

Interaction

#
public override GripGradientInteraction Interaction { get; }
Gets a user interaction object based on this gradient. Not all gradient types will have interaction objects.

IntrinsicDomain

#
public override (double lower, double upper) IntrinsicDomain { get; }
Gets the interval containing the defined interior of this gradient. Note that this refers to the mathematics underlying the gradient, the Gradient.ApparentDomain encodes the publicly facing domain of this gradient.

Mapping

public GradientMapping Mapping { get; }
Gets the mapping from sampling space to gradient space.
inherited fromGradient

Progression

#
public Progression Progression { get; }
Interpolation to use for this gradient.

Space

#
public Space3 Space { get; }
Gets the colour space this gradient is defined in.

Indexers

this[]

#
public GradientGrip this[Guid id] { get; }
Gets the grip with the specified id.
id (Guid)Id to search for.
Grip with specified id or null.

this[]

#
public GradientGrip this[int index] { get; }
Gets the grip at the specified index.
index (int)Index of grip to retrieve.

Methods

ColourAt

public bool ColourAt(double parameter, out Colour colour)
Gets the exact colour at the given parameter.
inherited fromGradient
parameter (double)Evaluation parameter.
colour (out Colour)Colour result.
True if the parameter is a valid one.

ColourAt

public Color ColourAt(double parameter)
Gets the colour at the given parameter.
inherited fromGradient
parameter (double)Evaluation parameter.
True if the parameter is a valid one.

ColourAtInternal

#
protected override Colour ColourAtInternal(double gradientParameter)
Sample the gradient at the given gradient parameter.
gradientParameter (double)Parameter.
Colour at parameter or null if gradient is undefined.

CreateTextureCache

protected virtual Gradient.GradientTexture CreateTextureCache()
Create a texture cache object for displaying this texture in the UI. The width of the texture bitmap ought to be decided by the callee.
inherited fromGradient

Draw

#
public override void Draw(Graphics graphics, RectangleF rectangle, double parameter0, double parameter1)
Draw this gradient as a horizontal progression. This method is optimized for speed and may not necessarily yield the exact result.
graphics (Graphics)Graphics object to draw with.
rectangle (RectangleF)Rectangle to fill.
parameter0 (double)
parameter1 (double)
Gradient.Draw

Draw

public void Draw(Graphics graphics, RectangleF rectangle)
Draw this gradient as a horizontal progression. This method is optimized for speed and may not necessarily yield the exact result.
inherited fromGradient
graphics (Graphics)Graphics object to draw with.
rectangle (RectangleF)Rectangle to fill.

Equals

#
public bool Equals(GripGradient other)
other (GripGradient)

Equals

#
public override bool Equals(object obj)
obj (object)
Object.Equals

EqualsMapped

#
public bool EqualsMapped(GripGradient other)
other (GripGradient)

GetHashCode

#
public override int GetHashCode()

InsertGrip

#
public GripGradient InsertGrip(double parameter)
Insert a grip at a specific parameter.
parameter (double)Parameter at which to insert the grip.
New gradient with inserted grip.

InsertGrip

#
public GripGradient InsertGrip(GradientGrip grip)
Insert a grip into the gradient.
grip (GradientGrip)

Interpolators

#
public Function[] Interpolators()
Gets the interpolation functions (3 colour channels and 1 alpha channel).

IsConstant

public bool IsConstant(out Colour colour)
Tests whether this gradient has a zero-length domain and whether the colours on either side are identical.
inherited fromGradient
colour (out Colour)Colour inside domain.
True if gradient only has a single colour.

NormaliseMapping

#
public GripGradient NormaliseMapping()
Adjust the grips so that the IntrinsicDomain matches the Gradient.ApparentDomain and the Gradient.Mapping becomes identity.

Remap

public Gradient Remap(double t0, double t1)
Create a new gradient which is similar to this gradient but remapped to a different interval.
inherited fromGradient
t0 (double)New gradient lower limit.
t1 (double)New gradient upper limit.
Mapped gradient.

Remap

#
public override Gradient Remap(GradientMapping mapping)
Create a new gradient which is similar to this gradient but remapped to a different interval.
mapping (GradientMapping)
Mapped gradient.
Gradient.Remap

RemapAutomatic

public Gradient RemapAutomatic(double lower, double upper)
Remap this gradient to a new domain if the mapping has automatic lower or upper bounds.
inherited fromGradient
lower (double)
upper (double)

RemoveGrip

#
public GripGradient RemoveGrip(int index)
Remove the grip at the given index.
index (int)Index of grip to remove.
New gradient with removed grip.

ReplaceGrip

#
public GripGradient ReplaceGrip(int index, GradientGrip newGrip)
Create a new gradient by replacing a grip.
index (int)Index of grip to replace.
newGrip (GradientGrip)New grip.
Gradient with updated grip.

Store

#
public override void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
writer (IWriter)Writer object to serialize with.
Gradient.Store

SurroundingGrips

#
public void SurroundingGrips(double parameter, out GradientGrip left, out GradientGrip right)
Gets the grips on either side of a parameter.
parameter (double)Parameter.
left (out GradientGrip)Grip to the left of or exactly at the parameter.
right (out GradientGrip)Grip to the right of the parameter.

ToBitmap

public Bitmap ToBitmap(int width, int height, double lower, double upper)
Render this gradient to a bitmap using exact per-pixel colours.
inherited fromGradient
width (int)Bitmap width.
height (int)Bitmap height.
lower (double)Gradient parameter at left edge of bitmap.
upper (double)Gradient parameter at right edge of bitmap.
Bitmap.

ToBitmap

public Bitmap ToBitmap(int width, int height)
Render this gradient to a bitmap.
inherited fromGradient
width (int)Bitmap width.
height (int)Bitmap height.
Bitmap.

ToGripArray

#
public GradientGrip[] ToGripArray()
Create a duplicate of the internal grip array.
Grip array.

ToString

#
public override string ToString()
Returns a string that represents the current object.
A string that represents the current object.
Object.ToString

WithAutomaticLimits

public Gradient WithAutomaticLimits(bool autoLower = true, bool autoUpper = true)
Adjust the automatic bounds flags for this gradient.
inherited fromGradient
autoLower (bool = true)
autoUpper (bool = true)

WithContinuousGrips

#
public GripGradient WithContinuousGrips()
Convert all discontinuous grips into continuous grips.
Modified gradient.

WithInterpolation

#
public GripGradient WithInterpolation(Progression interpolation)
Change the interpolation on this gradient.
interpolation (Progression)New interpolation.
Adjusted gradient.

WithSpace

#
public GripGradient WithSpace(Space3 space)
Change the colour space on this gradient.
space (Space3)New space.
Adjusted gradient.