⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cbitmap.h

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 H
字号:
/*____________________________________________________________________________
		Copyright (C) 2002 PGP Corporation
        All rights reserved.

        $Id: CBitmap.h,v 1.3 2002/08/06 20:10:45 dallen Exp $
____________________________________________________________________________*/

#ifndef Included_CBitmap_h	// [
#define Included_CBitmap_h

#include "pgpClassesConfig.h"
#include "CPoint.h"

_PGP_BEGIN

// Types

class CPalette;
class CRect;


// Class CBitmap

class CBitmap
{
	NOT_COPYABLE(CBitmap)

public:
	CBitmap();
	CBitmap(HBITMAP bitmap);
	CBitmap(HINSTANCE instance, const char *name, PGPBoolean shared = FALSE);
	CBitmap(HINSTANCE instance, const char *name, CPalette& palette);
	~CBitmap();

	CBitmap&	operator=(HBITMAP bitmap);

	operator HBITMAP() const {return mBitmap;}
	HBITMAP	Get() const {return mBitmap;}

	PGPBoolean	IsAttached() const;
	PGPBoolean	WeCreated() const {return mWeCreated;}

	void	PaintWithPalette(HDC dc, HPALETTE palette, CPoint origin) const;

	void	CreateCompatible(HDC hDC, PGPInt32 width, PGPInt32 height);
	void	CreateWithPalette(HINSTANCE instance, const char *name, 
		CPalette& palette);
	void	Load(HINSTANCE instance, const char *name, 
		PGPBoolean shared = FALSE);
	void	Attach(HBITMAP bitmap);
	void	Clear();

	HBITMAP	Release();	// Clear without freeing resources

private:
	PGPBoolean	mWeCreated;
	HBITMAP		mBitmap;

	PGPUInt32	mWidth;
	PGPUInt32	mHeight;
};


// Class CBitmap member functions

inline 
CBitmap::CBitmap() : mWeCreated(FALSE), mBitmap(NULL)
{
}

inline 
CBitmap::CBitmap(HBITMAP bitmap) : mWeCreated(FALSE), mBitmap(NULL)
{
	Attach(bitmap);
}

inline 
CBitmap::CBitmap(HINSTANCE instance, const char *name, PGPBoolean shared) : 
	mWeCreated(FALSE), mBitmap(NULL)
{
	Load(instance, name, shared);
}

inline 
CBitmap::CBitmap(HINSTANCE instance, const char *name, CPalette& palette) : 
	mWeCreated(FALSE), mBitmap(NULL)
{
	CreateWithPalette(instance, name, palette);
}

inline 
CBitmap::~CBitmap()
{
	try
	{
		Clear();
	}
	catch (CComboError&) { }
}

inline 
PGPBoolean 
CBitmap::IsAttached() const
{
	return IsntNull(mBitmap);
}

_PGP_END

#endif	// ] Included_CBitmap_h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -