-
大小: 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語言應用編程--隨書源代碼
評論
共有 條評論