ID2D1RenderTarget::CreateLinearGradientBrush (constD2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES*,constD2D1_BRUSH_PROPERTIES*,ID2D1GradientStopCollection*,ID2D1LinearGradientBrush**) 方法 (d2d1.h)

为具有线性渐变的绘制区域创建 ID2D1LinearGradientBrush 对象。

语法

HRESULT CreateLinearGradientBrush(
  const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties,
  const D2D1_BRUSH_PROPERTIES                 *brushProperties,
  ID2D1GradientStopCollection                 *gradientStopCollection,
  ID2D1LinearGradientBrush                    **linearGradientBrush
);

参数

linearGradientBrushProperties

类型:[in] const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES*

渐变的起点和终点。

brushProperties

类型:[in] const D2D1_BRUSH_PROPERTIES*

新画笔的转换和基本不透明度。

gradientStopCollection

类型:[in] ID2D1GradientStopCollection*

描述画笔渐变颜色及其沿渐变线位置的 D2D1_GRADIENT_STOP 结构的集合。

linearGradientBrush

类型:[out] ID2D1LinearGradientBrush**

此方法返回时,包含指向新画笔的指针的地址。 此参数未经初始化即被传递。

返回值

类型: HRESULT

如果该方法成功,则返回 S_OK。 否则,它将返回 HRESULT 错误代码。

要求

要求
目标平台 Windows
标头 d2d1.h
Library D2d1.lib
DLL D2d1.dll

另请参阅

画笔概述

CreateGradientStopCollection

如何创建线性渐变画笔

ID2D1GradientStopCollection

ID2D1LinearGradientBrush

ID2D1RadialGradientBrush

ID2D1RenderTarget