PremultiplyAlpha (const Image*, size_t, const TexMetadata&, ScratchImage&)

Converts an image assuming the original is not using premultiplied alpha into a premultiplied alpha version of the same image.

Syntax

HRESULT PremultiplyAlpha(
         const Image *srcImages,
         size_t nimages,
         const TexMetadata &metadata,
         ScratchImage &result
)  

Parameters

srcImages
Type: Image *

[in] Pointer to one or more Image structures in a memory buffer.

nimages
Type: size_t 

[in] The number of images.

metadata
Type: TexMetadata 

[in] Address of a TexMetadata structure.

result
Type: ScratchImage 

[out] Pointer to a ScratchImage class instance.

Return value

Type: HRESULT 

Success or error code.

Remarks

This function does not operate directly on block compressed images. See Decompress and Compress.

This function is most useful for working with rendering that relies on premultiplied alpha blending (see DirectXTK).

CodePlex shows an example and blog links.

Requirements

Header: Declared in directxtex.h.