1 / 10

Image Buffer

Image Buffer. Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. Outline. Image Buffer Tools library Document View. Image Buffer. Image Buffer Logically 2 dimensional array Physically (in memory)

joann
Download Presentation

Image Buffer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Image Buffer Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

  2. Outline • Image Buffer • Tools library • Document • View Image Buffer

  3. Image Buffer • Image Buffer • Logically • 2 dimensional array • Physically (in memory) • Usually 1 dimensional array Image Buffer

  4. Image Buffer • A 512 * 512 image (logically) • 2-byte per pixel • Max gray level = 4095 W = 512 H = 512 Image Buffer

  5. Image Buffer • A 512 * 512 image (physically) • 2-byte per pixel • Create (allocate) • short * pImage = (short *) malloc(512*512*sizeof(short)); • Use (access) • *(pImage+y*512+x) = 4095 • Destroy (free) • free(pImage) Image Buffer

  6. Tools Library • Providing a function to display a 2-byte image buffer on the screen • void ShowImage_2B(CDC * pDC, short * pImage, int nWidth, int nHeight); • Consisting of • tools.lib • tools.h • Adding these two files into your project. Image Buffer

  7. C***Document : public CDocument Add data Image buffer short * m_pImage; int m_nWidth; int m_nHeight; Add core functions short * GetImageBuffer() int GetImageWidth() int GetImageHeight() Constructor (C***Document) Initialization Destructor (~C***Document) Release resources Document Image Buffer

  8. View • C***View : public CView • Process WM_PAINT message • #include “tools.h” • C***View::OnDraw(CDC * pDC){ ShowImage_2B( pDC, pDoc->GetImageBuffer(), pDoc->GetImageWidth(), pDoc->GetImageHeight() );} Image Buffer

  9. Result Image Buffer

  10. Result Image Buffer

More Related