Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!deimos.cis.ksu.edu!atanasoff!hascall From: hascall@atanasoff.cs.iastate.edu (John Hascall) Newsgroups: comp.graphics Subject: Re: color dithering? Message-ID: <1615@atanasoff.cs.iastate.edu> Date: 11 Oct 89 15:11:02 GMT References: <6350007@hpcupt1.HP.COM> <216@olive11.UUCP> Reply-To: hascall@atanasoff.UUCP (John Hascall) Organization: Iowa State Univ. Computation Center Lines: 49 In article <216@olive11.UUCP> stephens@cell.mot.COM (Kurt Stephens) writes: }In article <6350007@hpcupt1.HP.COM>, dclaar@hpcupt1.HP.COM (Doug Claar) writes: }> }> I have a 1024x768 6 plane display, upon which it seems I could display a }> picture of 512x384 with a greater number of apparent colors by some sort of }> 2x2 dithering. Can anyone give me a reference on this, or advice, clues, }> something-already-written-in-c? }> What I have used is the following. Decide which colors you are going to use. I usually use a "color cube". Since I have an 8-plane system (256 colors) I use a 6x6x6 cube (216 colors), you can use a 4x4x4 cube. idx = 0; for (r=0; r */ idx++; } Then, for each color you want to display, determine the 2 colors in the cube which are closest to the desired color. (a 1-dimension example) ... ---------+-----------+-----------+--------- ... x ^ y z | desired color (colors x & y are the closest colors) Next, determine the distance from the desired color to color x and to color y and use this to determine which dithering pattern to use. x x y x y x y y y y <-- dither patterns x x x x x y x y y y | | | | -----+-----+-----+-----+----- 0.2 0.4 0.6 0.8 <-- ratio of distances John Hascall Iowa State U hascall@atanasoff.cs.iastate.edu