[cairo] Dithering

Behdad Esfahbod behdad at behdad.org
Mon Mar 31 16:54:56 PDT 2008


Morning everyone,

Just for fun while at vacation I implemented very simple dithering
support for the xlib backend.  You can find the code (very short) in my
dithering branch.  Two shots:

  http://imagebin.ca/view/FSJLJpN.html
  http://imagebin.ca/view/nGPfqYz.html

The hard part about dithering in cairo is that compositing requires to
read back the drawable contents, compose to it, and put it back.  So if
one's not careful, the dithering adjustment can accumulate and show very
bad effect.  I "fix" that by subtracting the dithering adjustment when
getting the image from the server.  Seems to work fine.

What remains to be done is:

  1) Add device_offset to dithering offset.

  2) I want to experiment with getting rid of the intermediate rgb333
when doing PseudoColor.  That's currently limiting the dithering
quality.


Have fun.  I sure did!

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list