GetDIB
Top  Previous  Next

Description

Returns the handler to a Device Independent Bitmap.


Syntax


[VB]
Value=objActiveGige.GetDIB()


[C/C++]
HRESULT GetDIB(HGLOBAL* pDib);


Data Types
[VB]

Return value: long


Parameters
[C/C++]

X [in]  
The x-coordinate of the pixel  
Y [in]  
The y-coordinate of the pixel  
pDib [out,retval]  
Pointer to the handler to ActiveGige's display DIB  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example


This C example demonstrates how to retrieve and display ActiveGige's DIB

 
BITMAPINFO *pDIB;
pActiveGige->GetDIB((ULONG*)&pDIB);
RECT rect; 
long
 sx,sy;
GetWindowRect(hWnd,&rect);
pActiveGige->GetSizeX(&sx);
pActiveGige->GetSizeY(&sy);
BYTE* pData=(BYTE*)pDIB+
sizeof
(BITMAPINFOHEADER) + pDIB->bmiHeader.biClrUsed * 
sizeof
(RGBQUAD);
SetDIBitsToDevice(hDC, 0, 0, sx, sy, 0, 0, 0, sy, pData, pDIB, DIB_RGB_COLORS); 



Remarks


The GetDIB method provides the most efficient way to display the internal image buffer when you do not want to use ActiveGige's live display. ActiveGige uses packed DIBs, the pixel data immediately following the BITMAPINFO structure. The method returns a GlobalAlloc handler which contains the pointer to a DIB. The application must not free the global handler after using the DIB data.

Note that a DIB contains only 8- and 24-bit pixel values, even if the current video mode is a 16- or 48-bit one. To access the actual pixel data, use the GetImageData or GetPointer methods.