home *** CD-ROM | disk | FTP | other *** search
- '*****************************************************************************
- ' BM.BAS
- '
- ' This sample program demontsrates the use of the Bitmap functions
- ' to save a bitmap image, a row at a time into a PGL drawing file.
- ' The example getpixel function returns 0-color values for even rows
- ' and 1-color values for odd rows.
- '****************************************************************************
- '$INCLUDE: 'PGL.BAS'
-
- declare function getpixel% (i%,j%)
-
- dim rowdata%(1 to 640)
- '
- ' Open A Drawing File.
- '
- call pgInitDrw( "bm.plt", 640,480, ierr% )
- if ierr% <> 0 then
- print ' Error opeing drawing file'
- goto exitpgm
- endif
- '
- ' Initialize a PGL drawing file bitmap
- '
- maxX% = 640
- maxY% = 480
- bpp% = 1
- compress% = 1
- call pgBMInit(0,0,maxX%,maxY%,bpp%,compress%)
- '
- ' Save a screen bitmap, for printing.
- ' This code sample assumes you have a 'getpixel' function
- ' to return each screen pixel color, a dummy 'getpixel' is used
- ' below...
- '
- for j%=1 to maxY%
- for i%=1 to maxX%
- rowdata%(i%) = getpixel%(i%,j%)
- next
- call pgBMData( j%, rowdata%(1) )
- next
- '
- ' Termmiante the bitmap
- '
- call pgBMEnd
- '
- ' Close The Drawing File.
- '
- call pgEndDrw
- '
- exitpgm:
- '
- END
- '-------------------------------------------------------------------------
- ' dummy getpixel function - replace with one from your screen graphics
- ' library
- '-------------------------------------------------------------------------
- function getpixel% (i%,j%)
- getpixel% = j% mod 2
- end function