Microsoft DirectX 8.1 (C++) |
Constructor method.
Syntax
CImageSample(
CBaseAllocator *pAllocator,
TCHAR *pName,
HRESULT *phr,
LPBYTE pBuffer,
LONG length
);
Parameters
pAllocator
Pointer to the base allocator to which the sample belongs.
pName
Pointer to the debug-only string description.
phr
Pointer to the COM return code.
pBuffer
Pointer to the image buffer.
length
Length of the image buffer.
Return Value
No return value.
Remarks
The CImageAllocator, CImageSample, and CDrawImage classes are all tightly associated. The buffers that the image allocator creates are made by using the Microsoft® Win32® CreateDIBSection function. The allocator then creates its own samples (based on the CImageSample class). The image samples are initialized with the buffer pointer and its length. The sample is also passed in a structure (a DIBDATA structure) that holds a number of pieces of information obtained from the CreateDIBSection call.
These samples can then be passed to the draw object. The draw object knows the private format of the samples and how to get back the DIBDATA structure from them. Once it has obtained that information, it can pass a bitmap handle, which is stored in the DIBDATA structure, down into GDI when it draws the image that the sample contains. By using the bitmap handle from the sample in the drawing, rather than just the buffer pointer (which is the alternative if the sample is not a CImageSample), it achieves a modest performance improvement.
See Also