home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Misc / a2 / Source / WozView.m < prev   
Encoding:
Text File  |  1992-03-13  |  1.7 KB  |  84 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "WozView.h"
  5. #import "hgrconv.h"
  6. #import <appkit/graphics.h>
  7. #import <appkit/NXBitmapImageRep.h>
  8. #import <appkit/tiff.h>
  9. #import <string.h>
  10.  
  11. @implementation WozView
  12.  
  13. - initFrame:(const NXRect *) frameRect
  14. {
  15.   [super initFrame:frameRect];
  16.  
  17.   memset (fbuf, 0, sizeof fbuf);            /* Clear to black. */
  18.   return self;
  19. }
  20.  
  21. - drawSelf:(const NXRect *) rects: (int) rectCount
  22. {
  23.   NXImageBitmap (&bounds, 280, 192, 2, 1, NX_MESHED, NX_MONOTONICMASK, fbuf,
  24.          NULL, NULL, NULL, NULL);
  25.   
  26.   return self;
  27. }
  28.  
  29.  
  30. - drawChangedAreas:(const unsigned char *) a2_screen
  31.                    shadow:(unsigned char *) a2_shadow
  32. {
  33.   unsigned char changed[192 / 16];
  34.   NXRect r = bounds;
  35.   int i, start, height;
  36.  
  37.   [self lockFocus];
  38.  
  39.   /* Find out what areas changed, if any. */
  40.   if (find_changed_areas (a2_screen, a2_shadow, changed))
  41.     {
  42.       for (i = 0; i < sizeof changed; i++)
  43.     if (changed[i])
  44.       {
  45.         start = i * 16;
  46.         for (i++; i < sizeof changed && changed[i]; i++);
  47.         height = i * 16 - start;
  48.         r.origin.y = (192 - (start + height)) * 2.0;
  49.         r.size.height = height * 2.0;  /*  * 2.0 since we are scaled. */
  50.         apple_to_next (a2_screen, fbuf, start, height);
  51.         NXImageBitmap (&r, 288, height, 2, 1, NX_MESHED, NX_MONOTONICMASK,
  52.                &fbuf[start][0], NULL, NULL, NULL, NULL);
  53.       }
  54.       copy_changed_areas (a2_screen, a2_shadow, changed);
  55.     }
  56.  
  57.   [self unlockFocus];
  58.  
  59.   return self;
  60. }
  61.  
  62.  
  63. - (unsigned char *) data
  64. {
  65.   return &fbuf[0][0];
  66. }
  67.  
  68.  
  69. - appDidInit:(id) sender
  70. {
  71.   char *foo = "a2";
  72.   extern id screen_wozview;
  73.   extern unsigned char *wozview_buf;
  74.  
  75.   screen_wozview = self;
  76.   wozview_buf = &fbuf[0][0];
  77.  
  78.   simulator_main (1, &foo);
  79.   return self;
  80. }
  81.  
  82. @end
  83.  
  84.