[cairo] Dealing with PDF's Matte
James Cloos
cloos at jhcloos.com
Fri Jun 26 21:47:08 PDT 2009
This came up today on the poppler lists.
A mask image in a pdf can have a Matte entry for what the PDF Ref calls
generalized pre-multiplied masks.
For soft masks which do not have a Matte entry, poppler's cairo code
uses cairo_mask() to apply the soft mask as an alpha mask to the base
image.
When there is a Matte entry, it is an array with one component per
coponent of the main image’s colour space. For each component x,
the resulting colour cₓ′ is to be:
cₓ′ = mₓ + α × (cₓ − mₓ)
where mₓ is the xth entry in the Matte array, α is the value of that
pixel of the soft mask image and cₓ is the xth colour component that
pixel of the main image.
The result is that the final colours range ∈ [m,c] for α ∈ [0,1].
It seemed reasonable that one of cairo’s OPs would work for this, but
none of them seem to have the correct semantics, regardless of whether
the main image or the mask image is SRC or DEST.
Am I just being dense?
-JimC
--
James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6
More information about the cairo
mailing list