Metafile::SetDownLevelRasterizationLimit 方法 (gdiplusheaders.h)

設定儲存在此中繼檔中之特定筆刷點陣圖的解析度。

語法

Status SetDownLevelRasterizationLimit(
  [in] UINT metafileRasterizationLimitDpi
);

參數

[in] metafileRasterizationLimitDpi

類型: UINT

以 DPI 指定解析度的非負整數。 如果您將此參數設定為等於 0,則解析度會設定為符合傳遞至 中繼檔 建構函式之裝置內容控制碼的解析度。 如果您將此參數設定為大於 0 但小於 10 的值,則解析度會保持不變。

傳回值

類型: 狀態

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

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

備註

這個方法的目的是防止中繼檔因為紋理和漸層筆刷以高解析度儲存而變得太大。 假設您建構 中繼檔 物件 (,以根據解析度為 600 DPI 的印表機裝置內容來錄製 EmfTypeEmfOnly 中繼檔) 。 此外,假設您根據解析度為 96 DPI 的 Bitmap 物件建立路徑漸層筆刷或紋理筆刷。 如果代表該筆刷的點陣圖儲存在解析度為 96 DPI 的中繼檔中,則其空間會比儲存解析度為 600 DPI 的點陣圖少很多。

中繼檔的預設點陣化限制為 96 DPI。 因此,如果您完全不呼叫此方法,路徑漸層筆刷和紋理筆刷點陣圖會以 96 DPI 的解析度儲存。

點陣化限制對 EmfTypeEmfOnlyEmfTypeEmfPlusDual類型的中繼檔有影響,但不會影響 EmfTypeEmfPlusOnly類型的中繼檔。

範例

下列範例會根據印表機的裝置內容來建構 中繼檔 物件。 程式碼會根據 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)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

EmfType

中繼檔

Metafile::GetDownLevelRasterizationLimit

錄製中繼檔