Graphics::GetHalftonePalette method (gdiplusgraphics.h)
The Graphics::GetHalftonePalette method gets a Windows halftone palette.
Syntax
HPALETTE GetHalftonePalette();
Return value
Type: static
This method returns a handle to a Windows halftone palette.
Remarks
The purpose of the Graphics::GetHalftonePalette method is to enable GDI+ to produce a better quality halftone when the display uses 8 bits per pixel. To display an image using the halftone palette, use the following procedure:
- Call Graphics::GetHalftonePalette to get a GDI+ halftone palette.
- Select the halftone palette into a device context.
- Realize the palette by calling the RealizePalette function.
- Construct a Graphics object from a handle to the device context.
- Call the Graphics::DrawImage method of the Graphics object.
Examples
The following example draws the same image twice. Before the image is drawn the second time, the code gets a halftone palette, selects the palette into a device context, and realizes the palette.
VOID Example_GetHalftonePalette(HDC hdc)
{
Image image(L"Mosaic.png");
Graphics* graphics1 = new Graphics(hdc);
graphics1->DrawImage(&image, 10, 10);
delete graphics1;
HPALETTE hPalette = Graphics::GetHalftonePalette();
SelectPalette(hdc, hPalette, FALSE);
RealizePalette(hdc);
Graphics* graphics2 = new Graphics(hdc);
graphics2->DrawImage(&image, 300, 10);
delete graphics2;
DeleteObject(hPalette);
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | gdiplusgraphics.h (include Gdiplus.h) |
Library | Gdiplus.lib |
DLL | Gdiplus.dll |