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

  1. '****************************************************************************
  2. '  TESTDEV.BAS
  3. '
  4. '  This sample program demontsrates the use of the Device Info Functions.
  5. '****************************************************************************
  6. '$INCLUDE: 'PGL.BAS'
  7.  
  8. port%  = pgPORTRAIT
  9. psize% = pgHALFPAGE
  10. dfile$ = "TESTDEV.PLT"
  11. name$  = "HPLJET"
  12.  
  13. print  "Loading :",name$
  14. ierr% = pgLoadDevInfo% ( name$ )
  15. if ierr% <> 0 then
  16.   print  "Err=",ierr%," Cannot find "+name$+".DRV"
  17.   goto exitpgm
  18. end if
  19.  
  20. '    
  21. '    Select Page formatting/size options.
  22. '    This must be done prior to calling pgGetDevMaxX,pgGetDevMaxY
  23. '    
  24. call pgSetPageMargins  ( 100,100,100,100) 
  25. call pgSetPageForm     ( port%  ) 
  26. call pgSetPageSize     ( psize% ) 
  27.  
  28. '    
  29. '        Get General Device Info
  30. '    
  31. nres%  = pgGetDevModes%  
  32. dtype%  = pgGetDevType%      
  33. dheight%= pgGetDevHeight%  
  34. dwidth% = pgGetDevWidth%   
  35. pox%   = pgGetDevOffsetX% 
  36. poy%   = pgGetDevOffsetY%
  37.  
  38. print " Device Parameters-----"
  39. print " No. Of Res Modes: ",nres%
  40. print "         Dev Type: ",dtype% 
  41. print "       Dev Height: ",dheight% 
  42. print "        Dev Width: ",dwidth%
  43. print "     Dev Offset-X: ",pox%
  44. print "     Dev Offset-Y: ",poy% 
  45.  
  46. '    
  47. ' Get Resolution Dependent Device Info, on highest res supported
  48. '    
  49. res%     = nres%-1 
  50. dpix%    = pgGetDevResX%( res% ) 
  51. dpiy%    = pgGetDevResY%( res% ) 
  52. nplanes% = pgGetDevPlanes%( res% ) 
  53. ncolors% = pgGetDevColors%( res% ) 
  54. maxX%    = pgGetDevMaxX%( res% ) 
  55. maxY%    = pgGetDevMaxY%( res% ) 
  56.  
  57. print " Resolution Dependent Device Parameters----"
  58. print "           RES: ",res% 
  59. print "         DPI-X: ",dpix% 
  60. print "         DPI-Y: ",dpiy% 
  61. print " No. Of Planes: ",nplanes% 
  62. print " No. Of Colors: ",ncolors% 
  63. print "          MaxX: ",maxX%
  64. print "          MaxY: ",maxY% 
  65.  
  66. '    
  67. '    Open A Drawing File, set size to the exact physical device/page 
  68. '     specific dwidth and dheight dimensions.  Now your working in hardware
  69. '     coordinates.
  70. '    
  71. call pgInitDrw( dfile$, maxX%+1, maxY%+1, ierr% ) 
  72.  
  73. if ierr% <> 0 then
  74.    print "Error Opening a Drawing File !"
  75.    goto exitpgm
  76. endif
  77.  
  78. if ncolors% = 2 then
  79.   ' Black Pen on white paper for B&W a printer 
  80.   call pgSetColor(1)   
  81. else
  82.   ' Black Pen on White paper on Color a printer
  83.   call pgSetColor(0)
  84. end if
  85.  
  86. call pgRectangle( 0,  0, maxX%, maxY%, pgOUTLINE ) 
  87. call pgRectangle(20, 20, maxX%-20, maxY%-20, pgOUTLINE ) 
  88.  
  89. call pgSetTextStyle( pgTRIPLEX ) 
  90. call pgSetTextJustify( pgCENTER, pgCENTER ) 
  91. call pgSetTextScaling( 5,1,5,1 ) 
  92. call pgDrawTextXY(maxX%/2,maxY%/2,"Hello World") 
  93. '
  94. '      Close The Drawing File.
  95. '    
  96. call pgEndDrw
  97. '
  98. exitpgm:
  99. END
  100.