[cairo] Implementing PCL's display model using cairo.

Wolfgang Glas wolfgang.glas at ev-i.at
Sat May 7 01:37:05 PDT 2005

Hash: SHA1

Hi all,

  I'm working on a project called HPGS (http://hpgs.berlios.de), which 
provides a library and a command line tool, which render HPGL/2 files to 
pixel buffers or to a PostScript file.

  Generally, hpgs has a graphics device interface, which closely follows the 
PostScript vector drawing operations. The display model, which is hidden by 
the device layer represents HP's PCL display model, which is based on ROP3 
functions as introduced by the Win32 API.

  Recently, I implemented an experimental cairo backend, which should replace 
my own handcrafted pixel backend, which is based on scanline intersection and 
hence does not produce very good results, when antialiasing is required.

  Basically, I figured out to boil down ROP3 operations into one or two 
consecutive operations in the form

1) dst = dst OR src
2) dst = dst AND src
3) dst = dst XOR src
4) dst = src

, where src is either a pattern color, the current pen color or a combination 
of these two colors.

  At this point, my troubles with cairo started.
Operation 1) maps to CAIRO_OPERATOR_ADD,
operation 3) maps to CAIRO_OPERATOR_XOR and
operation 4) maps to CAIRO_OPERATOR_SRC.

  Unfortunately, there is no way to represent operation 2) using cairo.
IMHO, this is the result of cairo being designed as a library, which handles 
alpha values in each operation. While this is desirable for modern 
applications, older display models may not be represented well using cairo.

  Moreover, I played a bit with the PDF display model, which is claimed to be 
represented by cairo's display model. In PDF, I could map my 4 operations in 
a suitable way by choosing the following mapping:

1) Lighten
2) Darken
3) Exclusion
4) Normal

  So, I'd suggest to the cairo developpers to add a pixel operator 
CAIRO_OPERATOR_AND, which complements the display model in a way, that it 
comes closer to PDF's display model and enables implementing the PCL display 

  Thanks for your great work on cairo and best regards,

Version: GnuPG v1.2.5 (GNU/Linux)


More information about the cairo mailing list