Partager via


Bitmap.ApplyEffect(Effect*, RECT*) method

Applies to: desktop apps only

The Bitmap::ApplyEffect method alters this Bitmap object by applying a specified effect.

Syntax

Status ApplyEffect(
  [in]  Effect *effect,
  [in]  RECT *ROI
);

Parameters

  • effect [in]
    Type: Effect*

    Pointer to an instance of a descendant of the Effect class. The descendant (for example, a Blur object) specifies the effect that is applied.

  • ROI [in]
    Type: RECT*

    Pointer to a RECT structure that specifies the portion of the input bitmap to which the effect is applied. Pass NULL to specify that the effect applies to the entire input bitmap.

Return value

Type:

Type: Status****

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following example draws an image twice: once with no change, and once after the brightness has been increased for part of the image.

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);
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Product

GDI+ 1.1

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Bitmap

Bitmap::ApplyEffect Methods

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012