-
Notifications
You must be signed in to change notification settings - Fork 0
/
BitmapPrinter.h
executable file
·45 lines (35 loc) · 1.15 KB
/
BitmapPrinter.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
// BitmapPrinter.h: interface for the CBitmapPrinter class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BITMAPPRINTER_H__6034B137_6219_4914_99DB_6A7DDF94896D__INCLUDED_)
#define AFX_BITMAPPRINTER_H__6034B137_6219_4914_99DB_6A7DDF94896D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define PRINT_FACTOR1 1 // factor for 1 Bit color depth printers (black&white)
#define PRINT_FACTOR2 2 // factor for <8 Bit color depth printers
#define PRINT_FACTOR3 4 // other
int GetPrintFactor (CDC* pDC, bool bPreview);
class CBitmapPrinter
{
public:
CBitmapPrinter(int x, int y, int nWidth, int nHeight);
virtual ~CBitmapPrinter();
CDC* Attach (CDC* pDC, bool bPreview);
void Release();
private:
void PrintBitmap ();
HANDLE Bitmap2DIB ();
HANDLE DDBToDIB (CBitmap& bitmap, DWORD dwCompression, CPalette* pPal);
CDC* m_pDCRender;
CDC* m_pDC;
CBitmap m_bmpPrint;
CBitmap* m_pBmpOld;
int m_x;
int m_y;
int m_nWidth;
int m_nHeight;
protected:
CPalette m_Palette;
};
#endif // !defined(AFX_BITMAPPRINTER_H__6034B137_6219_4914_99DB_6A7DDF94896D__INCLUDED_)