home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7563 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.2 KB  |  91 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!uunet.ca!rose!usenet
  3. From: gyl.midroni@rose.com (gyl midroni)
  4. Subject: raphics to printer
  5. Organization: Rose Media Inc, Toronto, Ontario.
  6. Date: Fri, 18 Dec 1992 18:10:12 GMT
  7. Message-ID: <1992Dec18.181020.7758@rose.com>
  8. Sender: usenet@rose.com (Usenet Gateway)
  9. X-Gated-By: Usenet <==> RoseMail Gateway (v1.70)
  10. Lines: 79
  11.  
  12.  
  13. Date Entered: 12-18-92 13:04
  14. F > From: f51562@sakura.kudpc.kyoto-u.ac.jp (f51562)
  15. F > Dear Netters,
  16. F > I'd like to print graphic screen (or part) using TP. (not PrtScr)
  17. F > Is there a way?
  18. F >    Thank you in advance
  19. F >                         Martin Cekal
  20.  
  21.  
  22.  
  23.     I have used this in the past.  It works by using getpixel for the
  24. page, and generating a bitmap for the page.  Then you use the printer
  25. in graphics printing mode to throw the data out.  
  26.     It works only with printers that will take Epson control codes. 
  27. You need to have a listing of printer control codes (it should come 
  28. with your printer manual) It assumes you are in monochrome mode.  This 
  29. is crappy code, but I hope the idea is useful, and you can modify it 
  30. to your needs.
  31.  
  32. procedure hardcopy; 
  33. var
  34.    j,i,top:integer;
  35.    colorloc,printbyte:byte;
  36.  
  37. {subroutine}
  38.   procedure doline(top:integer);
  39.   var
  40.     jj:integer;
  41.  
  42.     {sub-subroutine}
  43.     function constructbyte(j,i:integer) :byte;
  44.     const
  45.       bits:array[0..7] of integer = (128,64,32,16,8,4,2,1);
  46.     var
  47.       cbyte,k:byte;
  48.       pixelset:boolean;
  49.  
  50.     begin  {constructbyte}
  51.       i:=i shl 3;
  52.       cbyte:=0;
  53.       for k:=0 to top do i:=i shl 3;
  54.       cbyte:=0;
  55.       for k:=0 to top do
  56.       begin
  57.         pixelset:=false;
  58.         if getpixel(j,i+k)=colour then pixelset:=true;
  59.         if pixelset then cbyte:=cbyte or bits[k];
  60.       end;
  61.       constructbyte:=cbyte;
  62.     end;   {constructbyte}
  63.  
  64.   begin {doline}
  65.     write(lst,^['L');
  66.     write(lst,chr(lo(640)),chr(hi(640)));
  67.     for jj:=0 to 639 do
  68.     begin
  69.       printbyte:=constructbyte(jj,i);
  70.       write(lst,chr(printbyte));
  71.     end;
  72.     writeln(lst);
  73.   end; {doline}
  74.  
  75. begin {hardcopy}
  76.   top:=7;
  77.   write(lst,^['3'#24);
  78.   for i:=0 to 24 do doline(7);
  79.   writeln(lst,^['2');
  80. end;
  81.  
  82.  
  83.  
  84.  
  85.                 Gyl
  86.                 gyl.midroni@rose.com
  87.  
  88. ---
  89.    RR 1.60 R001881
  90.    RM 2.00 : RoseNet<=>Usenet Gateway : Rose Media 416-733-2285
  91.