home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff374.lzh / PopArt / sorcery / popChip.c < prev    next >
C/C++ Source or Header  |  1990-10-08  |  883b  |  32 lines

  1.  
  2. #include <intuition/intuition.h>
  3.  
  4.     /*  this works under Manx (16 bit ints).  It's better than declaring
  5.         everything as "chip" (which my compiler tragically can't do),
  6.         since it only uses chip memory for as long as needed.  
  7.         
  8.         It needs the global "win" defined somehow.      */
  9.  
  10.         struct Image thing = { 0, 0, 32, 24, 5, NL, 0x1f, 0, NL },
  11.  
  12.  
  13.                                             void
  14. popChip (array, size, xsize, ysize, xx, yy) 
  15.  USHORT *array; long size; 
  16. {
  17.     REG USHORT *myChip;
  18.  
  19.  
  20.     if (!(myChip = (USHORT *) AllocMem (size, MEMF_CHIP | MEMF_CLEAR)))
  21.         {  /* puts ("Can't do it - no chips left!"); */ return;  }
  22.  
  23.     CopyMem (array, myChip, size);
  24.     thing.ImageData = myChip;
  25.     thing.Width     = xsize;
  26.     thing.Height    = ysize;
  27.     DrawImage (win->RPort, &thing, (long) xx, (long) yy);
  28.     FreeMem (myChip, size);
  29.  
  30. }
  31.  
  32.