home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / PGL.ZIP / PGLCLS.ZIP / TESTDEV.PRG < prev    next >
Encoding:
Text File  |  1992-01-20  |  2.8 KB  |  105 lines

  1. ****************************************************************************
  2. *  TESTDEV.PRG
  3. *
  4. *  This sample program demontsrates the use of the Device Info Functions.
  5. ****************************************************************************
  6. *
  7. * Include PGL.PRG
  8. *
  9. SET PROCEDURE TO PGL
  10. DO  PGLINIT
  11. *
  12. PUBLIC port,psize
  13. PUBLIC name, path, dfile
  14. PUBLIC nres,dpix,dpiy,nplanes,maxX,maxY,ncolors
  15. PUBLIC dtype, dheight, dwidth, pox,poy
  16. *
  17. port  = pgPORTRAIT
  18. psize = pgHALFPAGE
  19. dfile = "TESTDEV.PLT"
  20. name  = "HPLJET"
  21. **************************************************************************
  22. * - MAIN PROCEDURE
  23. **************************************************************************
  24.      ierr = pgLDINFO ( name )
  25.      if  ierr  <> 0
  26.        ?  "Err=",ierr 
  27.        return
  28.      end if
  29.  
  30. *    
  31. *    Select Page formatting/size options.
  32. *    This must be done prior to CALLing pgGetDevMaxX,pgGetDevMaxY
  33. *    
  34.      pgSPMARGIN ( 100,100,100,100 ) 
  35.      pgSPFORM   ( port   ) 
  36.      pgSPSIZE   ( psize  ) 
  37.  
  38. *    
  39. *        Get General Device Info
  40. *    
  41.      nres    = pgGDMODES   ()
  42.      dtype   = pgGDTYPE     ()
  43.      dheight = pgGDHGT      ()
  44.      dwidth  = pgGDWIDTH    ()
  45.      pox     = pgGDOFFX     ()
  46.      poy     = pgGDOFFY     ()
  47.      
  48.      ? " Device Parameters-----"
  49.      ? " No. Of Res Modes: ",nres 
  50.      ? "         Dev Type: ",dtype  
  51.      ? "       Dev Height: ",dheight  
  52.      ? "        Dev Width: ",dwidth 
  53.      ? "     Dev Offset-X: ",pox 
  54.      ? "     Dev Offset-Y: ",poy  
  55.      
  56. *
  57. * Get Resolution Dependent Device Info, on highest res supported
  58. *    
  59.      res      = nres -1 
  60.      dpix     = pgGDRESX   ( res  ) 
  61.      dpiy     = pgGDRESY   ( res  ) 
  62.      nplanes  = pgGDPLANES ( res  ) 
  63.      ncolors  = pgGDCOLORS ( res  ) 
  64.      maxX     = pgGDMAXX   ( res  ) 
  65.      maxY     = pgGDMAXY   ( res  ) 
  66.      
  67.      ? " Resolution Dependent Device Parameters----"
  68.      ? "           RES: ",res  
  69.      ? "         DPI-X: ",dpix  
  70.      ? "         DPI-Y: ",dpiy  
  71.      ? " No. Of Planes: ",nplanes  
  72.      ? " No. Of Colors: ",ncolors  
  73.      ? "          MaxX: ",maxX 
  74.      ? "          MaxY: ",maxY  
  75.      
  76. *    
  77. *    Open A Drawing File, set size to the exact physical device/page 
  78. *    specific dwidth and dheight dimensions.  Now your working in hardware
  79. *    coordinates.
  80. *    
  81.      pgINIT( dfile , maxX +1, maxY +1, @ierr  ) 
  82.  
  83.      if ncolors = 2 
  84.         * Black Pen on white paper for B&W 
  85.     pgSCOLOR(1)   
  86.      else
  87.         * Black Pen on White paper on Color
  88.     pgSCOLOR(0)
  89.      end if
  90.  
  91.      pgRect( 0,  0, maxX , maxY , pgOUTLINE ) 
  92.      pgRect(20, 20, maxX -20, maxY -20, pgOUTLINE ) 
  93.  
  94.      pgSTSTYLE( pgTRIPLEX ) 
  95.      pgSTJUST( pgCENTER, pgCENTER ) 
  96.      pgSTSCALE( 5,1,5,1 )
  97.      pgDTXY(maxX /2,maxY /2,"Hello World") 
  98. *     
  99. *    Close The Drawing File.
  100. *    
  101.      pgEND()
  102. *
  103. * - END MAIN PROCEDURE
  104. *
  105.