Metafile::SetDownLevelRasterizationLimit メソッド (gdiplusheaders.h)

このメタファイルに格納されている特定のブラシ ビットマップの解像度を設定します。

構文

Status SetDownLevelRasterizationLimit(
  [in] UINT metafileRasterizationLimitDpi
);

パラメーター

[in] metafileRasterizationLimitDpi

型: UINT

dpi 単位の解像度を指定する負以外の整数。 このパラメーターを 0 に設定すると、 メタファイル コンストラクターに渡されたデバイス コンテキスト ハンドルの解像度と一致するように解像度が設定されます。 このパラメーターを 0 より大きいが 10 未満の値に設定した場合、解像度は変更されません。

戻り値

種類: 状態

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

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

解説

このメソッドの目的は、テクスチャブラシとグラデーションブラシが高解像度で保存された結果としてメタファイルが大きくなりすぎないようにすることです。 たとえば、解像度が 600 dpi のプリンターのデバイス コンテキストに基づいてメタ ファイル オブジェクト ( EmfTypeEmfOnly メタファイルを記録する場合) を作成するとします。 また、解像度が 96 dpi の Bitmap オブジェクトに基づいて、パス グラデーション ブラシまたはテクスチャ ブラシを作成するとします。 そのブラシを表すビットマップが 96 dpi の解像度でメタファイルに格納されている場合、解像度が 600 dpi で格納されている場合よりもはるかに少ない領域が必要になります。

メタファイルの既定のラスター化制限は 96 dpi です。 したがって、このメソッドをまったく呼び出さない場合、パス グラデーション ブラシとテクスチャ ブラシビットマップは 96 dpi の解像度で格納されます。

ラスター化の制限は、 EmfTypeEmfOnly 型と EmfTypeEmfPlusDual 型のメタファイルに影響しますが、 EmfTypeEmfPlusOnly 型のメタファイルには影響しません。

例

次の例では、プリンターのデバイス コンテキストに基づいて Metafile オブジェクトを構築します。 このコードでは、BMP ファイルに基づいてテクスチャ ブラシを作成し、そのブラシで塗りつぶされた楕円を記録します。 プリンターの解像度が 600 dpi で 、Bitmap オブジェクトの解像度が 96 dpi であるとします。


// Get a device context for a printer.
HDC hdcPrint = CreateDC(NULL, TEXT("\\\\printserver\\printer1"), NULL, NULL); 

// Construct a Metafile object (for recording) based on a 600-DPI printer.
Metafile metafile(L"Metafile.emf", hdcPrint, EmfTypeEmfOnly);
{     
   // Create a texture brush based on a 96-DPI bitmap. 
   Bitmap bitmap(L"Texture.bmp");
   TextureBrush textureBrush(&bitmap);

   // Set the rasterization limit of the metafile to match the DPI of the
   // printer DC, in this case 600. When the bitmap for the texture brush
   // is stored in the metafile, the bitmap will be expanded by a factor of
   // about 6 horizontally and vertically. That will increase the size of 
   // the bitmap by a factor of about 36.
   metafile.SetDownLevelRasterizationLimit(0);

   // Record an ellipse filled with the texture brush.
   Graphics graphics(&metafile);  
   graphics.FillEllipse(&textureBrush, 10, 10, 40, 40);
}

// The preceding code, along with a particular 24 x 23 bitmap,
// produced a 114 kilobyte metafile. Passing 96, instead of 0, to the 
// SetDownLevelRasterizationLimit method produced a 3.5 kilobyte metafile.

要件

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

関連項目

EmfType

メタファイル

メタファイル::GetDownLevelRasterizationLimit

メタファイルの記録