Bitmap::ApplyEffect (Effect*,RECT*) 方法 (gdiplusheaders.h)

Bitmap::ApplyEffect 方法會套用指定的效果來改變此 Bitmap 物件。

語法

Status ApplyEffect(
  Effect *effect,
  RECT   *ROI
);

參數

effect

Effect 類別子系之實例的指標。 例如, Blur 物件) 指定套用的效果,例如子代 (。

ROI

RECT 結構的指標,指定套用效果之輸入位圖的部分。 傳遞 NULL 以指定效果適用於整個輸入位圖。

傳回值

類型: 狀態

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

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

備註

範例

下列範例會繪製影像兩次:一次沒有變更,一次在影像的亮度增加之後。

VOID Example_BrightnessContrastApplyEffect1(HDC hdc)
{
   Graphics graphics(hdc);
   Bitmap myBitmap(L"Picture.bmp");
   UINT srcWidth = myBitmap.GetWidth();
   UINT srcHeight = myBitmap.GetHeight();

   BrightnessContrastParams briConParams;
   briConParams.brightnessLevel = 50;
   briConParams.contrastLevel = 0;
   BrightnessContrast briCon;
   briCon.SetParameters(&briConParams);
   RECT rectOfInterest = {20, 15, 80, 50};

   // Draw the original image.
   graphics.DrawImage(&myBitmap, 20, 20, srcWidth, srcHeight);

   // Increase the brightness in a portion of the image.
   myBitmap.ApplyEffect(&briCon, &rectOfInterest);

   // Draw the image again.
   graphics.DrawImage(&myBitmap, 200, 20, srcWidth, srcHeight);
}

規格需求

需求
標頭 gdiplusheaders.h

另請參閱

點陣圖