home *** CD-ROM | disk | FTP | other *** search
- C*****************************************************************************
- C TESTDEV.FOR
- C
- C This sample program demontsrates the use of the Device Info Functions.
- C****************************************************************************
- include "pgl.for"
-
- integer*2 port
- integer*2 psize
- integer*2 err
- integer*2 res
- character*80 name, path, dfile
- integer*2 nres,dpix,dpiy,nplanes,maxX,maxY,ncolors
- integer*2 type, height, width, pox,poy
- C
- port = pgPORTRAIT
- psize = pgHALFPAGE
- dfile = 'TESTDEV.PLT'//char(0)
- name = 'HPLJET'//char(0)
-
- err=pgLoadDevInfo ( name )
- if( err .ne. 0 )then
- print *, 'Err= ',err, ' HPLJET Driver Not Found!'
- stop
- end if
-
- C
- C Select Page formatting/size options.
- C This must be done prior to calling pgGetDevMaxX,pgGetDevMaxY
- C
- call pgSetPageMargins ( 100,100,100,100)
- call pgSetPageForm ( port )
- call pgSetPageSize ( psize )
-
- C
- C Get General Device Info
- C
- nres = pgGetDevModes ( )
- type = pgGetDevType ( )
- height= pgGetDevHeight ( )
- width = pgGetDevWidth ( )
- pox = pgGetDevOffsetX ( )
- poy = pgGetDevOffsetY ( )
- print *, " Device Parameters-----"
- print *, " No. Of Res Modes: ",nres
- print *, " Dev Type: ",type
- print *, " Dev Height: ",height
- print *, " Dev Width: ",width
- print *, " Dev Offset-X: ",pox
- print *, " Dev Offset-Y: ",poy
-
- C
- C Get Resolution Dependent Device Info, on highest res supported
- C
- res = nres-1
- dpix = pgGetDevResX( res )
- dpiy = pgGetDevResY( res )
- nplanes = pgGetDevPlanes( res )
- ncolors = pgGetDevColors( res )
- maxX = pgGetDevMaxX( res )
- maxY = pgGetDevMaxY( res )
-
- print *, " Resolution Dependent Device Parameters----"
- print *, " RES: ",res
- print *, " DPI-X: ",dpix
- print *, " DPI-Y: ",dpiy
- print *, " No. Of Planes: ",nplanes
- print *, " No. Of Colors: ",ncolors
- print *, " MaxX: ",maxX
- print *, " MaxY: ",maxY
-
- C
- C Open A Drawing File, set size to the exact physical device/page
- C specific width and height dimensions. Now your working in hardware
- C coordinates.
- C
- call pgInitDrw( dfile, maxX+1, maxY+1, err)
-
- C Black Pen on white paper for B&W a printer
- if( ncolors .eq. 2 )then
- call pgSetColor(1)
- else
- C Black Pen on White paper on Color a printer
- call pgSetColor(0)
- end if
-
- call pgRectangle( 0, 0, maxX, maxY, pgOUTLINE )
- call pgRectangle(20, 20, maxX-20, maxY-20, pgOUTLINE )
-
- call pgSetTextStyle( pgTRIPLEX )
- call pgSetTextJustify( pgCENTER, pgCENTER )
- call pgSetTextScaling( 5,1,5,1 )
- call pgDrawTextXY(maxX/2,maxY/2,"Hello World"//char(0))
- C
- C Close The Drawing File.
- C
- call pgEndDrw()
- C
- END