Discussion:
xcb, xrender and thin lines
Vincent Torri
2006-02-15 07:56:19 UTC
Permalink
hello,

i'm writing the xcb-based xrender engine for evas. Its interface requires
a function that draws thin lines, like what the Bresenham algorithm would
draw.

For the xlib engine, raster uses XRenderCompositeDoublePoly for drawaing
thin lines (and thin polygons too). That function is quite complicated and
maybe there is a better idea. Does someone as an idea about how to do that
with xcb, which maybe can be simpler ?

Apart that line stuff, i'll also need to write a similar function to
XRenderFindVisualFormat. Maybe this one can fit in xcb_aux. What do you
think ?

thank you

Vincent
Keith Packard
2006-02-15 08:37:07 UTC
Permalink
Post by Vincent Torri
For the xlib engine, raster uses XRenderCompositeDoublePoly for drawaing
thin lines (and thin polygons too). That function is quite complicated and
maybe there is a better idea. Does someone as an idea about how to do that
with xcb, which maybe can be simpler ?
Far worse than complicated, that function is horribly inadequate for the
job of tesselating arbitrary polygons. I'm sorry I ever even considered
putting that into the Xrender library. You should stop using it
immediately to avoid catastrophe; it will generate garbage trapezoids
for seemingly benign input. It barely supports the polygons that xclock
generates, which was the only test application for that function.

Generating trapezoids for arbitrary polygons is a hard problem; cairo
still doesn't have a great algorithm in place for this (although we have
read papers about which algorithm we should implement).
--
keith.packard-***@public.gmane.org
Vincent Torri
2006-02-15 09:46:33 UTC
Permalink
Post by Keith Packard
Post by Vincent Torri
For the xlib engine, raster uses XRenderCompositeDoublePoly for drawaing
thin lines (and thin polygons too). That function is quite complicated and
maybe there is a better idea. Does someone as an idea about how to do that
with xcb, which maybe can be simpler ?
Far worse than complicated, that function is horribly inadequate for the
job of tesselating arbitrary polygons. I'm sorry I ever even considered
putting that into the Xrender library. You should stop using it
immediately to avoid catastrophe; it will generate garbage trapezoids
for seemingly benign input. It barely supports the polygons that xclock
generates, which was the only test application for that function.
Generating trapezoids for arbitrary polygons is a hard problem; cairo
still doesn't have a great algorithm in place for this (although we have
read papers about which algorithm we should implement).
and any advices about doing line drawing with xrender ?

Vincent
Carl Worth
2006-02-15 16:15:12 UTC
Permalink
Post by Vincent Torri
and any advices about doing line drawing with xrender ?
This is precisely what the original intent of cairo was---to provide a
an interface on top of Xrender to draw shapes that are of actual
interest.

And I think it still meets that need quite well.

And for straight lines at least, cairo doesn't go through any as nasty
as the code in XRenderCompositeDoublePoly.

-Carl
Keith Packard
2006-02-15 16:07:39 UTC
Permalink
Post by Vincent Torri
and any advices about doing line drawing with xrender ?
That's what cairo is for.
--
keith.packard-***@public.gmane.org
Vincent Torri
2006-02-15 20:05:35 UTC
Permalink
Post by Keith Packard
Post by Vincent Torri
and any advices about doing line drawing with xrender ?
That's what cairo is for.
well, it's a big dependancy for just that feature ;)

thank you anyway

Vincent Torri

Loading...