CImageSample Class

CImageSample class hierarchy

The CImageSample 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

m_bInit Flag to determine if the DIBSECTION structure information is initialized.
m_DibData Information about the sample's DIBSECTION structure.

Member Functions

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.

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.

CImageSample::GetDIBData

CImageSample Class

Retrieves the DIBDATA structure held by the sample.

Syntax

DIBDATA *GetDIBData(void);

Return Value

Returns a DIBDATA structure.

CImageSample::SetDIBData

CImageSample Class

Sets the DIBDATA structure that the sample should hold.

Syntax

void SetDIBData(
  DIBDATA *pDibData
  );

Parameters

pDibData
Pointer to the new DIBDATA structure.

Return Value

No return value.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.