Supported Pixel Formats

This topic documents a feature of Visual Filters and Transitions, which is deprecated as of Windows Internet Explorer 9 and obsolete as of Internet Explorer 10.

One of the most useful capabilities of Microsoft DirectX Transform is that it enables you to import and export graphics data in a number of standard pixel formats. Each format uses a different number of bits to represent the color and opacity of each sample. A sample is divided into amounts of red, green, blue, and alpha components. Transforms define three basic data types that are used to represent image samples.

  • DXSAMPLE — A structure with red, green, blue, and alpha components, each having 8 bits. The color channels are not premultiplied by the alpha component for this type.
  • DXPMSAMPLE — A structure with red, green, blue, and alpha components, each having 8 bits. The color channels are premultiplied by the alpha component for this type.
  • DXBASESAMPLE — A structure with red, green, blue, and alpha components, each having 8 bits. This variation is used for functions where it does not matter whether the color components are alpha-premultiplied.

The alpha component describes the opacity of a sample, with zero representing a clear sample and 255 representing a fully opaque sample. Pixel formats, which use several bits for alpha, are said to be translucent. This enables images to be rendered over other images, with some of the underlying image showing through. Formats that use only 1 bit for alpha are said to be transparent. Transparency is used frequently in Web page graphics, allowing images to show cleanly on background patterns. A common way to use transparency is through a color key; this is indicated by the "_CK" suffix on the pixel format data type. Any non-alpha-based pixel format can have a color key attached. If a format with the "_CK" suffix is used during creation of a surface, a color key is automatically attached.

Alpha-based pixel formats have several advantages over color-keyed pixel formats. For example, alpha-based surfaces can support shapes with soft or anti-aliased edges, while color-keyed surfaces cannot. Alpha-based samples store transparency information in a separate component, so it does not get potentially confused with the color information of the picture, like color-keyed surfaces can.

Source images should usually be loaded in their native format. Images that contain translucency and that will be repeatedly composited should use the DDPF_PMARGB32 format for performance, if possible.

DirectX Transform supports the following pixel formats.

32-Bit Pixel Formats

DDPF_ARGB32 — Eight bits each of alpha, red, green, and blue. The bits are stored in that order, with the alpha stored in the higher-order bits and the blue in the lower-order bits. This is one of the two preferred pixel formats used by DirectX Transform.

DDPF_PMARGB32 — Eight bits each of alpha, red, green, and blue. This is essentially the same format as DDPF_ARGB32, except that each color has been alpha-premultiplied. Using this format makes the compositing of images more efficient because this removes several mathematical operations in the compositing process. This is the second of the two preferred pixel formats used by DirectX Transform.

DDPF_RGB32 — Eight bits each of red, green, and blue. Alpha is undefined.

DDPF_RGB32_CK — The same format as DDPF_RGB32, with one color treated as transparent.

24-Bit Pixel Formats

DDPF_RGB24 — Eight bits each of red, green, and blue. This format is more compact in memory than the 32-bit formats; however, access is slow because the samples are not aligned on 32-bit boundaries in memory.

DDPF_RGB24_CK — The same format as DDPF_RGB24, with one color treated as transparent.

16-Bit Pixel Formats

DDPF_ARGB4444 — Four bits each of alpha, red, green, and blue. You should note that Windows Graphics Device Interface (GDI) does not display this format properly on Windows 95 or Windows 98.

DDPF_RGB565 — This format uses 5 bits for red, 6 bits for green, and 5 bits for blue. The higher-order bits are used for red, while the lower order bits are used for blue.

DDPF_RGB555 — Five bits each for red, green, and blue. The high-order bit is undefined.

DDPF_RGB565_CK — The same format as DDPF_RGB565, with one color treated as transparent.

DDPF_RGB555_CK — The same format as DDPF_RGB555, with one color treated as transparent.

8-Bit Pixel Formats

DDPF_RGB8 — This format uses an 8-bit number to index into a predefined palette of 256 colors. The default palette is the Windows halftone palette.

DDPF_RGB8_CK — This is the same format as DDPF_RGB8, with one of the indices treated as transparent.

Community Additions

ADD
Show:
© 2014 Microsoft