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.
operator=
OEColorGradientBase &operator=(const OEColorGradientBase &rhs)
Assignment operator.
AddStop
bool AddStop(const OEColorStop &stop)
Add a new color stop to the color gradient.
DeleteStop
bool DeleteStop(unsigned int stopidx)
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
OEColor GetColorAt(double value) const
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
const OEColor &GetMaxColor() const
Returns the color associated with the value returned by the
OEColorGradientBase::GetMaxValue
method.
GetMaxValue
double GetMaxValue() const
Returns the highest value stored in any of the color stops of the color gradient.
GetMinColor
const OEColor &GetMinColor() const
Returns the color associated with the value returned by the
OEColorGradientBase::GetMinValue method.
GetMinValue
double GetMinValue() const
Returns the lowest value stored in any of the color stops of the color gradient.
GetStops
OEIterBase<OEColorStop> *GetStops() const
Returns an iterator over all color stops of the color gradient. The iterator is invariant to further modifications of the OEColorGradientBase object.
IsEmpty
bool IsEmpty() const
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
unsigned int NumStops() const
Returns the number of color stops of the color gradient.
TransformValue
double TransformValue(double value) const =0
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.