Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!sri-spam!parcvax!hplabs!pyramid!decwrl!amdcad!amdimage!cmoore From: cmoore@amdimage.UUCP (chris moore) Newsgroups: net.sources Subject: Dithering for HP LaserJet Message-ID: <111@amdimage.UUCP> Date: Tue, 12-Aug-86 16:07:43 EDT Article-I.D.: amdimage.111 Posted: Tue Aug 12 16:07:43 1986 Date-Received: Thu, 14-Aug-86 05:49:01 EDT Organization: AMD Image Processing, Sunnyvale, CA Lines: 101 Keywords: ray trace dither laserjet The following is a modification of Steve Hawley's dithering program modified to work on an HP LaserJet printer. It reads stdin and writes stdout, and doesn't take any arguments. The input format is that used by Version 2.0 of Friedrich Knauss' ray tracing program: a one line header with a width and height, followed by 8 bit pixel values. Chris Moore amdimage!cmoore ================CUT HERE ==================== #include #define WHITE 0 #define BLACK 1 #define ENDSCAN 2 int xsize,ysize; main() { int x,y,level; scanf("%d %d",&ysize,&xsize); printf("\033*t100R\n"); printf("\033*r0A\n"); for (x=0;x matrix[x % 8][y % 8]); } makedot(color) int color; { static int i, whichbyte = 0, whichbit = 0, nbytes, thisbyte = 0; nbytes = (ysize/8)+1; if (color == ENDSCAN) { /* end of scan line. We have to send 'thisbyte', and any other bytes required to make up a full line (nbytes - whichbyte) */ putchar(thisbyte); for (i=whichbyte+1;i 7) { whichbyte++; whichbit = 0; putchar(thisbyte); thisbyte = 0; } if (whichbyte >= nbytes) { whichbyte = 0; } } } -- =========================================================== Any project can be built with a handful of parts if you have big enough hands. Chris Moore (408) 749-4692 UUCP: {ucbvax,decwrl,ihnp4,allegra}!amdcad!amdimage!cmoore