Home COM GDI+ WebBrowser Data Access 

LinearGradientBrush Functions (GDI+)

 

 

The LinearGradientBrush functions allow to paint a color gradient in which the color changes evenly from the starting boundary line of the linear gradient brush to the ending boundary line of the linear gradient brush. The boundary lines of a linear gradient brush are two parallel straight lines. The color gradient is perpendicular to the boundary lines of the linear gradient brush, changing gradually across the stroke from the starting boundary line to the ending boundary line. The color gradient has one color at the starting boundary line and another color at the ending boundary line.

 

Return Values

If the function succeeds, it returns Ok, which is an element of the Status enumeration.

 

If the function fails, it returns one of the other elements of the Status enumeration.

 

GdipCreateLineBrush

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrush(

    GDIPCONST GpPointF* point1,

    GDIPCONST GpPointF* point2,

    ARGB color1,

    ARGB color2,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrush ( _

    BYREF point1 AS PointF, _

    BYREF point2 AS PointF, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

point1

[in] Reference to a PointF object that specifies the starting point of the gradient. The starting boundary line passes through the starting point.

point2

[in] Reference to a PointF object that specifies the ending point of the gradient. The ending boundary line passes through the ending point.

color1

[in] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color object that specifies the color at the ending boundary line of this linear gradient brush.

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to a variable that receives a pointer to the new created LinearGradientBrush object.

 

GdipCreateLineBrushFromRect

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(

    GDIPCONST GpRectF* rect,

    ARGB color1,

    ARGB color2,

    LinearGradientMode mode,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrushFromRect ( _

    BYREF pRect AS RectF, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL mode AS LONG, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

rect

[in] Reference to a rectangle that specifies the starting and ending points of the gradient. The direction of the gradient, specified by mode, affects how these points are defined. The dimensions of the rectangle affect the direction of the gradient for forward diagonal mode and backward diagonal mode.

color1

[in] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color that specifies the color at the ending boundary line of this linear gradient brush.

mode

[in] Element of the LinearGradientMode enumeration that specifies the direction of the gradient.

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to a variable that receives a pointer to the new created LinearGradientBrush object.

 

GdipCreateLineBrushFromRectI

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(

    GDIPCONST GpRect* rect,

    ARGB color1,

    ARGB color2,

    LinearGradientMode mode,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrushFromRectI ( _

    BYREF pRect AS RectL, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL mode AS LONG, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

rect

[in] Reference to a rectangle that specifies the starting and ending points of the gradient. The direction of the gradient, specified by mode, affects how these points are defined. The dimensions of the rectangle affect the direction of the gradient for forward diagonal mode and backward diagonal mode.

color1

[in] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color that specifies the color at the ending boundary line of this linear gradient brush.

mode

[in] Element of the LinearGradientMode enumeration that specifies the direction of the gradient.

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to variable that receives a pointer to the new created LinearGradientBrush object.

 

GdipCreateLineBrushFromRectWithAngle

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(

    GDIPCONST GpRectF* rect,

    ARGB color1,

    ARGB color2,

    REAL angle,

    BOOL isAngleScalable,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrushFromRectWithAngle ( _

    BYREF pRect AS RectF, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL angle AS SINGLE, _

    BYVAL isAngleScalable AS LONG, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

rect

[in] 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] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color that specifies the color at the ending boundary line of this linear gradient brush.

angle

[in] Single precision value 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] 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.

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to a vaiable that receives a pointer to the new created LinearGradientBrush object.

 

GdipCreateLineBrushFromRectWithAngleI

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(

    GDIPCONST GpRect* rect,

    ARGB color1,

    ARGB color2,

    REAL angle,

    BOOL isAngleScalable,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrushFromRectWithAngleI ( _

    BYREF pRect AS RectL, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL angle AS SINGLE, _

    BYVAL isAngleScalable AS LONG, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

rect

[in] 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] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color that specifies the color at the ending boundary line of this linear gradient brush.

angle

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

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to a variable that receives a pointer to the new created LinearGradientBrush object.

 

GdipCreateLineBrushI

 

Description

Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

Syntax

GpStatus WINGDIPAPI GdipCreateLineBrushI(

    GDIPCONST GpPoint* point1,

    GDIPCONST GpPoint* point2,

    ARGB color1,

    ARGB color2,

    GpWrapMode wrapMode,

    GpLineGradient **lineGradient

);

PowerBASIC Syntax

DECLARE FUNCTION GdipCreateLineBrushI ( _

    BYREF point1 AS PointL, _

    BYREF point2 AS PointL, _

    BYVAL color1 AS DWORD, _

    BYVAL color2 AS DWORD, _

    BYVAL wrapMode AS LONG, _

    BYREF lineGradient AS DWORD _

) AS LONG

Parameters

 

point1

[in] Reference to a PointL object that specifies the starting point of the gradient. The starting boundary line passes through the starting point.

point2

[in] Reference to a PointL object that specifies the ending point of the gradient. The ending boundary line passes through the ending point.

color1

[in] ARGB color that specifies the color at the starting boundary line of this linear gradient brush.

color2

[in] ARGB color object that specifies the color at the ending boundary line of this linear gradient brush.

wrapMode

[in] A member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.

lineGradient

[out] Pointer to the new created LinearGradientBrush object.

 

GdipGetLineBlend

 

Description

Gets the blend factors and their corresponding blend positions from a LinearGradientBrush object.

Syntax

GpStatus WINGDIPAPI GdipGetLineBlend(

    GpLineGradient *brush,

    REAL *blend,

    REAL* positions,

    INT count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineBlend ( _

    BYVAL brush AS DWORD, _

    BYREF blend AS SINGLE, _

    BYREF positions AS SINGLE, _

    BYVAL count AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

blend

[out] Pointer to an array that receives the blend factors. Each number in the array indicates a percentage of the ending color and is in the range from 0.0 through 1.0.

positions

[out] Pointer to an array that receives the blend positions. Each number in the array indicates a percentage of the distance between the starting boundary and the ending boundary and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the gradient and 1.0 indicates the ending boundary. A blend position between 0.0 and 1.0 indicates a line, parallel to the boundary lines, that is a certain fraction of the distance from the starting boundary to the ending boundary. For example, a blend position of 0.7 indicates the line that is 70 percent of the distance from the starting boundary to the ending boundary. The color is constant on lines that are parallel to the boundary lines.

count

[in] Long integer value that specifies the number of blend factors to retrieve. Before calling the GdipGetLineBlend method of a LinearGradientBrush object, call the GdipGetLineBlendCount method of that same LinearGradientBrush object to determine the current number of blend factors. The number of blend positions retrieved is the same as the number of blend factors retrieved.

 

GdipGetLineBlendCount

 

Description

Gets the number of blend factors currently set for this LinearGradientBrush object.

Syntax

GpStatus WINGDIPAPI GdipGetLineBlendCount(

    GpLineGradient *brush,

    INT *count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineBlendCount ( _

    BYVAL brush AS DWORD, _

    BYREF count AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

count

[out] Pointer to a variable that receives the number of blend factors currently set for this LinearGradientBrush object. If no custom blend has been set by using GdipSetLineBlend, or if invalid positions were passed to GdipSetLineBlend, then GdipGeLinetBlend returns 1.

 

GdipGetLineColors

 

Description

Gets the the starting color and ending color of this linear gradient brush.

Syntax

GpStatus WINGDIPAPI GdipGetLineColors(

    GpLineGradient *brush,

    ARGB* colors

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineColors ( _

    BYVAL brush AS DWORD, _

    BYREF colors AS DWORD _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

colors

[out] Pointer to an array that receives the starting color and the ending color. The first color in the colors array is the color at the starting boundary line of the gradient; the second color in the colors array is the color at the ending boundary line.

 

GdipGetLineGammaCorrection

 

Description

Determines whether gamma correction is enabled for this LinearGradientBrush object.

Syntax

GpStatus WINGDIPAPI GdipGetLineGammaCorrection(

    GpLineGradient *brush,

    BOOL *useGammaCorrection

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineGammaCorrection ( _

    BYVAL brush AS DWORD, _

    BYREF useGammaCorrection AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

useGammaCorrection

[out] Pointer to a variable that receives a boolean value indicating if gamma correction is enabled /TRUE) or not (FALSE).

 

GdipGetLinePresetBlend

 

Description

Gets the colors currently set to be interpolated for this linear gradient brush and their corresponding blend positions.

Syntax

GpStatus WINGDIPAPI GdipGetLinePresetBlend(

    GpLineGradient *brush,

    ARGB *blend,

    REAL* positions,

    INT count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLinePresetBlend ( _

    BYVAL brush AS DWORD, _

    BYREF blend AS DWORD, _

    BYREF positions AS SINGLE, _

    BYVAL count AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

blend

[out] Pointer to an array that receives the colors. A color of a given index in the blend array corresponds to the blend position of that same index in the positions array.

positions

[out] Pointer to an array that receives the blend positions. Each number in the array indicates a percentage of the distance between the starting boundary and the ending boundary and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the gradient and 1.0 indicates the ending boundary. A blend position between 0.0 and 1.0 indicates a line, parallel to the boundary lines, that is a certain fraction of the distance from the starting boundary to the ending boundary. For example, a blend position of 0.7 indicates the line that is 70 percent of the distance from the starting boundary to the ending boundary. The color is constant on lines that are parallel to the boundary lines.

count

[in] Long integer value that specifies the number of elements in the blend array. This is the same as the number of elements in the positions array. Before calling the  GdipGetLinePresetBlend function, call the GdipGetLinePresetBlendCount function to determine the current number of colors. The number of blend positions retrieved is the same as the number of colors retrieved.

Return Value

If the function succeeds, it returns Ok, which is an element of the Status enumeration.

 

If the function fails, it returns one of the other elements of the Status enumeration.

 

GdipGetLinePresetBlendCount

 

Description

Gets the number of colors currently set to be interpolated for this linear gradient brush.

Syntax

GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(

    GpLineGradient *brush,

    INT *count

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLinePresetBlendCount ( _

    BYVAL brush AS DWORD, _

    BYREF count AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

count

[out] Pointer to a variable that receives the number of colors to be interpolated for this linear gradient brush. If no colors have been set by using GdipSetLinePresetBlend, or if invalid positions were passed to GdipSetLinePresetBlend, then GdipGetLinePresetBlendCount returns 0.

 

GdipGetLineRect

 

Description

Gets the rectangle that defines the boundaries of the gradient.

Syntax

GpStatus WINGDIPAPI GdipGetLineRect(

    GpLineGradient *brush,

    GpRectF *rect

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineRect ( _

    BYVAL brush AS DWORD, _

    BYREF pRect AS RectF _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

rect

[out] Pointer to a RectF object that receives the rectangle that defines the boundaries of the gradient. For example, if a linear gradient brush is constructed with a starting point at (20.2, 50.8) and an ending point at (60.5, 110.0), then the defining rectangle has its upper-left point at (20.2, 50.8), a width of 40.3, and a height of 59.2.

 

GdipGetLineRectI

 

Description

Gets the rectangle that defines the boundaries of the gradient.

Syntax

GpStatus WINGDIPAPI GdipGetLineRectI(

    GpLineGradient *brush,

    GpRect *rect

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineRectI ( _

    BYVAL brush AS DWORD, _

    BYREF pRect AS RectL _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

rect

[out] Pointer to a RectL object that receives the rectangle that defines the boundaries of the gradient. For example, if a linear gradient brush is constructed with a starting point at (20, 50) and an ending point at (60, 110), then the defining rectangle has its upper-left point at (20, 50), a width of 40, and a height of 60.

 

GdipGetLineTransform

 

Description

Gets the transformation matrix of this linear gradient brush.

Syntax

GpStatus WINGDIPAPI GdipGetLineTransform(

    GpLineGradient *brush,

    GpMatrix *matrix

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineTransform ( _

    BYVAL brush AS DWORD, _

    BYREF matrix AS DWORD _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

matrix

[out] Pointer to a variable that receives the transformation matrix.

 

GdipGetLineWrapMode

 

Description

Gets the wrap mode for this brush. The wrap mode determines how an area is tiled when it is painted with a brush.

Syntax

GpStatus WINGDIPAPI GdipGetLineWrapMode(

    GpLineGradient *brush,

    GpWrapMode *wrapmode

);

PowerBASIC Syntax

DECLARE FUNCTION GdipGetLineWrapMode ( _

    BYVAL brush AS DWORD, _

    BYREF wrapMode AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

wrapMode

[out] Pointer to a variable that receives one of the following elements of the WrapMode enumeration:

  • WrapModeTile

  • WrapModeTileFlipX

  • WrapModeTileFlipY

  • WrapModeTileFlipXY

 

GdipMultiplyLineTransform

 

Description

Updates this brush's transformation matrix with the product of itself and another matrix.

Syntax

GpStatus WINGDIPAPI GdipMultiplyLineTransform(

    GpLineGradient* brush,

    GDIPCONST GpMatrix *matrix,

    GpMatrixOrder order

);

PowerBASIC Syntax

DECLARE FUNCTION GdipMultiplyLineTransform ( _

    BYVAL brush AS DWORD, _

    BYVAL matrix AS DWORD, _

    BYVAL order AS LONG _

) AS LONG

Parameters

 

brush

[in] Pointer to the LinearGradientBrush object.

matrix

[in] Pointer to a matrix to be multiplied by the brush's current transformation matrix.

order

[in] Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the passed matrix is on the left, and MatrixOrderAppend specifies that the passed matrix is on the right. The default value is MatrixOrderPrepend.

 

GdipResetLineTransform

 

Description