home *** CD-ROM | disk | FTP | other *** search
- /*
- ***********************************************************************
- *
- *
- * Grayscale Image
- * Display an image on Macintosh
- *
- * This is an implementation of a class ImageView that displays (converts,
- * actually) an image into an Offscreen buffer
- *
- *
- ***********************************************************************
- */
-
- #include "ImageViews.h"
-
-
-
- // Creating a window that would have our picture
- // displayed. This function also creates an
- // offscreen grafworld and draws the picture in it
- ImageView::ImageView(const ElevationMap& elev_image)
- : OffScreenBuffer((ScreenRect)elev_image,elev_image.q_clut())
- {
- PixMapHandle pixmap = get_pixmap();
- assert( LockPixels(pixmap) );
-
- char * pixp = GetPixBaseAddr(pixmap);
- Image_istream im_istr(elev_image);
- const int pixmap_row_padding = bytes_per_row() - width();
- for(register int i=0; i<height(); i++, pixp += pixmap_row_padding)
- for(register int j=0; j<width(); j++)
- *pixp++ = im_istr.get();
- assert( im_istr.eof() );
- UnlockPixels(pixmap);
- }
-