GraphicsPath::Outline 方法 (gdipluspath.h)

GraphicsPath::Outline方法會轉換並壓平此路徑,然後轉換此路徑的資料點,使其只代表路徑的大綱。

語法

Status Outline(
  [in] const Matrix *matrix,
  [in] REAL         flatness
);

參數

[in] matrix

類型:const矩陣*

選擇性。 指定轉換之 Matrix 物件的指標。 如果此參數為 Null,則不會套用任何轉換。 預設值是 NULL

[in] flatness

類型: REAL

選擇性。 實數,指定路徑與其扁平化近似值之間的最大誤差。 減少扁平度會增加近似值的線條線段數目。 預設值為 FlatnessDefault,這是 Gdiplusenums.h 中定義的常數。

傳回值

類型: 狀態

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

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

備註

GraphicsPath物件會儲存代表線條和曲線的資料點集合。 GraphicsPath::Outline方法會變更這些資料點,而原始資料點會遺失。

範例

下列範例會建立 GraphicsPath 物件,並呼叫 GraphicsPath::AddClosedCurve 方法,將封閉基數曲線新增至路徑。 程式碼會呼叫 GraphicsPath::Widen 方法來擴展路徑,然後繪製路徑。 接下來,程式碼會呼叫路徑的 Outline 方法。 程式碼會呼叫 Graphics 物件的 TranslateTransform 方法,讓後續呼叫 DrawPath 所繪製的大綱路徑位於第一個路徑的右邊。


VOID OutlineExample(HDC hdc)
{
   Graphics graphics(hdc);

   Pen bluePen(Color(255, 0, 0, 255));
   Pen greenPen(Color(255, 0, 255,  0), 10);

   PointF points[] = {
      PointF(20.0f, 20.0f),
      PointF(160.0f, 100.0f),
      PointF(140.0f, 60.0f),
      PointF(60.0f, 100.0f)};

   GraphicsPath path;
   path.AddClosedCurve(points, 4);

   path.Widen(&greenPen);
   graphics.DrawPath(&bluePen, &path);

   path.Outline();

   graphics.TranslateTransform(180.0f, 0.0f);
   graphics.DrawPath(&bluePen, &path);
}

需求

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

另請參閱

使用區域裁剪

建構和繪製路徑

建立路徑漸層

GraphicsPath

GraphicsPath::Flatten

GraphicsPath::Warp

GraphicsPath::Widen

矩陣

路徑