home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!uunet.ca!rose!usenet
- From: gyl.midroni@rose.com (gyl midroni)
- Subject: raphics to printer
- Organization: Rose Media Inc, Toronto, Ontario.
- Date: Fri, 18 Dec 1992 18:10:12 GMT
- Message-ID: <1992Dec18.181020.7758@rose.com>
- Sender: usenet@rose.com (Usenet Gateway)
- X-Gated-By: Usenet <==> RoseMail Gateway (v1.70)
- Lines: 79
-
-
- Date Entered: 12-18-92 13:04
- F > From: f51562@sakura.kudpc.kyoto-u.ac.jp (f51562)
- F > Dear Netters,
- F > I'd like to print graphic screen (or part) using TP. (not PrtScr)
- F > Is there a way?
- F > Thank you in advance
- F > Martin Cekal
-
-
-
- I have used this in the past. It works by using getpixel for the
- page, and generating a bitmap for the page. Then you use the printer
- in graphics printing mode to throw the data out.
- It works only with printers that will take Epson control codes.
- You need to have a listing of printer control codes (it should come
- with your printer manual) It assumes you are in monochrome mode. This
- is crappy code, but I hope the idea is useful, and you can modify it
- to your needs.
-
- procedure hardcopy;
- var
- j,i,top:integer;
- colorloc,printbyte:byte;
-
- {subroutine}
- procedure doline(top:integer);
- var
- jj:integer;
-
- {sub-subroutine}
- function constructbyte(j,i:integer) :byte;
- const
- bits:array[0..7] of integer = (128,64,32,16,8,4,2,1);
- var
- cbyte,k:byte;
- pixelset:boolean;
-
- begin {constructbyte}
- i:=i shl 3;
- cbyte:=0;
- for k:=0 to top do i:=i shl 3;
- cbyte:=0;
- for k:=0 to top do
- begin
- pixelset:=false;
- if getpixel(j,i+k)=colour then pixelset:=true;
- if pixelset then cbyte:=cbyte or bits[k];
- end;
- constructbyte:=cbyte;
- end; {constructbyte}
-
- begin {doline}
- write(lst,^['L');
- write(lst,chr(lo(640)),chr(hi(640)));
- for jj:=0 to 639 do
- begin
- printbyte:=constructbyte(jj,i);
- write(lst,chr(printbyte));
- end;
- writeln(lst);
- end; {doline}
-
- begin {hardcopy}
- top:=7;
- write(lst,^['3'#24);
- for i:=0 to 24 do doline(7);
- writeln(lst,^['2');
- end;
-
-
-
-
- Gyl
- gyl.midroni@rose.com
-
- ---
- RR 1.60 R001881
- RM 2.00 : RoseNet<=>Usenet Gateway : Rose Media 416-733-2285
-