home *** CD-ROM | disk | FTP | other *** search
- ****************************************************************************
- * TESTDEV.PRG
- *
- * This sample program demontsrates the use of the Device Info Functions.
- ****************************************************************************
- *
- * Include PGL.PRG
- *
- SET PROCEDURE TO PGL
- DO PGLINIT
- *
- PUBLIC port,psize
- PUBLIC name, path, dfile
- PUBLIC nres,dpix,dpiy,nplanes,maxX,maxY,ncolors
- PUBLIC dtype, dheight, dwidth, pox,poy
- *
- port = pgPORTRAIT
- psize = pgHALFPAGE
- dfile = "TESTDEV.PLT"
- name = "HPLJET"
- **************************************************************************
- * - MAIN PROCEDURE
- **************************************************************************
- ierr = pgLDINFO ( name )
- if ierr <> 0
- ? "Err=",ierr
- return
- end if
-
- *
- * Select Page formatting/size options.
- * This must be done prior to CALLing pgGetDevMaxX,pgGetDevMaxY
- *
- pgSPMARGIN ( 100,100,100,100 )
- pgSPFORM ( port )
- pgSPSIZE ( psize )
-
- *
- * Get General Device Info
- *
- nres = pgGDMODES ()
- dtype = pgGDTYPE ()
- dheight = pgGDHGT ()
- dwidth = pgGDWIDTH ()
- pox = pgGDOFFX ()
- poy = pgGDOFFY ()
-
- ? " Device Parameters-----"
- ? " No. Of Res Modes: ",nres
- ? " Dev Type: ",dtype
- ? " Dev Height: ",dheight
- ? " Dev Width: ",dwidth
- ? " Dev Offset-X: ",pox
- ? " Dev Offset-Y: ",poy
-
- *
- * Get Resolution Dependent Device Info, on highest res supported
- *
- res = nres -1
- dpix = pgGDRESX ( res )
- dpiy = pgGDRESY ( res )
- nplanes = pgGDPLANES ( res )
- ncolors = pgGDCOLORS ( res )
- maxX = pgGDMAXX ( res )
- maxY = pgGDMAXY ( res )
-
- ? " Resolution Dependent Device Parameters----"
- ? " RES: ",res
- ? " DPI-X: ",dpix
- ? " DPI-Y: ",dpiy
- ? " No. Of Planes: ",nplanes
- ? " No. Of Colors: ",ncolors
- ? " MaxX: ",maxX
- ? " MaxY: ",maxY
-
- *
- * Open A Drawing File, set size to the exact physical device/page
- * specific dwidth and dheight dimensions. Now your working in hardware
- * coordinates.
- *
- pgINIT( dfile , maxX +1, maxY +1, @ierr )
-
- if ncolors = 2
- * Black Pen on white paper for B&W
- pgSCOLOR(1)
- else
- * Black Pen on White paper on Color
- pgSCOLOR(0)
- end if
-
- pgRect( 0, 0, maxX , maxY , pgOUTLINE )
- pgRect(20, 20, maxX -20, maxY -20, pgOUTLINE )
-
- pgSTSTYLE( pgTRIPLEX )
- pgSTJUST( pgCENTER, pgCENTER )
- pgSTSCALE( 5,1,5,1 )
- pgDTXY(maxX /2,maxY /2,"Hello World")
- *
- * Close The Drawing File.
- *
- pgEND()
- *
- * - END MAIN PROCEDURE
- *