CImagePalette.PreparePalette method
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The PreparePalette
method sets up a palette, based on a media type from the owning filter.
Syntax
HRESULT PreparePalette(
const CMediaType *pmtNew,
const CMediaType *pmtOld,
LPSTR szDevice
);
Parameters
-
pmtNew
-
Pointer to the new media type. The format block must be a VIDEOINFOHEADER structure.
-
pmtOld
-
Pointer to the old media type. If the media type is being set for the first time, this parameter can be an empty type with no format block. Otherwise, the format block must be a VIDEOINFOHEADER structure.
-
szDevice
-
Pointer to a string that contains the name of the display device, as returned by the GDI EnumDisplayDevices function. To use the main display device, set this parameter to NULL.
Return value
Returns S_OK if the palette was updated, or S_FALSE if the palette did not change.
Remarks
If the palette needs to be updated, this method performs the following actions:
- Calls CImagePalette::MakePalette to create a new logical palette.
- Sends an EC_PALETTE_CHANGED event to the Filter Graph Manager.
- Calls CBaseWindow::SetPalette on the CBaseWindow object.
- Calls CDrawImage::IncrementPaletteVersion on the CDrawImage object.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|