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

📄 giffile.h

📁 jpeg压缩
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////
//
//	GIFFile - A C++ class to allow reading and writing of GIF Images
//
//	It is based on code from Programming for Graphics Files	by John Levine
//
//	This is free to use and modify provided proper credit is given
//
//	This reads GIF 87a and 89a, writes only 87a.
//	This writes only 8-bit GIF files. 256 colors.
//	You provide the palette and the palettized image. 
//	This does not do quantization.
//
//
// use :
//
//	Reading:
//
//	GIFFile theGifObject;
//
//	BYTE * buf;
//	buf=theGifObject.GIFReadFileToRGB(path,&width,&height);
//
//	if (buf!=NULL) {
//		// you now have a buffer of width * height RGB pixels
//		// do whatever you like with it
//	}	else {
//		// error text
//		AfxMessageBox(theGifObject.m_GIFErrorText);
//	}
//
//	//delete the buffer when you're done
//	delete [] buf;
//
///////
//
//	Writing :
//
//	GIFFile theGifThing;
//	
//	if (!theGifThing.GIFWriteFileFrom256Color(buffer,	// BYTE * of the 256-color buffer
//							filename,					// name to save as
//							m_width,					// pixels
//							m_height,					// rows
//							0,							// background color
//							red, green, blue)) {		// arrays of 256 ints each that represent the
//														// 256-color palette for this image.
//		//Error!
//		AfxMessageBox(theGifThing.m_GIFErrorText);
//	} else {
//		// success!
//	}
//
////////////////////////////////////////////////////////////////////////////////

#ifndef GIFHDRH
#define GIFHDRH

//////////
//
//

class GIFFile 
{
public:
	GIFFile();
	~GIFFile();

public:
	CString m_GIFErrorText;

public:

	// write a file
	BOOL GIFWriteFileFrom256Color(BYTE  * buf,
							CString name,
							int GWidth, 
							int GHeight,
							int BackGround,
							int Red[], int Green[], int Blue[]);

	// read to RGB
	BYTE * GIFReadFileToRGB(CString path, 
							UINT *width, 
							UINT *height);

	// find size of file
	void GIFGetDimensions(CString path, 
							UINT *width, 
							UINT *height);
};

#endif

⌨️ 快捷键说明

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