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

GetImage

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

描述

 

获取由该纹理画笔定义的图像对象的指针.

 

C++ Syntax

 

Image* GetImage() const;

 

FreeBASIC 语法

 

FUNCTION GetImage ( _

   BYVAL pImage AS CGpImage PTR _

) AS GpStatus

 

参数

 

pImage

 

一个变量,将获得一个指针,由这个纹理画笔定义的Image对象指针.

 

返回值

 

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

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

 

引用文件

 

CGpBrush.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a texture brush and uses it to fill an ellipse. The code

' then gets the brush's image and draws it.

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

SUB Example_GetImage (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 use it to fill an ellipse.

  DIM pImage AS CGpImage = "HouseAndTree.gif"

  DIM textureBrush AS CGpTextureBrush = @pImage

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

 

  ' // Get the brush's image, and draw that image

  DIM pImage2 AS CGpImage

  textureBrush.GetImage(@pImage2)

  graphics.DrawImage(@pImage2, 10, 150)

 

END SUB

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