LinearGradientBrush Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the LinearGradientBrush C++ class.

LinearGradientBrush Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* point1, GDIPCONST GpPointF* point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const PointF& point1, IN const PointF& point2, IN const Color& color1, IN const Color& color2) Creates a LinearGradientBrush object from a set of boundary points and boundary colors.
LinearGradientBrush(IN const PointF& point1, IN const PointF& point2, IN const Color& color1, IN const Color& color2) The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* point1, GDIPCONST GpPoint* point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const Point& point1, IN const Point& point2, IN const Color& color1, IN const Color& color2) Creates a LinearGradientBrush object from a set of boundary points and boundary colors.
The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const RectF& rect, IN const Color& color1, IN const Color& color2, IN LinearGradientMode mode)
Creates a LinearGradientBrush object based on a rectangle and mode of direction.
The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const Rect& rect, IN const Color& color1, IN const Color& color2, IN LinearGradientMode mode)
Creates a LinearGradientBrush object based on a rectangle and mode of direction.
The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, REAL angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const RectF& rect, IN const Color& color1, IN const Color& color2, IN REAL angle, IN BOOL isAngleScalable = FALSE)
Creates a LinearGradientBrush object from a rectangle and angle of direction.
The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect, ARGB color1, ARGB color2, REAL angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient)
LinearGradientBrush::LinearGradientBrush(IN const Rect& rect, IN const Color& color1, IN const Color& color2, IN REAL angle, IN BOOL isAngleScalable = FALSE)
Creates a LinearGradientBrush object from a rectangle and angle of direction.
The wrapMode parameter in the flat function is a member of the WrapMode enumeration that specifies how areas filled with the brush are tiled.
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)
Status LinearGradientBrush::SetLinearColors(IN const Color& color1, IN const Color& color2)
Sets the starting color and ending color of this linear gradient brush.
GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB* colors)
Status LinearGradientBrush::GetLinearColors(OUT Color* colors) const
Gets the starting color and ending color of this linear gradient brush.
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
Status LinearGradientBrush::GetRectangle(OUT RectF* rect) const
Gets the rectangle that defines the boundaries of the gradient.
GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
Status LinearGradientBrush::GetRectangle(OUT Rect* rect) const
Gets the rectangle that defines the boundaries of the gradient.
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *brush, BOOL useGammaCorrection)
Status LinearGradientBrush::SetGammaCorrection(IN BOOL useGammaCorrection)
Specifies whether gamma correction is enabled for this linear gradient brush.
GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *brush, BOOL *useGammaCorrection)
BOOL LinearGradientBrush::GetGammaCorrection() const
Determines whether gamma correction is enabled.
GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
INT LinearGradientBrush::GetBlendCount() const
Gets the number of blend factors currently set .
GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *blend, REAL* positions, INT count)
Status LinearGradientBrush::GetBlend(OUT REAL* blendFactors, OUT REAL* blendPositions, IN INT count) const
Gets the blend factors and their corresponding blend positions from a LinearGradientBrush object.
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL* positions, INT count)
Status LinearGradientBrush::SetBlend(IN const REAL* blendFactors, IN const REAL* blendPositions, IN INT count)
Sets the blend factors and the blend positions of this linear gradient brush to create a custom blend.
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count)
INT LinearGradientBrush::GetInterpolationColorCount() const
Gets the number of colors currently set to be interpolated for this linear gradient brush.
GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, REAL* positions, INT count)
Status LinearGradientBrush::GetInterpolationColors(OUT Color* presetColors, OUT REAL* blendPositions, IN INT count) const
Gets the colors currently set to be interpolated for this linear gradient brush and their corresponding blend positions.
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
Status LinearGradientBrush::SetInterpolationColors(IN const Color* presetColors, IN const REAL* blendPositions, IN INT count)
Sets the colors to be interpolated for this linear gradient brush and their corresponding blend positions.
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *brush, REAL focus, REAL scale)
Status LinearGradientBrush::SetBlendBellShape(IN REAL focus, IN REAL scale = 1.0f)
Sets the blend shape of this linear gradient brush to create a custom blend based on a bell-shaped curve.
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale)
Status LinearGradientBrush::SetBlendTriangularShape( IN REAL focus, IN REAL scale = 1.0f )
Sets the blend shape of this linear gradient brush to create a custom blend based on a triangular shape.
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *brush, GpWrapMode wrapmode)
Status LinearGradientBrush::SetWrapMode(IN WrapMode wrapMode)
Sets the wrap mode of this linear gradient brush.
GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
WrapMode LinearGradientBrush::GetWrapMode() const
Gets the wrap mode for this brush. The wrap mode determines how an area is tiled when it is painted with a brush.
GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
Status LinearGradientBrush::GetTransform(OUT Matrix *matrix) const
Gets the transformation matrix of this linear gradient brush.
GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix)
Status LinearGradientBrush::SetTransform(IN const Matrix* matrix)
Sets the transformation matrix of this linear gradient brush.
GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient* brush)
Status LinearGradientBrush::ResetTransform()
Resets the transformation matrix of this linear gradient brush to the identity matrix. This means that no transformation takes place.
GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient* brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
Status LinearGradientBrush::MultiplyTransform(IN const Matrix* matrix, IN MatrixOrder order = MatrixOrderPrepend)
Updates this brush's transformation matrix with the product of itself and another matrix.
GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient* brush, REAL dx, REAL dy, GpMatrixOrder order)
Status LinearGradientBrush::TranslateTransform(IN REAL dx, IN REAL dy, IN MatrixOrder order = MatrixOrderPrepend)
Updates this brush's current transformation matrix with the product of itself and a translation matrix.
GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient* brush, REAL sx, REAL sy, GpMatrixOrder order)
Status LinearGradientBrush::ScaleTransform(IN REAL sx, IN REAL sy, IN MatrixOrder order = MatrixOrderPrepend)
Updates this brush's current transformation matrix with the product of itself and a scaling matrix.
GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush, REAL angle, GpMatrixOrder order)
Status LinearGradientBrush::RotateTransform(IN REAL angle, IN MatrixOrder order = MatrixOrderPrepend)
Updates this brush's current transformation matrix with the product of itself and a rotation matrix.