[OpenJDK 2D-Dev] Best way organizing XRender additions for theX11 pipeline?

LOUD, Ben Ben.LOUD at baesystems.com
Wed Dec 5 11:18:36 UTC 2007

Wow, Carl Worth himself! Great to see you on the list. Cairo no doubt is a wonderful package, a true gem of free software. All i meant by my "high level" comment was that its a complete top to bottom graphics package, when really the only part that OpenJDK desperately needs is one part of the pipeline, the part that rasterises paths to produce masks. OpenJDKs existing Java2D can do the rest (and do it very well) including compositing, text, transforms, color conversion etc. I couldnt see how Cairo could be made to work together with all of this existing code. 
Unless maybe if we implemented AATileGenerator to create an A8 Cairo image surfaces as tiles, and rasterize paths to those. Then Java2D can do the rest, including compositing to to X11/GDI/OGL/D3D/whatever. It just means we'd be be including Cairo for just a subset of its functionality. I'd be all for it though. Im sceptical that the pure Java Pices rasterizer that replaced Ductus could ever perform as well as we'd like. 
I wonder how difficult it would be to factor out Cairo's rasterisation and stroking code so we could just use that. We wouldnt need its compositng, font support, SVG and PDF backends etc. etc. Of course I know zero about Cairo's internals but if its feasible, it might be worth a look. I'd love to see it happen. 
I doubt we'd need cairo to take advantage of X Render though. That doesnt sound to me like the difficult part. I would think it would similar to what they've already done for OGL and D3D.
2D team, thoughts? Is X Render used at all or do you have any plans to use it? Do you think theres any potential for Cairo as a rasterizer if it were possible to isolate that code? 


From: Carl Worth [mailto:cworth at cworth.org]
Sent: Wed 5/12/2007 6:45 PM
To: LOUD, Ben
Cc: 2d-dev at openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] Best way organizing XRender additions for theX11 pipeline?

On Wed, 5 Dec 2007 11:43:42 +1030, "LOUD, Ben" wrote:
> I'm not an expert, but I don't think Cairo would be appropriate for
> OpenJDK, at least not as a complete Java2D implementation.

I've been involved with the cairo implementation since the beginning,
(and even before that). I don't know a *lot* about Java2D but you're
probably quite right that there are likely to be things missing in
cairo that would be needed for a complete Java2D implementation.

> As far as I can tell, Cairo only exposes a high level API (like Java2D)
> so to use it, you would probably have to throw away all the existing
> OpenJDK Java2D code in order to use it.

I'm really not sure what that means exactly.

> But if there are X11 drawing calls that can be replaced with XRender
> then I'd be all for that! I know almost nothing about *nix graphics
> technologies. Maybe someone can enlighten me on the details. It looks
> like it can do compositing, image affine transforms, image convolution
> (nice!), glyph caching and even linear and radial gradients. Does Java2D
> not take advtange of any this yet? Sounds like a promising oppertunity.
> But the only documentation I could find on it was sketchy. It looks like
> it can make surfaces in VRAM and do compositing entirely in hardware. It
> might then have potential to perform as well as OpenGL. Definitely worth
> exploring! Go for it Clemens!

Yes, the X Render extension does support that list. And honestly, the
reason it isn't better documented is that we wrote cairo specifically
to be an easier-to-use interface for X Render functionality[*].

So if you do want to start using Render inside Java2D, (which seems
only a good thing when targeting an X server), the recommended
approach would be to use cairo to do that. This wouldn't mean that you
would have to use cairo to replace other existing non-X backends in
Java2D at all, of course.

If anyone is interested in exploring this further, I'd be more than
happy to answer any questions about cairo's functionality, how to use
it, or how it might be improved in the future.



[*] Initial versions of cairo were strictly targeting X Render---the
capability of targeting Win32, Quartz, PostScript, PDF, SVG, OpenGL,
etc. all came much later.

The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited.  If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility.  It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20071205/97f01d01/attachment.html>

More information about the 2d-dev mailing list