OEColorGradientBase
class OEColorGradientBase
OEColorGradientBase is an abstract class used for interpolating between colors that are defined by using the OEColorStop class.
- The following classes derive from this class:
Constructors
OEColorGradientBase()
Default constructor that creates an “empty” color gradient.
Note
An “empty” color gradient always returns the OEBlack
color, when calling the OEColorGradientBase.GetColorAt,
the OEColorGradientBase.GetMinColor or
the OEColorGradientBase.GetMaxColor methods.
OEColorGradientBase(const OEColorStop& oneStop)
Creates an OEColorGradientBase object with
one color stop. An OEColorGradientBase
object that has only one color stop will always return that
color when calling the
OEColorGradientBase.GetColorAt method.
OEColorGradientBase(const OEColorStop& bgnStop,
const OEColorStop& endStop)
Creates an OEColorGradientBase object with interpolation range between the two specified color stops.
OEColorGradientBase(const OEColorGradientBase& rhs)
Copy constructor.
AddStop
AddStop(stop: OEColorStop) -> bool
Add a new color stop to the color gradient.
DeleteStop
DeleteStop(stopidx: int) -> bool
Deletes the color stop at idx and returns true. If the
color gradient only has one color stop or the idx is
not between 0 and
NumStops(),
then OEColorGradientBase.DeleteStop
throws a warning and returns false.
GetColorAt
GetColorAt(value: float) -> OEColor
Returns the interpolated color at value defined by
the color stops in the color gradient.
Returns OEColorGradientBase.GetMinColor
if the value is less than
OEColorGradientBase.GetMinValue.
Returns OEColorGradientBase.GetMaxColor
if the value is greater than
OEColorGradientBase.GetMinValue.
GetMaxColor
GetMaxColor() -> OEColor
Returns the color associated with the value returned by the
OEColorGradientBase.GetMaxValue
method.
GetMaxValue
GetMaxValue() -> float
Returns the highest value stored in any of the color stops of the color gradient.
GetMinColor
GetMinColor() -> OEColor
Returns the color associated with the value returned by the
OEColorGradientBase.GetMinValue method.
GetMinValue
GetMinValue() -> float
Returns the lowest value stored in any of the color stops of the color gradient.
GetStops
GetStops() -> Iterable[OEColorStop]
Returns an iterator over all color stops of the color gradient. The iterator is invariant to further modifications of the OEColorGradientBase object.
IsEmpty
IsEmpty() -> bool
Returns true if no color stop has been added to the
OEColorGradientBase object that has been
created by the default constructor, otherwise it returns false.
NumStops
NumStops() -> int
Returns the number of color stops of the color gradient.
TransformValue
TransformValue(value: float) -> float
This is a virtual const method that is implemented in the concrete
color gradient derived classes.
This method is called by OEColorGradientBase.GetColorAt
method to transform a value before performing color interpolation.