home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / compiler / samplew3.bas < prev    next >
BASIC Source File  |  1993-11-13  |  2KB  |  131 lines

  1.  
  2.  
  3. rem
  4. rem test program for windows print
  5. rem
  6.  
  7.  
  8.     screen 12
  9.  
  10.  
  11.     rem
  12.     rem create some graphics in a memory bitmap
  13.     rem
  14.  
  15.     createbitmap 1,0,400,200
  16.     selectbitmap 1
  17.     line (0,0)-(400,200),15,bf       : rem clear bitmap
  18.     for i=0 to 15
  19.        line (0,i*10)-(200,(i*10)+8),i,bf
  20.     next i
  21.  
  22.  
  23.     rem
  24.     rem read in a picture to a second bitmap
  25.     rem
  26.  
  27.     createbitmap 2,0,167,126
  28.     selectbitmap 2
  29.     pxsize=167
  30.     pysize=126
  31.     loadbitmap "samplew3.bmp",0,0,0,0,0,pxsize,pysize,0,xmult,ymult
  32.  
  33.  
  34.  
  35.  
  36.     selectdisplay
  37.  
  38.     rem
  39.     rem copy from memory bitmap to display
  40.     rem
  41.     copybits 1,0,0,400,200,display,0,0,0
  42.  
  43.     copybits 2,0,0,167,126,display,100,200,0
  44.  
  45.     stretchbits 2,0,0,250,180,display,300,200,167,126,0
  46.  
  47.  
  48.  
  49.  
  50.     rem
  51.     rem Now talk to printer
  52.     rem
  53.  
  54.     printcontrol 0:    rem this opens printer
  55.  
  56.     selectprint   :    rem this selects as output divice
  57.  
  58.     mmwide=device(4)
  59.     pixelswide=device(8);   : rem how wide is print area in pixels
  60.     pixelsdown=device(10)   : rem how tall is print area in pixels
  61.  
  62.  
  63.     rem
  64.     rem Now write something directly to print area
  65.     rem
  66.  
  67.     line (0,400)-(400,400),15  : rem this sets background to white
  68.  
  69.     for i=0 to 15
  70.        line (0,i*10)-(200,(i*10)+8),i,bf
  71.     next i
  72.  
  73.  
  74.     rem
  75.     rem Copy bitmap 1 picture to print surface
  76.     rem
  77.  
  78.     copybits 1,0,0,400,200,print,pixelswide-400,pixelsdown-500,0
  79.  
  80.  
  81.     rem
  82.     rem Copy entire bitmap 2 to printer
  83.     rem
  84.     copybits 2,0,0,167,126,print,pixelswide-200,600,0
  85.  
  86.  
  87.     rem
  88.     rem copy bottom 1/2 of bitmap 2 to printer.  The bottom half
  89.     rem is copied because when copying to printer, all references
  90.     rem to bitmap start from bottom
  91.     rem
  92.     copybits 2,0,0,167,63,print,100,600,0
  93.  
  94.  
  95.     rem
  96.     rem Now enlarge object on printer
  97.     rem
  98.     stretchbits 2,0,0,167,152,print,100,800,167,126,0
  99.  
  100.  
  101.     printcontrol 2  : rem end document
  102.     printcontrol 3  : rem end frame
  103.  
  104.  
  105.     rem
  106.     rem Select display as output device
  107.     rem
  108.     selectdisplay
  109.  
  110.  
  111.  
  112.     rem
  113.     rem wait for user to press Enter
  114.     rem
  115.  
  116.   input z
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.