DirectShow Animated Header -- CImageSample Class DirectShow Animated Header -- CImageSample Class* Microsoft DirectShow SDK
*Index  *Topic Contents
*Previous Topic: CImagePalette Class
*Next Topic: CLoadDirectDraw Class

CImageSample Class


CImageSample class hierarchy

This class inherits from CMediaSample and overrides the constructor to initialize itself with the DIBDATA structure. When the renderer is using its own allocator, it will use this class for its samples. It can therefore obtain the DIBSECTION structure information it requires to obtain the HBITMAP data it renders.

Protected Data Members
Name Description
m_bInit Flag to determine if the DIBSECTION structure information is initialized.
m_DibData Information about the sample's DIBSECTION structure.

Member Functions
Name Description
CImageSample Constructs a CImageSample object.
GetDIBData Retrieves the DIBSECTION structure information stored for the sample.
SetDIBData Sets the DIBSECTION information stored for the sample.


CImageSample::CImageSample

CImageSample Class

Constructs a CImageSample object.

CImageSample(
  CBaseAllocator *pAllocator,
  TCHAR *pName,
  HRESULT *phr,
  LPBYTE pBuffer,
  LONG length
  );

Parameters
pAllocator
Base allocator to which the sample belongs.
pName
Debug-only string description.
phr
COM return code.
pBuffer
Pointer to the image buffer.
length
Length of the image buffer.
Return Values

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.


CImageSample::GetDIBData

CImageSample Class

Retrieves the DIBDATA structure held by the sample.

DIBDATA *GetDIBData( );


CImageSample::SetDIBData

CImageSample Class

Sets the DIBDATA structure that the sample should hold.

void SetDIBData(
  DIBDATA *pDibData
  );

Parameters
pDibData
New DIBDATA structure.
Return Values

No return value.

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

*Top of Page