Re: cairo-1.13 finally opens
Krzysztof Kosiński <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAFLw2WQjs-T04JC0h7Mt0agH0Cxy=yh_8PTY_vKFenhXyW-Qig@mail.gmail.com> |
2013/9/7 Bill Spitzak <[email protected]>: > Krzysztof Kosiński wrote: > >>> Inset shadow > > >> Why not: >> cairo_fill_preserve(cr); >> cairo_clip_preserve(cr); >> cairo_set_blur(...); >> cairo_set_source(...); // change shadow color >> cairo_fill(cr); > > > The path/mask has to be inverted as well so the color is put against the > edges, not in the middle. This can be done either before or after the blur. Inset shadow means that the shadow is inside the shape, e.g. it has to be clipped to the original shape. For normal shadow, there is no need to clip: cairo_save(cr); cairo_set_blur(...); cairo_set_source(...); // shadow color and opacity cairo_fill_preserve(cr); cairo_restore(cr); cairo_fill(cr); There are two potential problems with this simplified API: 1. Currently there seems to be no way to modify the path on the context, for example to add an offset, so for offset shadows the path would have to be processed twice. 2. Optimizing the rendering of a drop shadow under a large opaque object might be more difficult. On the other hand, I'm not sure there is a lot to gain in this case. Regards, Krzysztof -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo