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

📄 jpeg.h

📁 将JPEG图像解压为BMP图像。 内含图像处理的一些基本函数。
💻 H
字号:
// Jpeg.h: interface for the CJpeg class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_JPEG_H__63087660_0165_11D3_9481_000021003EA5__INCLUDED_)
#define AFX_JPEG_H__63087660_0165_11D3_9481_000021003EA5__INCLUDED_

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

#include "Dib.h"

class CJpeg  
{
public:
	CJpeg();
	virtual ~CJpeg();


public:
     
	// 载入JPEG文件
	BOOL Load(LPCSTR fileName);
	// 存储JPEG文件
	BOOL Save(LPCSTR fileName, CDib *m_pdib, int nQuality = 75);
	// 获取错误信息
	CString GetErrorString();
	//新加:指向解压后读入内存的BMP图像
	LPBYTE lpDIB2;

	
private:
	
	//读取JPEG文件到缓冲区
	BYTE* ReadJPEGFile(LPCSTR fileName, UINT *uWidth, UINT *uHeight, int *n);

	
	//将位图文件存储为JPEG文件
	BOOL WriteJPEGFile(LPCTSTR fileName,	// path
					   BYTE *dataBuf,			// RGB buffer
					   UINT width,				// pixels
					   UINT height,				// rows
					   BOOL color,				// TRUE = RGB
												// FALSE = Grayscale
    				   int quality);			// 0 - 100

	////////////////////////////////////////////////////////////////
	// allocates a DWORD-aligned buffer, copies data buffer
	// caller is responsible for delete []'ing the buffer

	BYTE* MakeDwordAlign(BYTE *dataBuf,			// input buf
						 UINT widthPix,				// input pixels
						 UINT height,				// lines
						 UINT *uiOutWidthBytes,
						 int n);	// new width bytes


	void FreeBuffer(BYTE *Buffer);
	////////////////////////////////////////////////////////////////
	// if you have a DWORD aligned buffer, this will copy the
	// RGBs out of it into a new buffer. new width is widthPix * 3 bytes
	// caller is responsible for delete []'ing the buffer
	
	BYTE *ClearDwordAlign(BYTE *inBuf,				// input buf
						UINT widthPix,				// input size
						UINT widthBytes,			// input size
						UINT height, int n);
	BOOL VertFlipBuf(BYTE * inbuf,						// input buf
				   UINT widthBytes,							// input width bytes
				   UINT height);							// height
	BOOL BGRFromRGB(BYTE *buf,							// input buf
					UINT widthPix,								// width in pixels
					UINT height);								// lines

	// data
	CString m_strJPEGError;

//data
public:
    //CDib对象
	CDib m_dib;
private:
	
};

#endif // !defined(AFX_JPEG_H__63087660_0165_11D3_9481_000021003EA5__INCLUDED_)

⌨️ 快捷键说明

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