On 2007-November-22 , at 10:27 , Adrian Johnson wrote:
> On 2007-October-31 , at 22:10 , Carl Worth wrote:
>> On Sat, 20 Oct 2007 11:53:07 +0200, jiho wrote:
>>> On 2007-October-18 , at 00:09 , Carl Worth wrote:
>>> I noticed that there is no cairo 1.5.2 at this address. Are you
>>> planning to make a git snapshot?
>> Sorry about the delay. The 1.5.2 snapshot is here now:
>> And I'm definitely interested in hearing reports from inkscape users
>> about cairo's PDF output with this snapshot. It should be lots
>> better than cairo 1.4.10. But if you can find any regressions, I
>> *definitely* want to hear about those.
>> Some notes on what's new in 1.5.2 compared to 1.4.10 can be seen
> I (eventually) installed this new Cairo into my MacPorts install,
> compiled with the pdf backend enabled (--enable-pdf) and tested
> Inkscape's output on a simple test file of mine. The results are
> - transparency is supported in Adobe Reader but not in Preview (OS X
> image viewer): the object is simply not displayed. Actually Preview
> is just a front end to Cocoa's PDFKit which is what all OS X
> applications dealing with PDFs use. So at this point, Cairo's output
> is clearly not usable yet. Inkscape's old pdf exporter with
> transparency looked OK
First, thanks for looking into it so deeply.
I don't have a Mac so can't check this myself however one of
Mac developers, Brian Ewins, had a look and confirmed that the PDF
displays correctly in Preview on Leopard but fails to display
on Tiger. I am assuming you are using Tiger.
You are assuming correctly.
The transparency in the PDF created by the old exporter is created
setting the alpha in the graphics state (/ca and /CA) before
stroking the path. The result is that the stroke color is blended with
the fill color where they overlap. When zooming in on the stroke it
be seen that the stroke is split into two colors.
The transparency in the cairo PDF exporter is created by drawing the
fill and stroke in a group using opaque colors then calling
cairo_paint_with_alpha() to draw the group with a constant alpha over
the entire group. This results in a uniform stroke color that matches
what is seen on screen in Inkscape. In the PDF
is implemented by setting a SMask with a uniform alpha in the graphics
state then drawing the group. However it appears that the Tiger
of Preview does not correctly implement SMasks.
You can obtain the old behavior with the cairo pdf exporter by filling
and stroking the path with a transparent color instead of using
cairo_paint_with_alpha() however this is not going to match the screen
Indeed using transparent colors work but using master opacity
doesn't. Too bad since Master Opacity is much easier to access in
Inkscape's UI. Actually the PDF output matches the screen display in
the case of transparent colors applied to fill and stroke: the object
show through the stroke and the stroke hence appears as if it had two
colors. So that's fine on this point.
> - blur is not supported (this is not surprising however). the
> is not even rasterized, it is just displayed without the blur
The cairo API does not support blur so Inkscape will need to draw a
rasterized image. Even if cairo did support blur, PDF does not, so
either way this needs to be rasterized to obtain correct output.
Yes I guessed it was the case. I just tested to see if Cairo would do
the rasterizing for Inkscape ;)
> - all gradients are well supported
> - bitmaps embedded or linked are conserved
> - markers and clones are handled perfectly
> So the largest issue, by far, is the transparency. Many applications
> on OS X deal with PDFs and they all use PDFKit. Plus, Preview is a
> very slick and fast PDF viewer so I guess that most people go with it
> and don't even install the huge, over-crowed and slow adobe reader.
> It can't be considered as an alternative then. I am conscious that,
> since Adobe Reader renders Cairo's PDF correctly, the bug is probably
> on Apple's side. But I am afraid there is no way they would change
> this soon and the effort will have to be done on Cairo's side. I hope
> it will not be too hard to fix.
This appears to have been fixed in Leopard. There is no work around
can be implemented in cairo for PDF viewers that do not support SMask
other than image fallbacks.
OK. that's a bummer but I understand. Don't know how we'll handle
that when shipping Inkscape though...
> As a last note it seems like if Cairo's PDF ouput, though of
> reasonable size, made both Preview and Adobe Reader choke on the
> file, to the point of hanging several seconds, when zooming far in
> (>1000%). Other PDF files on my machine do not lead to this kind of
Brian tells me that he can not reproduce the slow down in Leopard.
OK so maybe Preview.app has improved on Leopard regarding this also.
I can't reproduce it reliably either here. It is probably a
combination of some cairo properties which cause Preview to choke. If
I find a document that reliable produces this and is simple enough to
track the problem down, I'll let you know.