GH_Gradient

References
public class GH_Gradient : GH_ISerializable, IGradient
Represents a colour gradient defined by a succession of grips.

Constructors

GH_Gradient

#
public GH_Gradient()

GH_Gradient

#
Create a duplicate of another gradient.
public GH_Gradient(
GH_Gradient
other
Gradient to duplicate.
)

GH_Gradient

#
Create a new gradient from grips and colours.
public GH_Gradient(
parameters,
Grip locations.
IEnumerable<Color>
colours
Colours for each grip.
)

Properties

GripCount

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

Linear

#
Gets or sets whether the colours are interpolated linearly between grips.
public bool Linear { get; set; }

Locked

#
Gets or sets whether this gradient is locked. A locked gradient cannot be modified by the user.
public bool Locked { get; set; }

SelectedGrip

#
Gets or sets the selected grip.
public GH_Grip SelectedGrip { get; set; }

Indexers

Grip

#
Gets or sets the grip at the given index.
public GH_Grip this[
index
Index of grip to retrieve.
] { get; set; }
The grip at the given index.

Methods

Explicit

IGradient.AddCurrentAsPreset

#
Adds a copy of this gradient to the shared Grasshopper preset collection.
void AddCurrentAsPreset()

AddGrip

#
Add a new single-colour grip.
public GH_Grip AddGrip(
t,
Parameter for grip.
Color
c
Colour of grip.
)

AddGrip

#
Add a new bi-colour grip.
public GH_Grip AddGrip(
t,
Parameter for grip.
Color
c0,
Left colour of grip.
Color
c1
Right colour of grip.
)

AddGrip

#
Add a new grip to the gradient. The colour of the grip will be picked so that there is no difference to the gradient, though this is not actually possible when the interpolation mode is not linear.
public GH_Grip AddGrip(
t
Grip parameter.
)

AddGrip

#
Add a new grip to the gradient. This method does not raise the GradientChanged event, so you need to do that yourself by calling OnGradientChanged().
public void AddGrip(
grip
Grip to add.
)

ColourAt

#
Evaluate the colour at a specific parameter.
public Color ColourAt(
t
Parameter to evaluate.
)
The colour at the given parameter.

DeleteGripRegion

#
Gets the Delete Grip region rectangle based on a gradient destination rectangle.
public static RectangleF DeleteGripRegion(
destination
Gradient destination rectangle.
)
Explicit

IGradient.DeletePreset

#
Removes the preset at the given index from the shared Grasshopper preset collection.
void DeletePreset(
index
)

DisplayGradientEditor

#
public void DisplayGradientEditor()

DisplayGripColourPicker

#
public void DisplayGripColourPicker(
grip
)
Explicit

IGradient.DrawToGraphics

#
void DrawToGraphics()

EarthlyBrown

#
public static GH_Gradient EarthlyBrown()

Forest

#
public static GH_Gradient Forest()
Explicit

IGradient.GetColorStops

#
ColorStop[] GetColorStops()
Explicit

IGradient.GetPresets

#
Returns the shared Grasshopper gradient presets as color stop collections. Reads the same [grasshopper_gradients] settings database used by the Gradient component.
ColorStop[][] GetPresets()

GreyScale

#
public static GH_Gradient GreyScale()

Heat

#
public static GH_Gradient Heat()

MouseDown

#
Begin grip drag operation.
public bool MouseDown(
dest,
Destination rectangle of the gradient.
PointF
pt
Mouse position in destination coordinates.
)
True if a grip drag was started, false otherwise.

MouseDragAbort

#
Abort grip drag.
public bool MouseDragAbort()

MouseMove

#
Continue grip dragging operation.
public bool MouseMove(
dest,
Destination rectangle of gradient.
PointF
pt
Mouse position in destination coordinates.
)
True if a grip position was changed, false otherwise. Redraws are only required on TRUE.

MouseUp

#
Terminate grip drag.
public bool MouseUp(
dest,
Destination rectangle of gradient
PointF
pt,
Mouse location in destination coordinates
deselect
)

NearestGrip

#
Find the nearest grip to a parameter.
public int NearestGrip(
t,
Parameter to search from.
side
Side to search.
)
The grip nearest to the parameter.

NearestGrip

#
Find the nearest grip to a parameter.
public int NearestGrip(
t
Parameter to search from.
)
The grip nearest to the parameter.

NearestGrip

#
Find the nearest grip in screen coordinates.
public int NearestGrip(
dest,
Retangle that contains the entire gradient.
PointF
pt,
Point to search from.
maxRadius
Maximum distance between point and grip.
)
The grip closest to the point.

NewGripRegion

#
Gets the new Grip region rectangle based on a gradient destination rectangle.
public static RectangleF NewGripRegion(
destination
Gradient destination rectangle.
)

NormalizeGrips

#
Normalize all grips. This will scale all grip parameters so that the full gradient extend equals 0~1.
public void NormalizeGrips()

OnGradientChanged

#
Raise the GradientChanged event.
public void OnGradientChanged()

OnGradientChangedIntermediate

#
Raise the GradientChanged event.
public void OnGradientChangedIntermediate()

OnSelectionChanged

#
Raise the SelectionChanged event.
public void OnSelectionChanged()

Read

#
public bool Read(
reader
)
Read

RemoveGrip

#
Remove the specified grip.
public void RemoveGrip(
grip
Grip to remove.
)

RemoveGrip

#
Remove the grip at the specified index.
public void RemoveGrip(
index
Index of grip to remove.
)

Render_Background

#
public void Render_Background()

Render_Gradient

#
public void Render_Gradient()

Render_Grips

#
public void Render_Grips()
Explicit

IGradient.RhinoUiMouseDown

#
bool RhinoUiMouseDown(
dest,
PointF
pt
)
Explicit

IGradient.SetColorStops

#
void SetColorStops()
Explicit

IGradient.SetDefault

#
Stores the given color stops as the shared Grasshopper default gradient.
void SetDefault()

SoGay

#
public static GH_Gradient SoGay()

Spectrum

#
public static GH_Gradient Spectrum()

Traffic

#
public static GH_Gradient Traffic()

Write

#
public bool Write(
writer
)
Write

Zebra

#
public static GH_Gradient Zebra()

Events

GradientChanged

#
public event GH_Gradient.GradientChangedEventHandler GradientChanged
Explicit

IGradient.RhinoUiGradientChanged

#
event EventHandler RhinoUiGradientChanged
Explicit

IGradient.RhinoUiSelectionChanged

#
event EventHandler RhinoUiSelectionChanged

SelectionChanged

#
public event GH_Gradient.SelectionChangedEventHandler SelectionChanged