🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.graphics
Article #1379

Better^2 Raytrace output for Imagen printers

#1379
From: Geoffrey Cooper
Date: Thu, 14 Aug 1986 20:18
41 lines
2078 bytes
As always, I came up with "just the right thing" just after posting.
The following is a better dither function.  The difference between it and
the one posted is [1] the grid function is now exp(x*.66) instead of exp(x),
and [2] one line of code is added to skew the grid in a bricklayer's pattern
rather than straight up and down.  [1] makes the greatest difference -- it
has the effect of darkening the picture and bringing out more grey levels.
[2] is most noticeable when you are looking at the picture from close up.

- Geof Cooper
  IMAGEN

-----------CUT HERE---------------
dither(x, y, level)
    int x, y, level;
{
    int dlev;   /* dither level */
    static unsigned char expgrid[64] = {
       9,  10,  11,  11,  12,  12,  13,  14, 
      40,  42,  44,  46,  49,  51,  54,  15, 
      37, 112, 118, 124, 130, 137,  57,  15, 
      36, 106, 208, 219, 230, 145,  60,  16, 
      34, 101, 197, 254, 243, 152,  63,  17, 
      32,  96, 187, 178, 169, 160,  66,  18, 
      30,  91,  86,  82,  78,  74,  70,  19, 
      29,  27,  26,  25,  23,  22,  21,  20
    };

    /*
     * skew every second line over by half a grid to get a brick-layer's
     * pattern, rather than a straight grid.  The human eye is too good
     * at seeing straight lines when the points in the grid line up.
     */
    x += (y & 8) >> 1;

    /* apply an 8x8 grid: */
    dlev = ((y & 7) << 3) + (x & 7);

    /* apply dithering function and compare */
    return ( level < expgrid[dlev] );
}
Technical Details
Message-ID: <474@imagen.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!parcvax!hplabs!pyramid!decwrl!sun!saber!imagen!geof

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!parcvax!hplabs!pyramid!decwrl!sun!saber!imagen!geof
From: geof@imagen.UUCP (Geoffrey Cooper)
Newsgroups: net.graphics,net.sources
Subject: Better^2 Raytrace output for Imagen printers
Message-ID: <474@imagen.UUCP>
Date: Thu, 14-Aug-86 16:18:47 EDT
Article-I.D.: imagen.474
Posted: Thu Aug 14 16:18:47 1986
Date-Received: Sun, 17-Aug-86 05:53:25 EDT
Distribution: net
Organization: IMAGEN Corporation, Santa Clara, CA 95052-8101
Lines: 41