## Bitmap Functions, Macros, and Data

The Wxutil.h header file in the DirectShow base classes provides functions and macros to help convert between VIDEOINFOHEADER and BITMAPINFO structures.

Function | Description
BIT_MASKS_MATCH | Compares the masks of two video images.
BITMASKS | Retrieves a pointer to the array of bitmasks for the specified VIDEOINFOHEADER structure.
COLORS | Retrieves a pointer to an array of RGBQUAD structures that describes the color palette for the specified VIDEOINFOHEADER structure.
ContainsPalette | Checks if the video image contains a color palette.
DIBSIZE | Calculates the byte size of the specified bitmap
GetBitCount | Finds the number of bits per pixel.
GetBitmapFormatSize | Finds the size (in bytes) needed to build a VIDEOINFOHEADER structure and related data.
GetBitmapPalette | Finds the first palette entry in a VIDEOINFOHEADER structure.
GetBitmapSize | Finds the size (in bytes) needed to hold an image.
GetBitmapSubtype | Finds the GUID subtype for a given bitmap info header structure.
GetSubtypeName | Finds the (debug) name for a given GUID subtype.
GetTrueColorType | Finds the GUID subtype for a given bitmap header.
HEADER | Retrieves a pointer to the image data from the specified video image.
MPEG1_SEQUENCE_INFO | Retrieves the sequence header for the specified MPEG-1 video image.
PALETTISED | Checks if the video image's color palette is 8-bit or less.
PALETTE_ENTRIES | Returns the number of colors in the video image's palette.
RESET_MASKS | Clears the specified video image's bitmasks.
RESET_HEADER | Clears the specified video image.
RESET_PALETTE | Clears the specified video image's color palette.
SIZE_EGA_PALETTE | Calculates the size of the EGA (4-bit) color palette.
SIZE_MASKS | Calculates the size of the mask's color palette.
SIZE_MPEG1VIDEOINFO | Calculates the size of the specified MPEG-1 video image.
SIZE_PALETTE | Calculates the size of the 8-bit color palette.
SIZE_PREHEADER | Calculates the byte offset for the video image's bitmap information.
SIZE_VIDEOHEADER | Calculates the size of the video image.
TRUECOLORINFO | Retrieves a pointer to an array of TRUECOLORINFO structures that describes the bitmasks and color palette for the specified VIDEOINFOHEADER structure.

These functions are made available to help manage VIDEOINFOHEADER structures, which are used throughout DirectShow™ to describe video data streams. Although similar to the BITMAPINFO structure used in Microsoft® Win32® and existing multimedia, VIDEOINFOHEADER also adds some new video-specific fields.

Global Data | Description
bits555 | Array of color bitmasks for an RGB 555 bitmap.
bits565 | Array of color bitmasks for an RGB 565 bitmap.
bits888 | Array of color bitmasks for an RGB 24-bit bitmap.

###

BIT_MASKS_MATCH

Bitmap Functions, Macros, and Data

Retrieves the bitmasks for the specified video image.

BIT_MASKS_MATCH(
pbmi1,
pbmi2
)

##### Parameters

pbmi1
  Pointer to a Win32 VIDEOINFOHEADER structure that contains the first video image.
pbmi2
  Pointer to a Win32 VIDEOINFOHEADER structure that contains the second video image.

##### Return Values

Returns nonzero if the bitmasks for both video images are identical or zero otherwise.

###

BITMASKS

Bitmap Functions, Macros, and Data

Retrieves the bitmasks for the specified video image.

BITMASKS(
pbmi
)

##### Parameters

pbmi
  Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

##### Return Values

Returns a pointer to the array of bitmasks for the specified VIDEOINFOHEADER structure.

###

COLORS

Bitmap Functions, Macros, and Data

Retrieves the color palette for the specified video image.

COLORS(
pbmi
)

##### Parameters

pbmi
  Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

##### Return Values

Returns a pointer to an array of RGBQUAD structures that describes the color palette for the specified VIDEOINFOHEADER structure.

###

ContainsPalette

Bitmap Functions, Macros, and Data

Checks if the specified video image contains a color palette.

BOOL ContainsPalette(
const VIDEOINFOHEADER *pVideoInfo
);

##### Parameters

pVideoInfo
  Pointer to a VIDEOINFOHEADER structure.

##### Return Values

Returns TRUE if the VIDEOINFOHEADER structure contains a color palette or FALSE otherwise.

###

DIBSIZE

Bitmap Functions, Macros, and Data

Calculates the byte size of the specified bitmap.

DIBSIZE(
bi
)

##### Parameters

bi
  A Win32 BITMAPINFOHEADER structure that specifies the source bitmap.

##### Return Values

Returns the byte size of the bi parameter.

###

GetBitCount

Bitmap Functions, Macros, and Data

Finds the number of bits per pixel.

WORD GetBitCount(
const GUID *pSubtype
);

##### Parameters

pSubtype
  Pointer to a GUID for a given video subtype.

##### Return Values

Returns the number of bits per pixel for this subtype, or USHRT_MAX if an error occurred.

###

GetBitmapFormatSize

Bitmap Functions, Macros, and Data

Finds the size (in bytes) needed to build a VIDEOINFOHEADER structure and related data.

LONG GetBitmapFormatSize(
const BITMAPINFOHEADER *pHeader
);

##### Parameters

pHeader
  Pointer to a Win32 BITMAPINFOHEADER structure.

##### Return Values

Returns the number of bytes for the VIDEOINFOHEADER structure described by this BITMAPINFOHEADER, including prefix information, the BITMAPINFOHEADER field, and any other color information on the end.

###

GetBitmapPalette

Bitmap Functions, Macros, and Data

Finds the first palette for a VIDEOINFOHEADER structure.

const RGBQUAD * GetBitmapPalette(
const VIDEOINFOHEADER *pVideoInfo
);

##### Parameters

pVideoInfo
  Pointer to a VIDEOINFOHEADER structure.

##### Return Values

Returns a pointer to the first entry in a palette.

###

GetBitmapSize

Bitmap Functions, Macros, and Data

Finds the number of bytes needed to hold an image.

DWORD GetBitmapSize(
const BITMAPINFOHEADER *pHeader
);

##### Parameters

pHeader
  Pointer to a Win32 BITMAPINFOHEADER structure.

##### Return Values

Returns the number of bytes needed to hold an image.

###

GetBitmapSubtype

Bitmap Functions, Macros, and Data

Finds the subtype for the specified bitmap.

const GUID GetBitmapSubtype(
const BITMAPINFOHEADER *pHeader
);

##### Parameters

pHeader
  Pointer to a Win32 BITMAPINFOHEADER structure.

##### Return Values

Returns the video subtype GUID of the bitmap specified by pHeader, or GUID_NULL if pHeader is NULL.

###

GetSubtypeName

Bitmap Functions, Macros, and Data

Retrieves the name for a given GUID subtype.

TCHAR * GetSubtypeName(
const GUID *pSubtype
);

##### Parameters

pSubtype
  Pointer to a GUID for a given video subtype.

##### Return Values

Returns the debug name of this GUID, or UNKNOWN if the name is not known.

###

GetTrueColorType

Bitmap Functions, Macros, and Data

Finds the subtype for the specified 16-bit color bitmap.

const GUID GetTrueColorType(
const BITMAPINFOHEADER *pHeader
);

##### Parameters

pHeader
  Pointer to a Win32 BITMAPINFOHEADER structure.

##### Return Values

Returns the video subtype GUID of the 16-bit color bitmap specified by pHeader, or GUID_NULL if pHeader is NULL.

###

HEADER

Bitmap Functions, Macros, and Data

Retrieves a pointer to the image data from the specified video image.

HEADER(
pVideoInfo
)

##### Parameters

pVideoInfo
  Pointer to the VIDEOINFOHEADER structure that specifies the video image.

##### Return Values

Returns a pointer to the Win32 BITMAPINFOHEADER structure contained in the VIDEOINFOHEADER structure's bmiHeader data member.

###

MPEG1_SEQUENCE_INFO

Bitmap Functions, Macros, and Data

Retrieves the sequence header for the specified MPEG-1 video image.

MPEG1_SEQUENCE_INFO(
pv
)

##### Parameters

pv
  Pointer to an MPEG1VIDEOINFO structure.

##### Return Values

Returns the bSequenceHeader data member of the specified MPEG1VIDEOINFO structure.

###

PALETTISED

Bitmap Functions, Macros, and Data

Checks if the video image's color palette is 8-bit or less.

PALETTISED(
pbmi
)

##### Parameters

pbmi
  Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

##### Return Values

Returns nonzero if the video image's palette contains 256 or fewer colors, or zero otherwise.

###

PALETTE_ENTRIES

Bitmap Functions, Macros, and Data

Retrieves the number of colors in the video image's palette.

PALETTE_ENTRIES(
pbmi
)

##### Parameters

pbmi
  Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

##### Return Values

Returns the number of colors in the video image's palette.

###

RESET_MASKS

Clears the specified video image's bitmasks.

RESET_MASKS(
pbmi
)

##### Parameters

pbmi
  Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

##### Return Values

No return value.

###

RESET_HEADER

Bitmap Functions, Macros, and Data

Clears the specified video image.

RESET_HEADER(
pbmi
)

##### Parameters

pbmi
  Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

##### Return Values

No return value.

###

RESET_PALETTE

Bitmap Functions, Macros, and Data

Clears the specified video image's color palette.

RESET_PALETTE(
pbmi
)

##### Parameters

pbmi
  Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

##### Return Values

No return value.

###

SIZE_EGA_PALETTE

Bitmap Functions, Macros, and Data

Calculates the size of a 4-bit color palette.

SIZE_EGA_PALETTE

##### Return Values

Returns the size of a 16-color palette, in bytes.

###

SIZE_MASKS

Bitmap Functions, Macros, and Data

Calculates the size of a bitmask's color palette.

SIZE_MASKS

##### Return Values

Returns the size, in bytes, of a bitmap mask's color palette, which has three colors.

###

SIZE_MPEG1VIDEOINFO

Bitmap Functions, Macros, and Data

Calculates the size of the specified MPEG-1 video image.

SIZE_MPEG1VIDEOINFO(
pv
)

##### Parameters

pv
  Pointer to the MPEG1VIDEOINFO structure that specifies the video image.

##### Return Values

Returns the byte size of the specified MPEG1VIDEOINFO structure.

###

SIZE_PALETTE

Bitmap Functions, Macros, and Data

Calculates the size of the 8-bit color palette.

SIZE_PALETTE

##### Return Values

Returns the size of the 256-color palette.

###

SIZE_PREHEADER

Bitmap Functions, Macros, and Data

Calculates the byte offset for the video image's bitmap information.

SIZE_PREHEADER

##### Return Values

Returns the byte offset of the VIDEOINFOHEADER structure's bmiHeader data member.

###

SIZE_VIDEOHEADER

Bitmap Functions, Macros, and Data

Calculates the size of the video image.

SIZE_VIDEOHEADER

##### Return Values

Returns the combined size of all of the VIDEOINFOHEADER structure's data members.

###

TRUECOLORINFO

Bitmap Functions, Macros, and Data

Retrieves the color palette and bitmasks for the specified video image.

TRUECOLORINFO(
pbmi
)

##### Parameters

pbmi
  Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

##### Return Values

Returns a pointer to an array of TRUECOLORINFO structures that describes the bitmasks and color palette for the specified VIDEOINFOHEADER structure.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.