导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > CGpLinearGradientBrush Class > LinearGradientBrush Object >

SetBlendBellShape

上一页返回章节概述下一页

描述

 

设置此路径渐变画笔的混合形状.

 

C++ Syntax

 

Status SetBlendBellShape(

[in]            REAL focus,

[in, optional]  REAL scale

);

 

FreeBASIC Syntax

 

FUNCTION SetBlendBellShape ( _

   BYVAL focus AS SINGLE, _

   BYVAL scale AS SINGLE = 1.0 _

) AS GpStatus

 

参数

 

focus

 

[in]单精度数指定中心的颜色会在其最高强度.这个数字必须在0到1的范围内.

 

vScale

 

[in]简单精度数指定颜色,得到中心混合边界的颜色强度最大.这个数字必须在0到1的范围内.默认值是1.

 

返回值

 

如果该方法成功,则返回Ok,这是对Status枚举元素.

如果这个方法失败,它返回一个枚举的其他元素的Status.

 

备注

 

默认情况下,当从起始边界到结束边界移动时,颜色从起始颜色(线性渐变画笔的起始边界颜色)到结束颜色(线性渐变画笔的结束边界颜色)逐渐改变.你可以定制的定位和开始和结束用LinearGradientBrush.SetBlendBellShape颜色混合的方法.

方法的LinearGradientBrush.SetBlendBellShape定制混合使其遵循钟形曲线随着铃声的基地在梯度的边界的极端.开始的颜色,在默认的共混物,是在一个线性梯度刷的起始边界,出现在开始和结束的线性梯度刷的边界时,一个钟形的共混物的应用.结束颜色的位置,在默认的混合,是在结束边界,是介于边界之间,是由焦点的值决定的.换句话说,焦点指定钟的峰值位置.例如,对0.7地方在开始和结束的边界之间的距离的百分之70峰的焦点价值.结束颜色出现在这个峰值.

钟形混合的结束颜色是渐变的默认混合起始颜色和默认混合结束颜色之间的色域的百分比.例如,假设一个线性梯度刷构造与红色作为起始颜色和蓝色作为结束颜色.如果LinearGradientBrush.SetBlendBellShape称为一个0.8,结束颜色的铃铛状的混合比例值是一种颜色是红色和蓝色的(20成红百分之80间,百分之80个蓝色的).一个1.0尺度值产生一结束颜色是蓝色100 %.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

' ========================================================================================

' The following example creates a linear gradient brush, sets a bell-shaped blend, and uses

' the brush to fill a rectangle. Twice more, the code sets a bell-shaped blend with different

' values and, each time, uses the brush to fill a rectangle.

' ========================================================================================

SUB Example_SetBlendBellShape (BYVAL hdc AS HDC)

 

  ' // Create a graphics object from the window device context

  DIM graphics AS CGpGraphics = hdc

  ' // Get the DPI scaling ratio

  DIM rxRatio AS SINGLE = graphics.GetDpiX / 96

  DIM ryRatio AS SINGLE = graphics.GetDpiY / 96

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, ryRatio)

 

  DIM pt1 AS GpPoint = GDIP_POINT(0, 0)

  DIM pt2 AS GpPoint = GDIP_POINT(500, 0)

 

  DIM linGrBrush AS CGpLinearGradientBrush = CGpLinearGradientBrush(@pt1, @pt2, _

     GDIP_ARGB(255, 255, 0, 0), GDIP_ARGB(255, 0, 0, 255))

 

  linGrBrush.SetBlendBellShape(0.5, 0.6)

  graphics.FillRectangle(@linGrBrush, 0, 0, 500, 50)

 

  linGrBrush.SetBlendBellShape(0.5, 0.8)

  graphics.FillRectangle(@linGrBrush, 0, 75, 500, 50)

 

  linGrBrush.SetBlendBellShape(0.5, 1.0)

  graphics.FillRectangle(@linGrBrush, 0, 150, 500, 50)

 

END SUB

' ========================================================================================