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

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