|
|
@@ -9,102 +9,6 @@
|
|
|
|
|
|
// Debug Functions
|
|
|
|
|
|
-int GetCBitmapWidth(const CBitmap & cbm)
|
|
|
-{
|
|
|
- BITMAP bm;
|
|
|
- cbm.GetObject(sizeof(BITMAP),&bm);
|
|
|
- return bm.bmWidth;
|
|
|
-}
|
|
|
-
|
|
|
-int GetCBitmapHeight(const CBitmap & cbm)
|
|
|
-{
|
|
|
- BITMAP bm;
|
|
|
- cbm.GetObject(sizeof(BITMAP),&bm);
|
|
|
- return bm.bmHeight;
|
|
|
-}
|
|
|
-
|
|
|
-WORD NumColors(BITMAPINFOHEADER& bmiHeader)
|
|
|
-{
|
|
|
- if ( bmiHeader.biClrUsed != 0)
|
|
|
- return (WORD)bmiHeader.biClrUsed;
|
|
|
-
|
|
|
- switch ( bmiHeader.biBitCount )
|
|
|
- {
|
|
|
- case 1:
|
|
|
- return 2;
|
|
|
- case 4:
|
|
|
- return 16;
|
|
|
- case 8:
|
|
|
- return 256;
|
|
|
- default:
|
|
|
- return 0;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-DWORD PaletteSize(BITMAPINFOHEADER& bmiHeader)
|
|
|
-{
|
|
|
- return NumColors(bmiHeader) * sizeof(RGBQUAD);
|
|
|
-}
|
|
|
-
|
|
|
-BOOL GetCBitmap(void *pClip2, CDC *pDC, CBitmap *pBitMap, int nMaxHeight)
|
|
|
-{
|
|
|
- LPBITMAPINFO lpBI ;
|
|
|
- void* pDIBBits;
|
|
|
- BOOL bRet = FALSE;
|
|
|
-
|
|
|
- CClipFormat *pClip = (CClipFormat *)pClip2;
|
|
|
-
|
|
|
- switch(pClip->m_cfType)
|
|
|
- {
|
|
|
- case CF_DIB:
|
|
|
- {
|
|
|
- lpBI = (LPBITMAPINFO)GlobalLock(pClip->m_hgData);
|
|
|
- if(lpBI)
|
|
|
- {
|
|
|
- int nColors = lpBI->bmiHeader.biClrUsed ? lpBI->bmiHeader.biClrUsed : 1 << lpBI->bmiHeader.biBitCount;
|
|
|
-
|
|
|
- if( lpBI->bmiHeader.biBitCount > 8 )
|
|
|
- {
|
|
|
- pDIBBits = (LPVOID)((LPDWORD)(lpBI->bmiColors + lpBI->bmiHeader.biClrUsed) +
|
|
|
- ((lpBI->bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pDIBBits = (LPVOID)(lpBI->bmiColors + nColors);
|
|
|
- }
|
|
|
-
|
|
|
- //pDIBBits = (void*)(lpBI + lpBI->bmiHeader.biSize + PaletteSize(lpBI->bmiHeader));
|
|
|
-
|
|
|
- int nHeight = min(nMaxHeight, lpBI->bmiHeader.biHeight);
|
|
|
- int nWidth = (nHeight * lpBI->bmiHeader.biWidth) / lpBI->bmiHeader.biHeight;
|
|
|
-
|
|
|
- if(pBitMap)
|
|
|
- {
|
|
|
- pBitMap->CreateCompatibleBitmap(pDC, nWidth, nHeight);
|
|
|
-
|
|
|
- CDC MemDc;
|
|
|
- MemDc.CreateCompatibleDC(pDC);
|
|
|
-
|
|
|
- CBitmap* oldBitmap = MemDc.SelectObject(pBitMap);
|
|
|
-
|
|
|
- ::StretchDIBits(MemDc.m_hDC,
|
|
|
- 0, 0,
|
|
|
- nWidth, nHeight,
|
|
|
- 0, 0, lpBI->bmiHeader.biWidth,
|
|
|
- lpBI->bmiHeader.biHeight,
|
|
|
- pDIBBits, lpBI, DIB_PAL_COLORS, SRCCOPY);
|
|
|
-
|
|
|
- MemDc.SelectObject(oldBitmap);
|
|
|
-
|
|
|
- bRet = TRUE;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return bRet;
|
|
|
-}
|
|
|
|
|
|
CString GetIPAddress()
|
|
|
{
|