OEDrawColorGradient¶
void OEDrawColorGradient(OEDepict::OEImageBase &image,
const OESystem::OEColorGradientBase &colorg)
void OEDrawColorGradient(OEDepict::OEImageBase &image,
const OESystem::OEColorGradientBase &colorg,
const OEColorGradientDisplayOptions &opts)
Draws a color gradient.
- image
The image on which the color gradient is drawn.
- colorg
The color gradient being drawn.
- opts
The OEColorGradientDisplayOptions object that stores the parameters that determine how the color gradient is drawn.
The following code snippet shows how to use the OEDrawColorGradient
function. The image created is shown in
Figure: Example of using the OEDrawColorGradient function.
OELinearColorGradient colorg = new OELinearColorGradient();
colorg.AddStop(new OEColorStop( 0.0, oechem.getOEYellow()));
colorg.AddStop(new OEColorStop(+1.0, oechem.getOEOrange()));
colorg.AddStop(new OEColorStop(-1.0, oechem.getOEGreen()));
OEImage image = new OEImage(400, 100);
oegrapheme.OEDrawColorGradient(image, colorg);
oedepict.OEWriteImage("DrawColorGradient.png", image);
The orientation (i.e., whether the color gradient is rendered vertically or horizontally) depends on the width and height of the OEImageBase object. If the width is greater than the height, then the color gradient is drawn horizontally; otherwise it is rendered vertically . See examples in Figure: Example of rendering the same color gradient into different dimensions.
The OEDrawColorGradient
function can depict any color gradient
derived from the OEColorGradientBase base class.
See examples in Figure: Example of rendering various color gradients.
See also
OEColorGradientBase base class
OELinearColorGradient, OEExponentialColorGradient, OELogarithmicColorGradient, and OEExponentColorGradient concrete classes