-
大小: 223KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-06-06
- 语言: C/C++
- 标签: VC++ JPEG图片 showjpeg.rar
资源简介
VC++解析并显示JPEG图片showjpeg.rar

代码片段和文件信息
////////////////////////////////////////////////////////////
// JpegFile - A C++ class to allow reading and writing of
// RGB and Grayscale JPEG images.
// It is based on the IJG V.6 code.
// Download by http://www.codesc.net
// This class Copyright 1997 Chris Losinger
// This is free to use and modify provided my name is
// included.
//
// See jpegfile.h for usage.
//
////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “JpegFile.h“
#include “iostream.h“
#include “fstream.h“
#include
#ifdef __cplusplus
extern “C“ {
#endif // __cplusplus
#include “jpeglib.h“
#ifdef __cplusplus
}
#endif // __cplusplus
//
//
//
/*
* is used for the optional error recovery mechanism shown in
* the second part of the example.
*/
#include
// error handler to avoid those pesky exit(0)‘s
struct my_error_mgr {
struct jpeg_error_mgr pub; /* “public“ fields */
jmp_buf setjmp_buffer; /* for return to caller */
};
typedef struct my_error_mgr * my_error_ptr;
//
//
//
METHODDEF(void) my_error_exit (j_common_ptr cinfo);
//
// to handle fatal errors.
// the original JPEG code will just exit(0). can‘t really
// do that in Windows....
//
METHODDEF(void) my_error_exit (j_common_ptr cinfo)
{
/* cinfo->err really points to a my_error_mgr struct so coerce pointer */
my_error_ptr myerr = (my_error_ptr) cinfo->err;
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(*cinfo->err->format_message) (cinfo buffer);
/* Always display the message. */
MessageBox(NULLbuffer“JPEG Fatal Error“MB_IConstop);
/* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer 1);
}
// store a scanline to our data buffer
void j_putRGBScanline(BYTE *jpegline
int widthPix
BYTE *outBuf
int row);
void j_putGrayScanlineToRGB(BYTE *jpegline
int widthPix
BYTE *outBuf
int row);
//
// constructor doesn‘t do much - there‘s no real class here...
//
JpegFile::JpegFile()
{
}
//
//
//
JpegFile::~JpegFile()
{
}
//
// read a JPEG file
//
BYTE * JpegFile::JpegFileToRGB(CString fileName
UINT *width
UINT *height)
{
// basic code from IJG Jpeg Code v6 example.c
*width=0;
*height=0;
/* This struct contains the JPEG decompression parameters and pointers to
* working space (which is allocated as needed by the JPEG library).
*/
struct jpeg_decompress_struct cinfo;
/* We use our private extension JPEG error handler.
* Note that this struct must live as long as the main JPEG parameter
* struct to avoid dangling-pointer problems.
*/
struct my_error_mgr jerr;
/* More stuff */
FILE * infile=NULL; /* source file */
JSAMPARRAY buffer; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
char buf[250];
/* In this example we want to open the input file b
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 978 2016-05-17 14:43 codesc.net\jpeg的显示\BASIC.H
文件 13954 1997-09-21 15:59 codesc.net\jpeg的显示\BMPFILE.CPP
文件 942 1997-07-02 01:49 codesc.net\jpeg的显示\BMPFILE.H
文件 17456 1997-10-14 11:45 codesc.net\jpeg的显示\DL1QUANT.CPP
文件 1379 1997-10-14 11:45 codesc.net\jpeg的显示\DL1QUANT.H
文件 2641 1997-09-18 17:50 codesc.net\jpeg的显示\JCONFIG.H
文件 13632 2000-07-18 09:19 codesc.net\jpeg的显示\Jmorecfg.h
文件 11953 2016-05-17 14:43 codesc.net\jpeg的显示\Jpegfile.cpp
文件 6297 2000-11-12 11:45 codesc.net\jpeg的显示\Jpegfile.h
文件 46297 1997-09-18 17:53 codesc.net\jpeg的显示\JPEGLIB.H
文件 913846 2000-07-18 09:22 codesc.net\jpeg的显示\JPEGLIB2.lib
文件 3328 2016-05-17 14:43 codesc.net\jpeg的显示\Mainfrm.cpp
文件 1173 2000-08-17 10:40 codesc.net\jpeg的显示\MAINFRM.H
文件 32228 2010-04-21 14:02 codesc.net\jpeg的显示\mfcapp.aps
文件 3233 2010-04-21 14:02 codesc.net\jpeg的显示\mfcapp.clw
文件 3921 2016-05-17 14:43 codesc.net\jpeg的显示\Mfcapp.cpp
文件 988 2000-07-25 08:30 codesc.net\jpeg的显示\Mfcapp.dep
文件 5471 2000-11-12 12:40 codesc.net\jpeg的显示\Mfcapp.dsp
文件 535 2000-06-02 15:59 codesc.net\jpeg的显示\Mfcapp.dsw
文件 929 2000-08-08 15:38 codesc.net\jpeg的显示\Mfcapp.h
文件 7428 2000-07-25 08:31 codesc.net\jpeg的显示\Mfcapp.mak
文件 36864 1997-12-28 11:32 codesc.net\jpeg的显示\MFCAPP.MDP
文件 12330 2000-10-15 18:23 codesc.net\jpeg的显示\mfcapp.rc
文件 1769 2016-05-17 14:43 codesc.net\jpeg的显示\MFCDOC.CPP
文件 1037 1997-05-08 12:48 codesc.net\jpeg的显示\MFCDOC.H
文件 6963 2016-05-17 14:43 codesc.net\jpeg的显示\Mfcview.cpp
文件 1847 2000-10-15 18:01 codesc.net\jpeg的显示\Mfcview.h
文件 1532 1997-10-14 11:42 codesc.net\jpeg的显示\QUANTDLG.CPP
文件 1283 1997-10-14 11:11 codesc.net\jpeg的显示\QUANTDLG.H
文件 1270 2000-08-25 15:02 codesc.net\jpeg的显示\RES\bitmap1.bmp
............此处省略15个文件信息
- 上一篇:C++写的车辆信息管理系统
- 下一篇:Linux下C语言应用编程--随书源代码
相关资源
- VC++ 多线程文件读写操作
- 移木块游戏,可以自编自玩,vc6.0编写
- VC++MFC小游戏实例教程(实例)+MFC类库
- VC++实现CMD命令执行与获得返回信息
- VC++基于OpenGL模拟的一个3维空间模型
- 基于VC++的SolidWorks二次开发SolidWorks
- 派克变换VC++源码(附文档)
- VC++ 串口
- VC++ 大富翁4_大富翁游戏源码
- VC++ 摄像头视频采集与回放源程序
- 转 VC++ 实现电子邮件(Email)发送
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- VC++ 服务程序编写及安装与卸载
- VC++6.0番茄西红柿VAXvirsual assist X完美破
- 基于改进的fcm算法的图像分割vc++
- VC++6.0 绿色版,免安装,非常好用。
- Microsoft Visual C++ 2005 Redistributable Pack
- VC++MFC课程设计的学生成绩管理系统
- 大智慧365DLL插件设计
- VC++6.0汉化包
- VC++完整商业界面源码(再上传)
- VC++编程技术600个大型项目源码.rar
- VC++实现RSA加密算法
- VC++ 中国象棋经典游戏源代码
- 郁金香VC++游戏辅助视频教程
- C语言进阶源码---基于graphics实现图书
- 摄影测量相对定向VC++程序
- VC++数字图像处理典型算法及实现
- VC++酒店客房管理系统 MFC
- 车站计算机联锁vc++6.0程序代码
评论
共有 条评论