[cairo] Stroke adjust for filled rectangles?
Gonzalo Odiard
godiard at sugarlabs.org
Fri Jul 24 09:38:04 PDT 2015
I don't know if is useful in this case, but I had a problem
related to the way the borders and fill of the shapes and was solved using
push_group and pop_group_to_source.
I don't know if that apply to pdf files neither.
Examples here
http://godiard.blogspot.com.ar/2013/05/nice-cairo-trick-to-draw-transparent.html
On Fri, Jul 24, 2015 at 12:56 PM, David Kastrup <dak at gnu.org> wrote:
> Andreas Lobinger <lobingera at gmail.com> writes:
>
> > Hello colleague,
> >
> > first to your question, if it would be possible to detect the case;
> > closely looking at the rendering model which consecutively puts paint
> > onto a surface it think it would be hard to do. The detection would
> > need to look at consecutive stroke and fill operations and delaying
> > the rendering until decision.
> >
> > Traditionally the concept of stroke adjustment is considered in
> > rendering lines and in the first place i'd rather try to find a path
> > construction of stems that is essentially a line stroked, that would
> > have the bonus that you can at least ask the PDF viewer to apply
> > stroke adjustment and see what it tries to forward to cairo path
> > construction.
>
> Shrug. Because of the antialiasing behavior of Cairo, we can only do a
> single stroke over the whole rectangle width. In order to get the
> rounded corners, there needs to be a clipping path set that will round
> out the corners from this large stroke. The clipping path needs to cut
> off top and bottom but must not "accompany" the gist of the stroke in
> order not to interfere with its stroke adjustment and aliasing.
>
> The rounded corners are still bumpy since obviously the border of the
> stroke is stroke-adjusted while the clipping path for rounding the
> corners isn't. So they don't join up perfectly.
>
> Also the PDF file tends to be about 5 times the size compared to not
> doing this. Probably acerbated by us writing PostScript and using
> Ghostscript's ps2pdf for converting to PDF. But that's supposed to
> leave stuff in a rather similar state regarding the rendering model.
>
> >> I encountered the problem in the past that note stems in LilyPond
> >> render rather inconsistently and generally too thick in PDF viewers
> >> using Cairo.
> >>
> >> Now the stems are rounded rectangles, and they are unsurprisingly
> >> done by stroking a closed rectangle with a circular pen (or rather
> >> with a given line thickness and rounded corners) and then filling the
> >> path.
>
> --
> David Kastrup
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
--
Gonzalo Odiard
SugarLabs - Software [for | by] children learning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20150724/0b447c68/attachment-0001.html>
More information about the cairo
mailing list