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(OEColorStop(0.0, OEYellow));
colorg.AddStop(OEColorStop(+1.0, OEOrange));
colorg.AddStop(OEColorStop(-1.0, OEGreen));

OEImage image(400u, 100u);
OEDrawColorGradient(image, colorg);
OEWriteImage("DrawColorGradient.png", image);
../../_images/DrawColorGradient.png

Example of using the OEDrawColorGradient function

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.

../../_images/OEDrawColorGradient_Orientation.png

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.

../../_images/OEDrawColorGradient_NonLinear.png

Example of rendering various color gradients