UnpackPremult method

Unpacks the specified number of samples into the supplied buffer in alpha-premultiplied PMARGB32 pixel format. This method only unpacks a single row. Use IDXARGBReadPtr::UnpackRect to unpack multiple rows.


DXPMSAMPLE retVal = object.UnpackPremult(pSamples, cSamples, bMove);


pSamples [in]


Pointer to the buffer you must supply to store the samples. If the native type of the surface is PMARGB32, this pointer can be NULL. Otherwise it must point to a buffer large enough to hold the samples.

cSamples [in]

Type: unsigned long

Number of samples to retrieve.

bMove [in]

Type: BOOL

Value that specifies whether to advance the horizontal position of the read pointer. Specify TRUE to advance or FALSE to leave the pointer set to the current location.


This method converts the pixel format of the underlying surface samples to PMARGB32 format before copying them into the buffer that you must supply. If the underlying data is not in alpha-premultiplied format, the samples are converted as they are copied.

If you supply a buffer in the pSamples parameter, the samples are stored in that location, and this method returns a pointer to your buffer.

This method uses the DXPMSAMPLE structure to store color information about the samples.

Note   Do not use the returned pointer to modify a read-only surface. Good coding practice for read-locked surfaces is to assign the returned pointer to a constant DXPMSAMPLE pointer.

See also