ChartDirector 7.1 (C++ Edition)

DrawArea.angleGradientColor


Usage

int angleGradientColor(double cx, double cy, double a1, double a2, double r1, double r2, IntArray colorArray);

Description

Creates an angle gradient color.

An angle gradient color is a color that depends on the compass bearing of the pixel relative to the center point. The north (upward) direction is zero degree, and the angle is the clockwise angle from the north direction.

ChartDirector supports "smooth angle gradient" and "step angle gradient". For a smooth angle gradient, the color changes smoothly from one color stop to the next color stop. For a step angle gradient, the color remains unchanged between the color stops, but change abruptly once it reaches the next color stop.

The color stops are defined as an array of offsets and colors. For a smooth angle gradient, the offsets and colors should be in the following format:

offset0, color0, offset1, color1, .... offsetN, colorN

The first offset (offset0) should be 0, which represents the start angle of the gradient, and color0 is the color at that offset. The last offset (offsetN) can be any number not greater than 100000. It represents the end angle of the gradient, and colorN represents the color at the that offset. The other offsets and colors represent the angles and colors of the color stops in between.

For a step angle gradient, the offsets and colors should be in the following format:

offset0, color0, offset1, color1, ...., offsetP, colorP, offsetN

Note that for a step color gradient, there is one more offset than colors. If there are 10 color steps, it will have 10 colors and 11 offsets. The offsets represent angles and are interpreted the same as in smooth angle gradient. The colors are applied between the offsets. For example, color0 is the color between offset0 and offset1, and color1 is the color between offset1 and offset2.

Arguments

ArgumentDefaultDescription
cx(Mandatory)The x coordinate of the center point.
cy(Mandatory)The y coordinate of the center point.
a1(Mandatory)The start angle of the gradient.
a2(Mandatory)The end angle of the gradient.
r1(Mandatory)The minimum radius for which the gradient is applicable.
r2(Mandatory)The maximum radius for which the gradient is applicable.
colorArray(Mandatory)An array defining the offsets and colors of the color stops along the gradient.

Return Value

A 32-bit integer representing the angle gradient color.