描述
获取此路径渐变画笔的焦点刻度.
C++ Syntax
Status GetFocusScales( [out] REAL *xScale, [out] REAL *yScale ); |
FreeBASIC 语法
FUNCTION GetFocusScales ( _ BYVAL xScale AS SINGLE PTR, _ BYVAL yScale AS SINGLE PTR _ ) AS GpStatus |
参数
xScale
[out]指针到一个简单的精密接收焦点刻度值.
yxScale
[out]指针到一个简单的精度受到Y焦点刻度值.
返回值
如果该方法成功,则返回Ok,这是对Status枚举元素.
如果这个方法失败,它返回一个枚举的其他元素的Status.
备注
默认情况下,路径渐变的中心颜色位于中心点.通过调用PathGradientBrush.SetFocusScales,你可以指定中心颜色要沿着一条路径,围绕的中心点.例如,假设边界路径是三角形,中心点位于三角形的中心位置.同时假定边界颜色为红色,中心颜色为蓝色.如果你设置的重点尺度(0.2, 0.2),颜色是沿一个小三角,围绕中心点的边蓝.小三角是主要的边界路径在y方向的因素在x方向和0.2 0.2缩放.当你画的路径渐变刷,颜色将逐渐改变从红色到蓝色,当你从大三角的边界移动到小三角形的边界.小三角区内充满蓝色.
引用文件
CGpBrush.inc (include CGdiPlus.inc)
示例
' ========================================================================================
' The following example creates a PathGradientBrush object based on a triangular path.
' The code sets the focus scales of the path gradient brush to (0.2, 0.2) and then uses
' the path gradient brush to fill an area that contains the triangular path. Finally, the
' code calls the PathGradientBrush.GetFocusScales method of the PathGradientBrush object
' to obtain the values of the x focus scale and the y focus scale.
' ========================================================================================
SUB Example_GetFocusScales (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 points(0 TO 2) AS GpPoint = {GDIP_POINT(100, 0), GDIP_POINT(200, 200), GDIP_POINT(0, 200)}
' // No GraphicsPath object is created. The PathGradientBrush
' // object is constructed directly from the array of points.
DIM pthGrBrush AS CGpPathGradientBrush = CGpPathGradientBrush(@points(0), 3)
DIM colors(0 TO 1) AS ARGB = {GDIP_ARGB(255, 255, 0, 0), GDIP_ARGB(255, 0, 0, 255)}
' // red at the boundary of the outer triangle
' // blue at the boundary of the inner triangle
DIM relativePositions(0 TO 1) AS SINGLE = {0.0, 1.0}
pthGrBrush.SetInterpolationColors(@colors(0), @relativePositions(0), 2)
' // The inner triangle is formed by scaling the outer triangle
' // about its centroid. The scaling factor is 0.2 in both the x and y directions.
pthGrBrush.SetFocusScales(0.2, 0.2)
' // Fill a rectangle that is larger than the triangle
' // specified in the Point array. The portion of the
' // rectangle outside the triangle will not be painted.
graphics.FillRectangle(@pthGrBrush, 0, 0, 200, 200)
' // Obtain information about the path gradient brush.
DIM xScale AS SINGLE = 0.0
DIM yScale AS SINGLE = 0.0
pthGrBrush.GetFocusScales(@xScale, @yScale)
' // The value of xScale is now 0.2.
' // The value of yScale is now 0.2.
END SUB
' ========================================================================================