LinearGradientBrush::LinearGradientBrush(constRect&,constColor&,constColor&,REAL,BOOL) method (gdiplusbrush.h)

Creates a LinearGradientBrush::LinearGradientBrush object from a rectangle and angle of direction.

Syntax

void LinearGradientBrush(
  [in, ref] const Rect &  rect,
  [in, ref] const Color & color1,
  [in, ref] const Color & color2,
  [in]      REAL          angle,
  [in]      BOOL          isAngleScalable
);

Parameters

[in, ref] rect

Type: const Rect

Reference to a rectangle that specifies the starting and ending points of the gradient. The upper-left corner of the rectangle is the starting point. The lower-right corner is the ending point.

[in, ref] color1

Type: const Color

Reference to a Color object that specifies the color at the starting boundary line of this linear gradient brush.

[in, ref] color2

Type: const Color

Reference to a Color object that specifies the color at the ending boundary line of this linear gradient brush.

[in] angle

Type: REAL

Real number that, if isAngleScalable is TRUE, specifies the base angle from which the angle of the directional line is calculated, or that, if isAngleScalable is FALSE, specifies the angle of the directional line. The angle is measured from the top of the rectangle that is specified by rect and must be in degrees. The gradient follows the directional line.

[in] isAngleScalable

Type: BOOL

Boolean value that specifies whether the angle is scalable. If isAngleScalable is TRUE, the angle of the directional line is scalable; otherwise, the angle is not scalable.

Return value

None

Remarks

The "directional line," an imaginary straight line, is defined by the starting point (upper-left corner of the rectangle rect) and the angle angle. The starting boundary of the gradient is a straight line that is perpendicular to the directional line and that passes through the starting point. The ending boundary of the gradient is a straight line that is parallel to the starting boundary line and that passes through the ending point (lower-right corner of the rectangle rect). The gradient color is constant along lines that are parallel to the boundary lines. The gradient gradually changes from the starting color to the ending color along the directional line.

If isAngleScalable is TRUE, the base angle is scaled to produce the angle of the directional line:

ß = arctan( (width / height) tan(ø) )

where ß is the new angle of the directional line; width and height are the dimensions of the rectangle rect; and ø is the base angle angle. This relationship is valid only if angle is less than 90 degrees.

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusbrush.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

LinearGradientBrush