导航:  GdiPlus Classes > GdiPlus Classes > CGpBrush Class > CGpTextureBrush Class > TextureBrush Object >

GetTransform

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

描述

 

获取纹理画笔的变换矩阵.

 

C++ Syntax

 

Status GetTransform(

[out]  Matrix *matrix

) const;

 

FreeBASIC 语法

 

FUNCTION GetTransform ( _

   BYVAL pMatrix AS CGpMatrix PTR _

) AS GpStatus

 

参数

 

pMatrix

 

[out]指向Matrix对象接收变换矩阵.

 

返回值

 

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

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

 

备注

 

一个TextureBrush对象维护一个变换矩阵,可以存储任何仿射变换.当你使用纹理画笔填充的区域,GDI+变换画笔的图像根据刷的变换矩阵,然后填充的区域.变换后的图像只存在在渲染;存储在TextureBrush物体图像没有转化.例如,假设你叫someTextureBrush.ScaleTransform(3)然后画一个区域与someTextureBrush.宽刷的形象三当区画,但存储在someTextureBrush图像保持不变.

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a texture brush and sets the transformation of the brush.

' The code then gets the brush's transformation matrix and proceeds to inspect or use the elements.

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

SUB Example_GetTransform (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)

 

  ' // Create a texture brush, and set its transformation.

  DIM pImage AS CGpImage = "HouseAndTree.gif"

  DIM textureBrush AS CGpTextureBrush = @pImage

  textureBrush.ScaleTransform(3, 2)

 

  DIM matrix AS CGpMatrix

  DIM elements(5) AS SINGLE

 

  textureBrush.GetTransform(@matrix)

  matrix.GetElements(@elements(0))

 

  FOR j AS LONG = 0 TO 5

     ' // Inspect or use the value in elements[j].

     PRINT elements(j)

  NEXT

 

END SUB

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