[cairo] Pattern rendering questions
Dirk Schönberger
dirk.schoenberger at sz-online.de
Fri Aug 22 00:39:53 PDT 2008
>> In the second one (cross.png)
>> As with the previous pattern, I generate this one by drawing an X
>> from (0,0), (w,h), etc, but at 50% alpha.
>> - Note the darker pixels, presumably from where the pattern
>> overlaps, and the alphas of the individual strokes is combined.
>> (Or, maybe it's from where the tiles overlap. I'm not sure...)
>> -> Can anyone suggest a technique that would result in a
>> consistent alpha for the entire pattern?
>
> The same would probably happen in any graphics library or image
> editor if you draw partially transparent lines on top of one another.
> You probably need to draw the lines at full opacity first, then make
> them partially transparent all at once. Having not written any code
> with cairo, however, I can't suggest how to do that...
Or you could coumbine both lines of the cross into one path which is
rendered as one element. IIRC, this would be something like
cairo_moveto(cr,0,0);
cairo_lineto(cr,w,h);
criro_close_path(cr);
cairo_moveto(cr,0,h);
cairo_lineto(cr,w,0);
cairo_close_path(cr);
cairo_stroke();
Regards
Dirk
More information about the cairo
mailing list