- // Video DemoDoc.cpp : implementation of the CVideoDemoDoc class
- //
- #include "stdafx.h"
- #include "Video Demo.h"
- #include "Video DemoDoc.h"
- #include "Video DemoView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDemoDoc
- IMPLEMENT_DYNCREATE(CVideoDemoDoc, CDocument)
- BEGIN_MESSAGE_MAP(CVideoDemoDoc, CDocument)
- //{{AFX_MSG_MAP(CVideoDemoDoc)
- // 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()
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDemoDoc construction/destruction
- CVideoDemoDoc::CVideoDemoDoc()
- {
- // TODO: add one-time construction code here
- // TODO: add one-time construction code here
- id = NULL;
- ms = NULL;
- image = false;
- video = false;
- }
- CVideoDemoDoc::~CVideoDemoDoc()
- {
- }
- BOOL CVideoDemoDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDemoDoc serialization
- void CVideoDemoDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDemoDoc diagnostics
- #ifdef _DEBUG
- void CVideoDemoDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
- void CVideoDemoDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDemoDoc commands
- /************************************************************************/
- /* 写入他图像数据 */
- /************************************************************************/
- void CVideoDemoDoc::SetData(unsigned char *data,int imgWidth,int imgHeight,int bytesPerPixel,int format)
- {
- // 写入数据到当前文档
- }
- /************************************************************************/
- /* 直接从图像结构中读取 数据 */
- /************************************************************************/
- void CVideoDemoDoc::SetData(ImageData *id)
- {
- if(id != NULL)
- {
- this->id = id;
- id->coreDoc = (CDocument *)this; // 设置拥有显示权的文档
- image = true;
- }
- }
- /************************************************************************/
- /* 刷新View视图 */
- /************************************************************************/
- void CVideoDemoDoc::RefreshView()
- {
- POSITION pos = this->GetFirstViewPosition();
- CVideoDemoView * view = (CVideoDemoView *)this->GetNextView(pos);
- view->RefreshData();
- //this->UpdateAllViews(NULL);
- }
- /************************************************************************/
- /* 设置视频源数据 */
- /************************************************************************/
- void CVideoDemoDoc::SetVideoSource(VideoData *ms)
- {
- // 如果源数据不是空的,那么加入该源数据
- if(ms != NULL)
- {
- video = true; // 设置为视频状态
- this->ms = ms; // 设置视频序列
- ms->doc = (CDocument *)this;
- }
- }