KDE/kdebase/workspace/plasma/applets/kickoff/ui
Zack Rusin
zack at kde.org
Thu Aug 28 21:48:49 CEST 2008
On Thursday 28 August 2008 15:43:34 Alexis Ménard wrote:
> I'm quite interrested by understand the difference of the two types QPen, i
> mean uses cases and so
>
> On Thu, Aug 28, 2008 at 9:30 PM, Diego Iastrubni <elcuco at kde.org> wrote:
> > can any one of you graphics ninjas explain to us n00bz the difference
> > between a cosmetic pen and a non cosmetic pen...?
I think there's a lot of documentation for them in the Qt documentation of
QPen.
Instead of paraphrasing it here, I'm going to add some thing about it here.
So 1) check the QPen docs, 2) read the below :)
In vector graphics cosmetic pens are known as the "non-scaling stroke" (in the
SVG spec and in the OpenVG spec).
When stroking (or in Qt terms "when drawing the path with a QPen") the
rendering engine actually generates a second path. The path is essentially an
outline of the path that we want to stroke. The generation of the outline is
governed by some parameters of the stroke/QPen, in particular those are end
caps, join style and the width.
When rendering a path the path is decomposed and each point is transformed by
a transformation matrix. So if the stroke is not transformable that means that
for all vector graphics api, you'll avoid a matrix multiplication for every
element in a path (which for larger paths will be visible).
More over the cosmetic pen of width 0 has a special meaning in Qt because it
means that as long as round join and caps aren't used instead of a complex
path the outline can be imitated with a set of line (a polyline). That means
that rendering a stroke equals rendering a few lines, versus rendering a very
complex polygon (e.g. on X11 Qt uses XDrawLine instead of tessellating the
path and using XRenderCompositeTrapezoids when it's rendering a opaque
cosmetic pen).
Hope that helps.
z
More information about the Plasma-devel
mailing list