SDI MDI SDI Single Document Interface MDI Multiple

  • Slides: 33
Download presentation

도큐먼트/뷰 구조 • SDI와 MDI – 다룰 수 있는 문서의 개수에 따라 구분 SDI

도큐먼트/뷰 구조 • SDI와 MDI – 다룰 수 있는 문서의 개수에 따라 구분 SDI : Single Document Interface MDI : Multiple Document Interface 13

MDI 응용 프로그램 구조 • 주요 객체 사이의 참조 Get. First. View. Position &

MDI 응용 프로그램 구조 • 주요 객체 사이의 참조 Get. First. View. Position & Get. Next. View 도큐먼트 뷰 Get. Document Get. Active. Document Get. Doc. Template Get. Active. View Get. Parent. Frame 도큐먼트 프레임 윈도우 MDIGet. Active 또는 Get. Active. Frame Get. First. Doc. Position & Get. Next. Doc 메인 윈도우 Afx. Get. Main. Wnd m_p. Main. Wnd 도큐먼트 응용 프로그램 템플릿 Get. First. Doc. Template. Position & Get. Next. Doc. Template Afx. Get. App 16

Document Class • 영상 데이터 선언 Win. Test. Doc. h 27

Document Class • 영상 데이터 선언 Win. Test. Doc. h 27

Document Class • 파일 (RAW 형식) 읽기/쓰기 Win. Test. Doc. cpp void CTest. Doc:

Document Class • 파일 (RAW 형식) 읽기/쓰기 Win. Test. Doc. cpp void CTest. Doc: : Serialize(CArchive& ar) { if (ar. Is. Storing()) { // TODO: add storing code here ar. Write(m_Out. Img, 256*256); // 처리된 영상배열 m_Out. Img를 파일로 저장 } else { // TODO: add loading code here CFile *infile = ar. Get. File(); // 입력할 화일의 포인트를 가져옴. if(infile->Get. Length()!=256*256) // 화일 사이즈를 검사함 { Afx. Message. Box("파일 크기가 256 x 256사이즈가 아닙니다. "); return; } ar. Read(m_In. Img, infile->Get. Length()); // 영상파일을 읽어 m_In. Img배열에 저장 } } 28

View Class • 화면 출력 Win. Test. View. cpp void CWin. Test. View: :

View Class • 화면 출력 Win. Test. View. cpp void CWin. Test. View: : On. Draw(CDC* p. DC) { CWin. Test. Doc* p. Doc = Get. Document(); ASSERT_VALID(p. Doc); // TODO: add draw code for native data here for(int i=0; i<256; i++) { for(int j=0; j<256; j++) { unsigned char In. Val= p. Doc->m_In. Img[i][j]; unsigned char Out. Val= p. Doc->m_Out. Img[i][j]; } } } p. DC->Set. Pixel(j, i, RGB(In. Val, In. Val)); p. DC->Set. Pixel(j+300, i, RGB(Out. Val, Out. Val)); 29