LinearGradientBrush.LinearGradientBrush(const Rect, const Color, const Color, REAL, BOOL) constructor

Applies to: desktop apps only

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

Syntax

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

Parameters

  • rect [in, ref]
    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.

  • color1 [in, ref]
    Type: const Color

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

  • color2 [in, ref]
    Type: const Color

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

  • angle [in]
    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.

  • isAngleScalable [in]
    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.

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

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusbrush.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

LinearGradientBrush

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012