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

SetTransform

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

描述

 

设置纹理画笔的变换矩阵.

 

C++ Syntax

 

Status SetTransform(

[in]  const Matrix *matrix

);

 

FreeBASIC 语法

 

FUNCTION SetTransform ( _

   BYVAL pMatrix AS CGpMatrix PTR _

) AS GpStatus

 

参数

 

pMatrix

 

[in]指向Matrix对象,指定使用变换矩阵.

 

返回值

 

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

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

 

备注

 

一个TextureBrush对象维护一个变换矩阵,可以存储任何仿射变换.当你使用纹理画笔填充一个区域,Windows 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 uses the transformed brush to fill an ellipse.

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

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

 

  ' // Horizontal stretch

  DIM matrix AS CGpMatrix = CGpMatrix(2, 0, 0, 1, 0, 0)

 

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

  DIM pImage AS CGpImage = "HouseAndTree.gif"

  DIM textureBrush AS CGpTextureBrush = @pImage

  textureBrush.SetTransform(@matrix)

  graphics.FillEllipse(@textureBrush, 0, 0, 400, 200)

 

END SUB

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