BitmapViewer.h
2.35 KB
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
#if !defined(AFX_BITMAPVIEWER_H__3A85192A_6B8B_4A76_B2CC_76604DCC2DB8__INCLUDED_)
#define AFX_BITMAPVIEWER_H__3A85192A_6B8B_4A76_B2CC_76604DCC2DB8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BitmapViewer.h : header file
//
namespace MoDIS
{
namespace MTE
{
//////////////////////////////////////////////////////////////////////
// BitmapViewer window
class Bitmap;
class BitmapViewer : public CWnd
{
// Construction
public:
BitmapViewer();
virtual ~BitmapViewer();
private:
BitmapViewer(const BitmapViewer &);
BitmapViewer& operator=(const BitmapViewer &);
public:
void SetBitmap(Bitmap *bitmap);
void ClearBitmap();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(BitmapViewer)
//}}AFX_VIRTUAL
protected:
// Generated message map functions
//{{AFX_MSG(BitmapViewer)
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT flags, CPoint point);
afx_msg void OnMouseMove(UINT flags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
bool RegisterWindowClass();
bool IsHorizontallyDraggable();
bool IsVerticallyDraggable();
private:
Bitmap *m_Bitmap;
POINT m_DestCoordinate;
POINT m_SrcCoordinate;
int m_SrcWidth;
int m_SrcHeight;
CRect m_DisplayRect;
CPoint m_LastPoint;
};
class Bitmap
{
public:
Bitmap(char *bitmapBuffer, BITMAPINFOHEADER bitmapInfoHeader);
Bitmap(const Bitmap &rhs);
~Bitmap();
private:
Bitmap& operator=(const Bitmap &);
public:
const char* GetBuffer() const;
int GetWidth() const;
int GetHeight() const;
BITMAPINFOHEADER GetInfoHeader() const;
int GetSize() const;
private:
char *m_Buffer;
int m_Width;
int m_Height;
BITMAPINFOHEADER m_BitmapInfoHeader;
};
}
}
#endif // !defined(AFX_BITMAPVIEWER_H__3A85192A_6B8B_4A76_B2CC_76604DCC2DB8__INCLUDED_)