- // ddDoc.cpp : implementation of the CDdDoc class
- //
- #include "stdafx.h"
- #include "dd.h"
- #include "ddDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDdDoc
- IMPLEMENT_DYNCREATE(CDdDoc, CDocument)
- BEGIN_MESSAGE_MAP(CDdDoc, CDocument)
- //{{AFX_MSG_MAP(CDdDoc)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDdDoc construction/destruction
- CDdDoc::CDdDoc()
- : pSrcImg(NULL)
- , height(0)
- , width(0)
- {
- // TODO: add one-time construction code here
- }
- CDdDoc::~CDdDoc()
- {
- }
- BOOL CDdDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CDdDoc serialization
- void CDdDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CDdDoc diagnostics
- #ifdef _DEBUG
- void CDdDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
- void CDdDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CDdDoc commands
- BOOL CDdDoc::OnOpenDocument(LPCTSTR lpszPathName)
- {
- if (!CDocument::OnOpenDocument(lpszPathName))
- return FALSE;
- // TODO: Add your specialized creation code here
- myimage.Load(lpszPathName);
- width = myimage.Width();
- height = myimage.Height();
- pSrcImg = cvCreateImage(cvSize(width, height), 8, 1);
- pSrcImg = myimage.GetImage();
- return TRUE;
- }