Effect::GetAuxData method (gdipluseffects.h)

The Effect::GetAuxData gets a pointer to a set of lookup tables created by a previous call to the Bitmap::ApplyEffect method.


VOID * GetAuxData();

Return value

This method returns a pointer to a set of lookup tables created by a previous call to Bitmap::ApplyEffect. If no lookup tables are available, the return value is NULL.


You can apply an effect to a bitmap by creating an instance of one of the descendants of the Effect class and passing the address of that descendant to the Bitmap::ApplyEffect method. For certain descendants of Effect, ApplyEffect creates lookup tables and returns the address of those tables to the descendant object. For example, you can retrieve the lookup tables for a BrightnessContrast object as follows:

  1. Create a BrightnessContrast object and call its SetParameters method.
  2. Pass TRUE to the Effect::UseAuxData method of the BrightnessContrast object.
  3. Pass the address of the BrightnessContrast object to the Bitmap::ApplyEffect method.
  4. Call the Effect::GetAuxData method of the BrightnessContrast object to obtain a pointer to the lookup tables created by ApplyEffect. The buffer for the lookup tables is allocated by ApplyEffect; you are not responsible for freeing the buffer.

ApplyEffect can return the address of lookup tables for the following descendants of the Effect class.

For the classes in the preceding list, ApplyEffect creates four lookup tables: one each for the blue, green, red, and alpha channels. Each lookup table is an array of 256 bytes so the size of the entire set of tables is 1024 bytes. The tables are stored in the order blue, green, red, alpha.


The following code passes the address of a BrightnessContrast object to the Bitmap::ApplyEffect method. Then the code prints the blue-channel lookup table created by ApplyEffect.

Bitmap bm(L"Picture.bmp");

BrightnessContrastParams briConParams;
briConParams.brightnessLevel = 0;
briConParams.contrastLevel = 25;

BrightnessContrast briCon;
bm.ApplyEffect(&briCon, NULL);

VOID* data = briCon.GetAuxData();

// You know the size is 1024, but check to make sure.
INT size = briCon.GetAuxDataSize();

if(1024 != size || NULL == data)

// Cast the data pointer as a ColorLUTParams pointer so that it
// will be easy to examine the individual tables.
ColorLUTParams* tables = (ColorLUTParams*)data;
// Print the lookup table for the blue channel.
for(UINT j = 0; j < 256; ++j)
   printf("%u, %u\n", j, tables->lutB[j]);


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header gdipluseffects.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also