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

📄 voimage.h

📁 Windows CE下操作、显示图像的类。可以打开、显示png、gif、jpg等系统支持的格式。
💻 H
字号:
//-------------------------------------------------------------------
// VOImage Header File
//-------------------------------------------------------------------
//
// Copyright ?000 Virtual Office Systems Incorporated
// All Rights Reserved
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included.
//
// This code can be compiled, modified and distributed freely, providing
// that this copyright information remains intact in the distribution.
//
// This code may be compiled in original or modified form in any private
// or commercial application.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage, in any form, caused
// by this code. Use it at your own risk.
//-------------------------------------------------------------------

#if !defined(AFX_VOIMAGE_H__B83C4202_DB1E_48BE_92A5_21019F9EE6FC__INCLUDED_)
#define AFX_VOIMAGE_H__B83C4202_DB1E_48BE_92A5_21019F9EE6FC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifdef _WIN32_WCE
#include <imgdecmp.h>
#endif

#include "vostring.h"

class CVOResource
{
public:
	CVOResource(HMODULE hModule, DWORD dwResourceID, LPCTSTR pcszClass);
	~CVOResource();

	BOOL IsLoaded();

	DWORD GetSize();
	PBYTE GetData();

	void SetUserData(DWORD dwValue);
	DWORD GetUserData();

protected:
	DWORD m_dwUser;

	DWORD m_dwSize;
	PBYTE m_pData;
	HGLOBAL m_hGlobal;
	HRSRC m_hrsrc;
};

class CVOImage
{
public:
	BOOL SetCanvasSize(int x, int y,
					   COLORREF rgbBackground = RGB(1, 1, 1),
					   BOOL fHCenter = TRUE,
					   BOOL fVCenter = TRUE);
	COLORREF GetPixel(int x, int y);
	BOOL DrawTransparent(HDC hdc,
						 int x, int y,
						 int cx = -1, int cy = -1,
						 COLORREF crTransparent = RGB(192, 192, 192));
	HBITMAP Copy() const;
	static DWORD CALLBACK GetImageResourceData(LPSTR szBuffer,
			DWORD dwBufferMax,
			LPARAM lParam);
	BOOL IsLoaded() const;
#ifdef _WIN32_WCE
	static void CALLBACK ImageProgress(IImageRender*, BOOL, LPARAM);
#endif
	static DWORD CALLBACK GetImageData(LPSTR, DWORD, LPARAM);
	BOOL SetBitmap(HDC hdc,
				   DWORD dwResourceID,
				   LPCTSTR pcszClass = L"IMAGE",
				   HMODULE hModule = 0);
	DWORD	GetWidth() const;
	DWORD	GetHeight() const;
	WORD	GetPlanes() const;
	WORD	GetBitsPixel() const;

	BOOL Draw(HDC hdc, int x, int y, int cx = -1, int cy = -1) const;
	BOOL DrawTranslucent(HDC hdc,
						 int x, int y,
						 int nPercent,
						 int cx = -1, int cy = -1,
						 COLORREF crTransparent = RGB(192, 192, 192)) const;
	BOOL Load(HDC hdc, LPCTSTR pcszFileName);
	CVOImage();
	virtual ~CVOImage();
	operator HBITMAP();
	const CVOString& GetFileName() const;

protected:
	CVOString	m_strFileName;		// Empty if loaded from resource
	HMODULE		m_hModuleResource;	// 0 if loaded from file
	DWORD		m_dwResourceID;		// 0 if loaded from file
	DWORD		m_dwHeight;
	DWORD		m_dwWidth;
	WORD		m_wPlanes;
	WORD		m_wBitsPixel;

	HDC			m_hDC;
	HBITMAP		m_hBitmap;
	static BOOL g_bStretchBlt;
	static int	g_iMaxHeight;
	static int	g_iMaxWidth;
	static int	g_iScale;
};

#endif // !defined(AFX_VOIMAGE_H__B83C4202_DB1E_48BE_92A5_21019F9EE6FC__INCLUDED_)

⌨️ 快捷键说明

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