home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / PGL.ZIP / PGLBS.ZIP / BM.BAS next >
Encoding:
BASIC Source File  |  1992-01-20  |  1.7 KB  |  61 lines

  1. '*****************************************************************************
  2. '  BM.BAS
  3. '
  4. '  This sample program demontsrates the use of the Bitmap functions
  5. '  to save a bitmap image, a row at a time into a PGL drawing file.
  6. '  The example getpixel function returns 0-color values for even rows
  7. '  and 1-color values for odd rows.
  8. '****************************************************************************
  9. '$INCLUDE: 'PGL.BAS'
  10.  
  11.      declare function getpixel% (i%,j%)
  12.  
  13.      dim rowdata%(1 to 640)
  14. '    
  15. '    Open A Drawing File.
  16. '    
  17.      call pgInitDrw( "bm.plt", 640,480, ierr% ) 
  18.      if ierr% <> 0 then
  19.        print ' Error opeing drawing file'
  20.        goto exitpgm
  21.      endif
  22. '
  23. '    Initialize a PGL drawing file bitmap 
  24. '
  25.      maxX%     = 640
  26.      maxY%     = 480
  27.      bpp%      = 1
  28.      compress% = 1
  29.      call pgBMInit(0,0,maxX%,maxY%,bpp%,compress%)
  30. '
  31. '    Save a screen bitmap, for printing.
  32. '    This code sample assumes you have a 'getpixel' function
  33. '    to return each screen pixel color, a dummy 'getpixel' is used
  34. '    below...
  35. '
  36.      for j%=1 to maxY%
  37.        for i%=1 to maxX%
  38.          rowdata%(i%) = getpixel%(i%,j%) 
  39.        next
  40.        call pgBMData( j%, rowdata%(1) )
  41.      next
  42. '
  43. '    Termmiante the bitmap 
  44. '
  45.      call pgBMEnd
  46. '
  47. '    Close The Drawing File.
  48. '    
  49.      call pgEndDrw 
  50. '
  51. exitpgm:
  52. '
  53. END
  54. '-------------------------------------------------------------------------
  55. '  dummy getpixel function - replace with one from your screen graphics
  56. '  library
  57. '-------------------------------------------------------------------------
  58.       function getpixel% (i%,j%)
  59.         getpixel% = j% mod 2
  60.       end function 
  61.