forked from qiutianshuchangsha/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJpegFile.h
92 lines (77 loc) · 2.6 KB
/
JpegFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once
#if !defined(AFX_JPEGFILE_H__7B4DD98B_945B_11D2_815A_444553540000__INCLUDED_)
#define AFX_JPEGFILE_H__7B4DD98B_945B_11D2_815A_444553540000__INCLUDED_
//#define HAVE_BOOLEAN
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
class JpegFile
{
public:
unsigned long m_lWidth;
unsigned long m_lHeight;
unsigned long m_dwPoint;
DWORD m_dwOutMaxSize;
BYTE * m_lpOutBuffer;
BYTE * m_lpPreData;
DWORD m_dwScreenMaxSize;
BYTE * m_lpScreenBuffer;
DWORD m_dwFrame;
bool m_bOpening;
CFile m_rFile;
JpegFile(void);
~JpegFile(void);
BYTE * JpegFileToRGB(BYTE *dataBuf, // path to image
unsigned long size,
UINT *width, // image width in pixels
UINT *height); // image height
BOOL RGBToJpegFile( // path
BYTE *dataBuf, // RGB buffer
BYTE *outBuf,
UINT width, // pixels
UINT height, // rows
BOOL color, // TRUE = RGB
// FALSE = Grayscale
int quality,
unsigned long *size); // 0 - 100
BOOL GetJPGDimensions(CString fileName, // path
UINT *width, // pixels
UINT *height);
BYTE * MakeDwordAlignedBuf(BYTE *dataBuf, // input buf
UINT widthPix, // input pixels
UINT height, // lines
UINT *uiOutWidthBytes); // new width bytes
BYTE * JpegFile::MovetoBuf(BYTE *dataBuf,
CRect *prcRect, // pixels!!
UINT widthNew,
UINT heightNew); // bytes!!!
BYTE *RGBFromDWORDAligned(BYTE *inBuf, // input buf
UINT widthPix, // input size
UINT widthBytes, // input size
UINT height);
BOOL VertFlipBuf(BYTE * inbuf, // input buf
UINT widthBytes, // input width bytes
UINT height); // height
BOOL MakeGrayScale(BYTE *buf, // input buf
UINT widthPix, // width in pixels
UINT height,
BOOL turn = false); // height
BOOL BGRFromRGB(BYTE *buf, // input buf
UINT widthPix, // width in pixels
UINT height); // lines
BYTE *BMPtoFix(unsigned char * lpData,
unsigned long *lWidth ,
unsigned long *lHeight,
unsigned long *lHeadSize,
unsigned long *lSize);
void DeletePreData();
BYTE *FixtoBMP(unsigned char * lpInData,
unsigned long lWidth ,
unsigned long lHeight,
unsigned char * lpHeadData,
unsigned long lHeadSize,
unsigned long w,
unsigned long h) ;
BYTE * LoadBMP(LPSTR lpData,
unsigned long *lWidth,
unsigned long *lHeight);
};
#endif