<aside> 🌐 https://ghostscript.com/r/ClapTrap

</aside>

ClapTrap - Very simple bitmap trapping

The problem to be solved.

During printing processes one common problem is that of misregistration between inks. Colours are not typically printed all at once, and successive passes can result in slight misalignments. This can have various different causes, depending on the exact process in use (paper movement, expansion due to ink wetness, misaligned nozzles etc).

This can have particularly bad effects when two regions, filled in different dark inks, abut one another. If one of the regions is offset from the other, a ‘blank’ region may show through in the newly created gap between them. The gap can be much lighter in appearance, and can be very noticeable.

The process of trapping is that of modifying the image to be printed to be more resistant to such errors.

Trapping can be done manually at the design phase, or can be done mechanistically as part of the rendering pipeline.

Some methods work by operating on the vector objects themselves prior to rasterisation, whereas others (such as this one) operate at the other end of the pipeline by modifying the pixels of the rendered image before they are printed.

The code

ClapTrap is a very simple set of routines for bitmap trapping.

It is designed to work on simple 8 bit chunky contone bitmap data (the results of a standard render), and to post process that data to improve the appearance of the image when printed. It could just as easily work on planar data.

Currently it has not been integrated with ghostscript, but that could fairly easily be done.

git repo

The source can be found on casper as /home/robin/private-repos/claptrap.git

trappam

The example utility reads a .pam (such as is produced by the pamcmyk32 device) and postprocesses it to produce another pam.

$ gswin32c.exe -o out.pam -sDEVICE=pamcmyk32 -r100 examples/tiger.eps
trappam out.pam trapped.pam

Library Usage

To init the library we call:

ClapTrap ClapTrap_Init(int width, int height, int num_comps, const int comp_order, int max_x_offset, int max_y_offset, ClapTrap_LineFn get_line, void get_line_arg)