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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// 20063703View.cpp : implementation of the CMy20063703View class
//
 
#include "stdafx.h"
#include "20063703.h"
 
#include "20063703Doc.h"
#include "20063703View.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
/////////////////////////////////////////////////////////////////////////////
// CMy20063703View
 
IMPLEMENT_DYNCREATE(CMy20063703View, CScrollView)
 
BEGIN_MESSAGE_MAP(CMy20063703View, CScrollView)
    //{{AFX_MSG_MAP(CMy20063703View)
    ON_COMMAND(ID_DILATION, OnDilation)
    ON_COMMAND(IS_EROSION, OnErosion)
    ON_COMMAND(ID_PREWITT, OnPrewitt)
    //}}AFX_MSG_MAP
    // Standard printing commands
    ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
    ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
 
/////////////////////////////////////////////////////////////////////////////
// CMy20063703View construction/destruction
 
CMy20063703View::CMy20063703View()
{
    // TODO: add construction code here
 
}
 
CMy20063703View::~CMy20063703View()
{
}
 
BOOL CMy20063703View::PreCreateWindow(CREATESTRUCT& cs)
{
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
 
    return CScrollView::PreCreateWindow(cs);
}
 
/////////////////////////////////////////////////////////////////////////////
// CMy20063703View drawing
 
void CMy20063703View::OnDraw(CDC* pDC)
{
    CMy20063703Doc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
 
    // TODO: add draw code for native data here
    for(int y=0; y<256; y++)
    {
        for(int x=0; x<256; x++)
        {
            pDC->SetPixel(x,y,RGB(pDoc->m_OpenImg[y][x],
                                  pDoc->m_OpenImg[y][x],
                                  pDoc->m_OpenImg[y][x]));
        }
    }
    //Result Image 출력
    for(y=0; y<256; y++)
        {
            for(int x=0; x<256; x++)
            {
                pDC->SetPixel(x+300,y,RGB(pDoc->m_ResultImg[y][x],
                    pDoc->m_ResultImg[y][x],
                    pDoc->m_ResultImg[y][x]));
            }
        }
     
}
 
void CMy20063703View::OnInitialUpdate()
{
    CScrollView::OnInitialUpdate();
    CSize sizeTotal;
    // TODO: calculate the total size of this view
    sizeTotal.cx = sizeTotal.cy = 100;
    SetScrollSizes(MM_TEXT, sizeTotal);
}
 
/////////////////////////////////////////////////////////////////////////////
// CMy20063703View printing
 
BOOL CMy20063703View::OnPreparePrinting(CPrintInfo* pInfo)
{
    // default preparation
    return DoPreparePrinting(pInfo);
}
 
void CMy20063703View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add extra initialization before printing
}
 
void CMy20063703View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add cleanup after printing
}
 
/////////////////////////////////////////////////////////////////////////////
// CMy20063703View diagnostics
 
#ifdef _DEBUG
void CMy20063703View::AssertValid() const
{
    CScrollView::AssertValid();
}
 
void CMy20063703View::Dump(CDumpContext& dc) const
{
    CScrollView::Dump(dc);
}
 
CMy20063703Doc* CMy20063703View::GetDocument() // non-debug version is inline
{
    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMy20063703Doc)));
    return (CMy20063703Doc*)m_pDocument;
}
 
#endif //_DEBUG
 
void CMy20063703View::OnDilation()
{
    // TODO: Add your command handler code here
    CMy20063703Doc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
     
    pDoc->Dilation();
     
    Invalidate(FALSE); 
}
 
void CMy20063703View::OnErosion()
{
    // TODO: Add your command handler code here
    CMy20063703Doc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
     
    pDoc->Erosion();
     
    Invalidate(FALSE); 
}
 
void CMy20063703View::OnPrewitt()
{
    // TODO: Add your command handler code here
    CMy20063703Doc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
     
    pDoc->Prewitt();
     
    Invalidate(FALSE);
}
 
<SPAN id=tx_marker_caret></SPAN>


Posted by 코딩하는 야구쟁이
,