dm2368@eecs1.eecs.usma.edu (Fichten Mark CPT) (06/12/91)
Jon Bonnell writes... > Well, I've gotten no response at all except for one helpful person > that is trying to find the datastructure for GetIMage as well. If you want the structure of GetImage I'll send it to you. > Do I have to reinvent the wheel here or is there something out > there somewhere to allow for printouts of graphic screens. Hell, if there's > one out there for saving the images to disk that could be rerouted. > I would really like a unit that sets the Epson/IBM printer and dumps > the screen. That is the more standard anyway... No Jon, you do not have to reinvent the wheel! Here is a unit that will do what you want. It is currently being used in front end for PSPICE (a program those electrical engineers use...). I haven't used this unit for over a year but... You call PrintScreen(MaxX,MaxY) where MaxX and MaxY are the number of pixels you want to be in the printout. Both measurements start in the upper left hand corner. This is how I remember it working. I know it works on EGA. I have not tried it since I got VGA or Super VGA. Hope that you find it useful. If you improve on it, I sure would appreciate a courtesy copy. Thanks, ____________________________________________________________________________ CPT Mark Fichten | INTERNET: fichten@eecs1.eecs.usma.edu | Captain U.S. Army | @trotter.edu:dm2368@eecs1.eecs.usma.edu | | USENET: rutgers.edu!trotter!eecs1!dm2368 | | harvard.edu!trotter!eecs1!dm2368 | ____________________________________________________________________________ unit print; interface {---------------------------------------------------------} Procedure PrintScreen(MaxX,MaxY : integer); implementation {----------------------------------------------------} uses Graph, Printer; Procedure PrintScreen(MaxX,MaxY : integer); const esc = $1B; var k,i,x,y : integer; Pins, Pin, Bcolor : byte; Vlimit, Hlimit, Vextra, Klimit : integer; procedure InitLine(columns : integer); {setup for double density graphics} var colmod, coldiv : byte; begin coldiv := columns div 256; colmod := columns mod 256; write(lst,char(esc), 'L',char(colmod), char(coldiv)); end; procedure SetPrinter; {set to 8/72 inches per line} begin writeln(lst, char(esc), 'A',char(8)); end; procedure ResetPrinter; {set to 6 lines per inch and send a form feed.} begin writeln(lst, char(esc), '2'); end; begin SetPrinter; Bcolor := GetBkColor; HLimit := MaxX; VLimit := MaxY div 8; Vextra := MaxY mod 8; Klimit := 7; for i := 0 to vlimit do begin InitLine(Hlimit+1); for x := 0 to Hlimit do begin Pins := 0; if I = vlimit then Klimit := Vextra; for K := 0 to Klimit do begin y := (I*8)+K; Pin := GetPixel(x,y); If Pin <> Bcolor then { compare to background } Pins := Pins+1 SHL (7-K); { Calc power of 2 } end; write(lst, char(Pins)); end; writeln(lst); end; ResetPrinter; end; end.