Method EvaluateGradientColorAt
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
EvaluateGradientColorAt(float)
Gets the colour of the gradient at a value along it, as AutoCAD 2021's EvaluateGradientColorAt gives it (1 101
channels of 12 gradients, in steps of 1/100 and 1/32, were read from it and agree): the red, green and blue of its
colours (GetGradientColors()) taken in proportion between the two whose values the value lies between,
each cut down to a whole number (not rounded); before the first colour the first, past the last the last. Blue (0, 0,
255) at 0 to a pale yellow (255, 255, 153) at 1, AutoCAD's new gradient, is (127, 127, 204) at 0.5. A gradient of one
colour that holds only that colour (GradientOneColorMode) runs from it to its shade or tint by the
ShadeTintValue, placed at the end of the gradient away from the colour (at 1, or at 0 where the colour
stands past the middle): the colour's hue and saturation at the lightness the value is, so that red at 0.25 runs to
(128, 0, 0) and (100, 150, 50) at 0.75 to (191, 223, 159); a grey of 128 goes to black at 0 and white at 1. A gradient
that holds two colours runs between them in either mode; the second colour of one of one colour is made by setting
the tint (ShadeTintValue), as AutoCAD makes it. The colours are read from the HATCH each time and nothing
is changed.
public DxfColor EvaluateGradientColorAt(float value)
Parameters
valuefloatWhere along the gradient, from 0 at its start to 1 at its end.
Returns
- DxfColor
The colour, a true colour (IsByColor), a colour of the index given as its red, green and blue.
Exceptions
- ArgumentOutOfRangeException
Thrown when the value is not a finite number.
- InvalidOperationException
Thrown when the HATCH has no gradient data or its gradient no colour, or it is erased.