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

📄 opnfile.h

📁 正交变换.rar文件压缩的基础知识无毒good
💻 H
字号:
#include "stdafx.h"
//#include "JpegFile.h"
#include <stdio.h>

 
BYTE * OpenJPG(CString fileName,long *width,long *height)
{
//	BYTE * pData;
//	if(fileName=="")
		return NULL;

//	pData=JpegFile::JpegFileToRGB(fileName,width, height);
 
//	return pData;
}

BYTE * OpenBMP(CString fileName,long *width,long *height)
{
	BYTE * pData;
	*width = 0;
	*height = 0;
	if(fileName=="")
		return NULL;

	BITMAPINFO bmpInfo;
	BITMAPFILEHEADER bmpFileHead;
	CFile file;
	if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
	{
		AfxMessageBox("Can not open the file");
		return NULL;
	}
 
	file.Read(&bmpFileHead,sizeof(BITMAPFILEHEADER));
	file.Read(&bmpInfo,sizeof(BITMAPINFOHEADER));
	BYTE *RGBQUAD=new BYTE[1024];/////////修正bug。原来没有
	file.Read(RGBQUAD,1024);     //////// read后指针才真正到达数据开始点
	                             ////////闫允一 2003.3.6

	*width = bmpInfo.bmiHeader.biWidth;
 	*height = bmpInfo.bmiHeader.biHeight;
	long lFileSize = bmpFileHead.bfSize - bmpFileHead.bfOffBits;
	pData = (BYTE*)new char[lFileSize];
	if(!pData)
		return NULL;

 	file.ReadHuge(pData,lFileSize);
	file.Close();

 	return pData;

}

BYTE * OpenRAW(CString fileName,long *width,long *height)
{
	BYTE * pData;


	if(fileName=="")
		return FALSE;

	//*width = 352;
	//*height = 240;
 	
	CFile file;
	if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
	{
		AfxMessageBox("Can not open the file");
		return NULL;
	}
 	DWORD lFileSize=file.GetLength();
	//*width=sqrt(lFileSize);
	//*height=sqrt(lFileSize);
	//long lFileSize = (*width) * (*height);
	pData = (BYTE*)new char[lFileSize];

	if(!pData)
		return NULL;

 	file.ReadHuge(pData,lFileSize);
	file.Close();

	return pData;

}

BYTE * OpenGRAY(CString fileName,long *width,long *height)
{
	BYTE * pData;
	if(fileName=="")
		return FALSE;

	*width = 360;
	*height = 288;
 	long lFileSize = (*width) * (*height);
	pData = (BYTE*)new char[lFileSize];

	CFile file;
	if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
	{
		AfxMessageBox("Can not open the file");
		return NULL;
	}
 	 
	if(!pData)
		return NULL;

 	file.ReadHuge(pData,lFileSize);
	file.Close();


	return pData;

}

BYTE * OpenSIF(CString fileName,long *width,long *height)
{
	BYTE * pData;
	if(fileName=="")
		return FALSE;

	*width = 352;
	*height = 240;
 	long lFileSize = (*width) * (*height);
	pData = (BYTE*)new char[lFileSize];

	CFile file;
	if((file.Open(fileName,CFile::modeRead|CFile::shareDenyNone))==NULL)
	{
		AfxMessageBox("Can not open the file");
		return NULL;
	}
 	 
	if(!pData)
		return NULL;

 	file.ReadHuge(pData,lFileSize);
	file.Close();


	return pData;

}

⌨️ 快捷键说明

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