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.
The following code snippet shows how to use the OEDrawColorGradient function. The image created is shown in Figure: Example of using the OEDrawColorGradient function.
colorg = oechem.OELinearColorGradient(oechem.OEColorStop(0.0, oechem.OEYellow))
colorg.AddStop(oechem.OEColorStop(+1.0, oechem.OEOrange))
colorg.AddStop(oechem.OEColorStop(-1.0, oechem.OEGreen))
image = oedepict.OEImage(400, 100)
oegrapheme.OEDrawColorGradient(image, colorg)
oedepict.OEWriteImage("DrawColorGradient.png", image)
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.
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.
Example of rendering various color gradients
See also