The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Bitmap.ApplyEffect(Bitmap**, INT, Effect*, RECT*, RECT*, Bitmap**) method

Applies to: desktop apps only

The Bitmap::ApplyEffect method creates a new Bitmap object by applying a specified effect to an existing Bitmap object.


Status ApplyEffect(
  [in]   Bitmap **inputs,
  [in]   INT numInputs,
  [in]   Effect *effect,
  [in]   RECT *ROI,
  [out]  RECT *outputRect,
  [out]  Bitmap **output


inputs [in]

Type: Bitmap**

Address of a pointer to a Bitmap object to which the effect is applied.

numInputs [in]

Type: INT

Integer that specifies the number of input bitmaps. This parameter must be set to 1.

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 that is used.

outputRect [out]

Type: RECT*

Pointer to a RECT structure that receives the portion of the input bitmap that was used. If the rectangle specified by ROI lies entirely within the input bitmap, the rectangle returned in outputRect is the same as ROI. If part of rectangle specified by ROI lies outside the input bitmap, then the rectangle returned in outputRect is the portion of ROI that lies within the input bitmap. Pass NULL if you do not want to receive the output rectangle.

output [out]

Type: Bitmap**

Address of a variable that receives a pointer to the new Bitmap object.

Return value


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.


Bitmap::ApplyEffect returns a pointer to a new Bitmap object. When you have finished using that Bitmap object, call delete to free the memory that it occupies.


The following example creates two Bitmap objects: inputBitmap and outputBitmap. First, inputBitmap is constructed from a BMP file. Then outputBitmap is created by passing the address of inputBitmap to the Bitmap::ApplyEffect method. Bitmap::ApplyEffect takes the portion of inputBitmap specified by rectOfInterest and increases the contrast as specified by briCon, a BrightnessContrast object.

VOID Example_BrightnessContrastApplyEffect2(HDC hdc)
   Graphics graphics(hdc);
   Bitmap* inputBitmap = new Bitmap(L"Picture.bmp");
   Bitmap* outputBitmap = NULL;  
   RECT rectOfInterest = {10, 12, 100, 80};
   BrightnessContrastParams briConParams;
   briConParams.brightnessLevel = 0;
   briConParams.contrastLevel = 25;
   BrightnessContrast briCon;

   // Draw the original image.
   graphics.DrawImage(inputBitmap, 20, 20);

   // Apply the change in contrast.
      &inputBitmap, 1, &briCon, &rectOfInterest, NULL, &outputBitmap);

   // Draw the new image.
   graphics.DrawImage(outputBitmap, 200, 20);

   delete inputBitmap;
   delete outputBitmap;


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008


GDI+ 1.1


Gdiplusheaders.h (include Gdiplus.h)





See also

Bitmap::ApplyEffect Methods



Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions