UINT GetEnhMetaFilePaletteEntries(hemf, cEntries, lppe) | |||||
HENHMETAFILE hemf; | /* handle of enhanced metafile | */ | |||
UINT cEntries; | /* count of palette entries | */ | |||
LPPALETTEENTRY lppe; | /* address of PALETTEENTRY array | */ |
The GetEnhMetaFilePaletteEntries function retrieves optional color-palette entries from the specified enhanced metafile.
hemf
Identifies the enhanced metafile.
cEntries
Specifies the number of entries to be retrieved from the optional color palette.
lppe
Points to an array of PALETTEENTRY structures that will receive the palette colors. The array must contain at least as many data structures as specified by the cEntries parameter. The PALETTEENTRY structure has the following form:
typedef struct tagPALETTEENTRY { /* pe */
BYTE peRed;
BYTE peGreen;
BYTE peBlue;
BYTE peFlags;
} PALETTEENTRY;
If lppe is NULL and the enhanced metafile contains an optional color palette, the return value is the number of entries in the enhanced-metafile's color palette; if lppe is a valid pointer and the enhanced metafile contains an optional color palette, the return value is the number of entries copied; if the lppe is a valid pointer but the metafile does not contain an optional color palette, the return value is 0. The return value is GDI_ERROR if an error occurs.
An application can store an optional color palette in an enhanced metafile by calling the CreatePalette and SetPaletteEntries functions prior to creating the picture and storing it in the metafile. By doing this, the application can guarantee consistent colors when the picture is displayed on a variety of devices.
Applications which display a picture stored in an enhanced metafile should call the GetEnhMetaFilePaletteEntries function to determine whether the optional palette exists, and, if it does, call the GetEnhMetaFilePaletteEntries function a second time to retrieve those entries. Once the application has retrieved the color palette entries, it should create a logical palette, select it into it's device context, and then realize it. These operations are performed by the CreatePalette, SelectPalette, and RealizePalette functions. Once the logical palette has been realized, the application can display the picture with its original colors by calling the PlayEnhMetaFile function.
PALETTEENTRY, PlayEnhMetaFile