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

📄 gspixel.h

📁 连连看这个游戏都玩过吧
💻 H
字号:
// Pixel.h: interface for the CPixel class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PIXEL_H__BEAEEEE9_4917_4F3F_9101_A9126E452906__INCLUDED_)
#define AFX_PIXEL_H__BEAEEEE9_4917_4F3F_9101_A9126E452906__INCLUDED_

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

#pragma pack( push, 1)

struct GSLIB_API SPixel24
{
	BYTE blue;
	BYTE green;
	BYTE red;

	// Constructors
	SPixel24();
	explicit SPixel24( DWORD arg );
	SPixel24( BYTE new_red, BYTE new_green, BYTE new_blue );

	// Operators
	SPixel24 & operator&=( SPixel24 right );
	SPixel24 & operator|=( SPixel24 right );
	SPixel24 & operator^=( SPixel24 right );

	operator DWORD() const;
};
typedef SPixel24 PIX24;

struct GSLIB_API SPixel32 : public SPixel24
{
	BYTE alpha;

	// Constructors
	SPixel32();
	SPixel32( BYTE new_red, BYTE new_green, BYTE new_blue, BYTE new_alpha = 255 );
	SPixel32( SPixel24 const& arg );
	SPixel32( DWORD arg );

	// Operators
	SPixel32 & operator&=( SPixel32 right );
	SPixel32 & operator|=( SPixel32 right );
	SPixel32 & operator^=( SPixel32 right );
	
	operator DWORD() const;
};
typedef SPixel32 PIX32;

class CPixMapGroup;

class GSLIB_API CPixelMap32
{
	friend	CPixMapGroup;

	KEY				m_name;
	GPOINT			m_point;
	//
	LPVOID			psd_cache;
	std::string		psd_cache_file;
	//
	PIX32*	m_pPix;
	DWORD	m_dwWidth;
	DWORD	m_dwHeight;
public:
	BOOL SaveToPGM(const char* strFile, FLAG fPGM);
	BOOL SaveToPGM(GSFBUF * pfBuf, FLAG fPGM = PGM_FLAG_RGBA);
	VOID Clear();
	CPixelMap32();
	~CPixelMap32();//{ Clear(); }
	BOOL	Create( DWORD width, DWORD height );
	BOOL	LoadFromTgaFile(const char* szFile);
	VOID	LoadFromTgaFileBuffer( fstream& buffer );
	GPOINT	LoadFromPsdFile(const char* szFile, const char* szLayer);
	GPOINT	LoadFromPsdFile(const char* szFile, int idLayer);
	PIX32*	GetData()	{ return m_pPix; }
	DWORD	GetWidth()	{ return m_dwWidth; }
	DWORD	GetHeight() { return m_dwHeight; }

	KEY		GetName()		{ return m_name; }
	GPOINT	GetBasePoint()	{ return m_point; }

	void	SetKey(KEY key)				{ m_name = key; }
	void	SetBasePoint(GPOINT point)	{ m_point = point; }
};

typedef CPixelMap32 PIXMAP;


//struct	GSLIB_API SPixelMapGroup
//{
//	KEY		
//};


class GSLIB_API CPixMapGroup  
{
	std::vector<PIXMAP*>	m_apPixmap; 
public:
	BOOL SaveToPGG(const char* strFile, FLAG fPGM = PGM_FLAG_RGBA);
	BOOL SaveToPGG(GSFBUF* pfBuf, FLAG fPGM = PGM_FLAG_RGBA);
	int AddFromPSD(const char* szFile);
	PIXMAP* AddPixmap();
	void Cleanup();
	BOOL LoadFromPSD(const char* szFile);
	CPixMapGroup();
	virtual ~CPixMapGroup();

	int	GetPixmapCount()			{ return m_apPixmap.size(); }
	PIXMAP*	GetPixmap(int nIndex)	{ return m_apPixmap[nIndex]; }

};




class GSLIB_API CPixGuide  
{
public:
	CPixGuide();
	virtual ~CPixGuide();



protected:
	GPGM*	m_pPGM;
	long	width;
	long	height;
};






DECLARE_HANDLE(HDIB);
/* DIB constants */
#define PALVERSION_   0x300
/* DIB Macros*/
#define IS_WIN30_DIB(lpbi)  ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))


class GSLIB_API CDibMap
{
	LPSTR	lpDib;
public:
	VOID	Clear();
	CDibMap();
	~CDibMap() { Clear(); }
	LPSTR	GetData()	{ return lpDib; }
	DWORD	GetWidth()	{ return DIBWidth (); }
	DWORD	GetHeight() { return DIBHeight (); }
	BOOL	CreateFormBitmap(const char* szFile);
	BOOL	CreateFormBitmap( GSFBUF& fbuf );
	BOOL	SaveToBitmap(char const* szfile);
	BOOL	Paint(HDC hDC, GRECT const& rcSrc, GRECT const& rcDes);

	
	
	HPALETTE	CreateDIBPalette();
	LPSTR	FindDIBBits ();
	DWORD	DIBWidth ();
	DWORD	DIBHeight ();
	WORD	PaletteSize ();
	WORD	DIBNumColors ();
};

typedef CDibMap DIBMAP;




#pragma pack(pop)





#endif // !defined(AFX_PIXEL_H__BEAEEEE9_4917_4F3F_9101_A9126E452906__INCLUDED_)

⌨️ 快捷键说明

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