DIB.H
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1999 DXGuide. All Rights Reserved.
- // File: DIB.h
- #ifndef _DIB__H
- #define _DIB__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- class CPackFileManager;
- class CDIB: public CObject
- {
- DECLARE_SERIAL(CDIB)
- public:
- // Defines for the different file types.
- enum DIBFileType
- {
- FT_BITMAP = 0,
- FT_ICON = 1,
- FT_CURSOR = 2,
- FT_PALETTE = 3,
- };
- public:
- CDIB(void);
- virtual ~CDIB();
- public:
- bool Load(CFile* pFile, bool bPackFile = false);
- bool Load(LPCTSTR lpszFileName, CPackFileManager* pPackFileManager = NULL);
- bool Create(HBITMAP hBitmap, HPALETTE hPal, HDC hDC = NULL);
- bool Create(HDC hDC);
- bool CreateFormCapture(HWND hSourceWnd, bool bClient);
- bool Save(LPCTSTR lpszFileName) const;
- bool Save(CFile* pFile) const;
- protected:
- virtual bool LoadFileHeader(CFile* pFile,
- bool bPackFile, DWORD& dwDIBSize);
- public:
- bool Draw(HDC hDC, int nDestX, int nDestY) const;
- bool Draw(HDC hDC, LPRECT lpDCRect, LPRECT lpDIBRect) const;
- virtual int GetWidth(void) const;
- virtual int GetHeight(void) const;
- bool IsValid(void) const;
- int GetBitsPerPixel(void) const;
- void GetRect(RECT* pRect) const;
- int GetNumClrEntries(void) const;
- RGBQUAD* GetClrTabAddress(void) const;
- DWORD GetPaletteSize(void) const;
- const BITMAPINFO* GetBitmapInfoAddress(void) const;
- static HBITMAP CaptureWindow(HWND hSourceWnd, bool bClient, HDC& hDCSource);
- static int NumDIBColorEntries(BITMAPINFO const* pBMI);
- public:
- virtual void Serialize(CArchive& ar);
- public:
- // Clipboard support
- HGLOBAL CopyToHandle(void) const;
- bool LoadFromHandle(HGLOBAL hGlobal);
- protected:
- LPBITMAPINFO m_pBMI;
- LPBYTE m_pBits;
- bool m_bMyBits;
- };
- #include "DIB.inl"
- #endif // _DIB__H