导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > CGpPathGradientBrush Class > PathGradientBrush Object >

TranslateTransform

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

描述

 

更新该刷的当前变换矩阵的产品本身和翻译矩阵.

 

C++ Syntax

 

Status TranslateTransform(

[in]  REAL dx,

[in]  REAL dy,

[in]  MatrixOrder order

);

 

FreeBASIC 语法

 

FUNCTION TranslateTransform ( _

   BYVAL dx AS SINGLE, _

   BYVAL dy AS SINGLE, _

   BYVAL order AS MatrixOrder = MatrixOrderPrepend _

) AS GpStatus

 

参数

 

dx

 

[in]单精度数指定翻译的水平分量.

 

dy

 

[in]单精度数指定翻译的垂直分量.

 

order

 

MatrixOrder指定相乘的顺序[in, optional]元.MatrixOrderPrepend指定传递矩阵是在左边,和MatrixOrderAppend指定传递矩阵是正确的.默认值是MatrixOrderPrepend.

 

返回值

 

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

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

 

备注

 

一个3?矩阵可以存储任意序列的仿射变换.如果你有几个3?矩阵,其中每一个表示仿射变换,这些矩阵的产品是一个单一的3?表示整个变换序列的矩阵.该产品表示的变换称为复合变换.例如,假设矩阵S表示乘法和矩阵T代表翻译.如果矩阵M是产品ST,然后矩阵M代表复合变换:规模第一,然后翻译.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a PathGradientBrush object based on a triangular path. The

' calls to the PathGradientBrush.ScaleTransform and PathGradientBrush.TranslateTransform

' methods of the PathGradientBrush object set the elements of the brush's transformation

' matrix so that it represents a composite transformation: first scale, then translate.

' The code uses the path gradient brush twice to paint a rectangle: once before the

' transformation is set and once after the transformation is set.

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

SUB Example_TranslateTransform (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(0, 0), GDIP_POINT(50, 0), GDIP_POINT(50, 50)}

  DIM pthGrBrush AS CGpPathGradientBrush = CGpPathGradientBrush(@points(0), 3)

 

  ' // Fill an area with the path gradient brush (no transformation).

  graphics.FillRectangle(@pthGrBrush, 0, 0, 500, 500)

 

  pthGrBrush.ScaleTransform(3.0, 1.0)

  pthGrBrush.TranslateTransform(100.0, 50.0, MatrixOrderAppend)

 

  ' // Fill the same area with the transformed path gradient brush.

  graphics.FillRectangle(@pthGrBrush, 0, 0, 500, 500)

 

END SUB

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