Region::GetRegionScans(constMatrix*,Rect*,INT*) メソッド (gdiplusheaders.h)

Region::GetRegionScans メソッドは、この領域に近似する四角形の配列を取得します。 領域は、四角形が計算される前に、指定したマトリックスによって変換されます。

構文

Status GetRegionScans(
  [in]  const Matrix *matrix,
  [out] Rect         *rects,
  [out] INT          *count
);

パラメーター

[in] matrix

型: const Matrix*

領域の変換に使用される Matrix オブジェクトへのポインター。

[out] rects

型: Rect*

四角形を受け取る Rect オブジェクトの配列へのポインター。

[out] count

型: INT*

この領域に近似する四角形の数を示す値を受け取る INT へのポインター。 値は、 rectsNULL ポインターである場合でも有効です。

戻り値

種類: 状態

メソッドが成功した場合は、Status 列挙体の要素である Ok を返します

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

解説

Region::GetRegionScansCount メソッドを最初に使用して、四角形の数を決定できます。 その後、正しいサイズのバッファーを割り当て、 rects パラメーターをバッファーを指すよう設定できます。

次の例では、パスから領域を作成し、その領域に近似する四角形のセットを取得します。 次に、各四角形を描画します。

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

   SolidBrush solidBrush(Color(255, 255, 0, 0));
   Pen pen(Color(255, 0, 0, 0));
   GraphicsPath path;
   Matrix matrix;
   Rect* rects = NULL;
   INT count = 0;  

   // Create a region from a path.
   path.AddEllipse(10, 10, 50, 300);
   Region pathRegion(&path);    
   graphics.FillRegion(&solidBrush, &pathRegion);

   // Get the rectangles.
   graphics.GetTransform(&matrix);
   count = pathRegion.GetRegionScansCount(&matrix);
   rects = (Rect*)malloc(count*sizeof(Rect));
   pathRegion.GetRegionScans(&matrix, rects, &count);  

   // Draw the rectangles.
   for(INT j = 0; j < count; ++j)
      graphics.DrawRectangle(&pen, rects[j]);

   free(rects);
}

要件

   
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdiplusheaders.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

関連項目

リージョンを使用したヒット テスト

マトリックス

Rect

リージョン

Region::GetRegionScansCount

リージョン

状態