TextureBrush::GetTransform 方法 (gdiplusbrush.h)

TextureBrush::GetTransform方法會取得這個紋理筆刷的轉換矩陣。

語法

Status GetTransform(
  [out] Matrix *matrix
);

參數

[out] matrix

類型: 矩陣*

會接收轉換矩陣之 Matrix 物件的指標。

傳回值

類型: 狀態

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

TextureBrush物件會維護可儲存任何關聯轉換的轉換矩陣。 當您使用紋理筆刷填滿區域時,GDI+ 會根據筆刷的轉換矩陣轉換筆刷影像,然後填滿區域。 轉換後的影像只存在於轉譯期間;不會轉換儲存在 TextureBrush 物件中的影像。 例如,假設您呼叫 someTextureBrush.ScaleTransform (3) ,然後使用 someTextureBrush繪製區域。 繪製區域時,筆刷影像的寬度會三倍,但儲存在 someTextureBrush 中的影像會保持不變。

範例

下列範例會建立紋理筆刷,並設定筆刷的轉換。 然後,程式碼會取得筆刷的轉換矩陣,並繼續檢查或使用元素。

VOID Example_GetTransform(HDC hdc)
{
   Graphics graphics(hdc);
  
   // Create a texture brush, and set its transform.
   Image image(L"marble.jpg");
   TextureBrush textureBrush(&image);
   textureBrush.ScaleTransform(3, 2);

   // Obtain information about the texture brush.
   Matrix matrix;
   REAL elements[6];

   textureBrush.GetTransform(&matrix);
   matrix.GetElements(elements);

   for(INT j = 0; j <=5; ++j)
   {
      // Inspect or use the value in elements[j].
   }
}

需求

   
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限桌面應用程式]
最低支援的伺服器 Windows 2000 Server [僅限桌面應用程式]
目標平台 Windows
標頭 gdiplusbrush.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

筆刷和填滿的圖形

座標系統和轉換

使用影像紋理填滿圖形

矩陣

TextureBrush

TextureBrush::ResetTransform

TextureBrush::SetTransform

轉換