L_CreatePaintPalette

#include "l_bitmap.h"

HPALETTE EXT_FUNCTION L_CreatePaintPalette(hDC, pBitmap)

HDC hDC;

/* device context that is used */

pBITMAPHANDLE pBitmap;

/* pointer to the LEAD bitmap handle */

Returns a palette handle that must be selected and realized before calling L_PaintDC.

Parameter

Description

hDC

Device context that is used.

pBitmap

Pointer to the LEAD bitmap handle that references the image data.

Returns

> 0

Palette handle.

NULL

No palette needed.

Comments

You must use this function if either the display device or the bitmap is 8 bits per pixel or less. You can use this function whenever the bitmap or device changes, and check the return value to decide whether to select and realize the palette. If the return value is NULL, no palette needs to be selected.

You must also call this function before calling L_PaintDC, when painting a 16-bit grayscale image on a 24-bit device.

You must delete the palette handle when it is no longer needed.

Required DLLs and Libraries

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_GetFixedPalette, L_ColorResBitmap,

 

L_GetBitmapColors, L_PutBitmapColors, L_DupPalette,

 

L_PaintDC

Topics:

Raster Image Functions: Displaying Images

 

Handling Palette Changes

Example

For a short example, refer to L_PaintDC. For complete sample code, refer to the COLOR example.