[OpenJDK 2D-Dev] Why does the OpenGL pipeline not use setupBlitVector?

Carl Worth cworth at cworth.org
Mon Jun 2 20:45:26 UTC 2008


On Mon, 2 Jun 2008 22:36:46 +0200, "Clemens Eisserer" wrote:
> 2.) Currently I've implemented lines the same way as Cairo does
> (generating three trapezoids), which gives the same result as with
> XDrawLine when line_width is set to 1.0, it looks to some degree ugly
> :-/
> I created some screenshots: http://picasaweb.google.com/linuxhippy/Cairo
>
> The problem is that I don't see any way to do nice lines with XRender,
> without a lot of overhead and many trapezoids.
> Carl Worth was very helful, pointing me to a solution:
> http://cm.bell-labs.com/who/hobby/87_2-04.pdf
> However that means stroking with a pen -> complex stuff probably
> generating many more than "just" 3 Trapezoids.

No. I don't think you understood the solution. It should not generate
any more trapezoids than your current approach.

You are already stroking your lines with a pen---you just happen to be
using a circular pen, (that is, the pen has the same cross-sectional
diameter in all directions). The key part of Hobby's solution is that
the cross-sectional "diameter" is different depending on the angle of
the line being drawn. And it's this difference that gives the result
you want, (the appearance of uniform line-width in the final result).

So you should be able to easily write a function, (with an explicit or
implicit Hobby pen polygon), that simply computes the correct
cross-sectional width for any particular line, (based on its angle),
and then generate your trapezoids based on that.

So what you will then be handing to Xrender won't be any more complex,
but the result should be much more appealing.

I'll be quite interested to see your results if you pursue this
approach.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20080602/a9d0bad0/attachment.bin>


More information about the 2d-dev mailing list