[Development] Proposal: Make QPen non-cosmetic by default

Tony Van Eerd tvaneerd at rim.com
Fri Oct 12 18:31:31 CEST 2012


I think Windows also uses 0-width to mean the same thing.

On the other hand, I worked on a drawing library that used sub-pixel lines.  Via good anti-aliasing, A 0.5 width line, even if vertical/horizontal, would be drawn semi-transparent.  A 0-width line would thus be invisible.



> -----Original Message-----
> From: development-bounces+tvaneerd=rim.com at qt-project.org
> [mailto:development-bounces+tvaneerd=rim.com at qt-project.org] On Behalf
> Of Samuel Rødal
> Sent: Friday, October 12, 2012 11:02 AM
> To: development at qt-project.org
> Subject: Re: [Development] Proposal: Make QPen non-cosmetic by default
> 
> On 10/12/2012 03:17 PM, Uwe Rathmann wrote:
> > On Fri, 12 Oct 2012 12:21:30 +0000, Bache-Wiig Jens wrote:
> >
> >> After all what is the point of doing a
> >> major version unless we don't even allow ourselves to change broken
> >> defaults.
> >
> > There is nothing broken: it's a well defined API that behaves exactly
> > like it is documented. Your suggestion is about modifying an
> illogical
> > API.
> >
> > I don't know the reasons why the API was decided once the way it is -
> but
> > it is so confusing, that I can't believe that it happened by accident
> > ( being documented later ). My guess is that it was following some
> other
> > system that did it this way.
> 
> Originally a 0-width pen was the only way to get the cosmetic pen
> behavior. Later on setCosmetic() was added to be able to have any pen
> width be cosmetic.
> 
> I guess the whole 0-width thing comes from X11, where 0 is a special
> value with the following documentation: "Thin lines (zero line-width)
> are one-pixel-wide lines drawn using an unspecified, device-dependent
> algorithm."
> 
> http://tronche.com/gui/x/xlib/GC/manipulating.html also contains this
> bit of documentation:
> 
> "A line-width of zero may differ from a line-width of one in which
> pixels are drawn. This permits the use of many manufacturers' line
> drawing hardware, which may run many times faster than the more
> precisely specified wide lines.
> 
> In general, drawing a thin line will be faster than drawing a wide line
> of width one. However, because of their different drawing algorithms,
> thin lines may not mix well aesthetically with wide lines. If it is
> desirable to obtain precise and uniform results across all displays, a
> client should always use a line-width of one rather than a line-width
> of
> zero."
> 
> So 0-width lines in X11 are not only implicitly cosmetic, but also have
> less strict guarantees when it comes to correctness, so that they can
> be
> optimized by custom hardware. I guess originally QPen simply mirrored
> this behavior, which is probably why as you noted 0-width pens are
> faster than 1-width pens with the X11 paint engine in 4.x.
> 
> Still, I agree with Jens that the API of having 0-width pens and
> cosmetic pens as separate concepts is confusing. If we wanted something
> akin to the 0-width concept of X11 it should rather have been a render
> hint saying that it's acceptable for the application to get less
> accurate line drawing in exchange for better performance. I'm not sure
> how valid that use case is these days though.
> 
> --
> Samuel
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.



More information about the Development mailing list