The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » Swing & AWT

Thread: Updating Graphics2D for Java 6+

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 6 - Last Post: Apr 1, 2008 10:30 AM by: turingpest
turingpest

Posts: 5
Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 11:53 AM
  Click to reply to this thread Reply

I recently submitted an RFE for Graphics2D to be updated.
Does anyone on the Swing/AWT team think this is a possibility?
What specifically is the reason for the great performance difference between
fill(shape) and fillShape(...)?
We can definitely see an increase in code clarity from where we are now.

http://forum.java.sun.com/thread.jspa?threadID=5277040

kirillcool

Posts: 796
Re: Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 12:43 PM   in response to: turingpest
  Click to reply to this thread Reply

You realize that there is no way that it's going to be added to Graphics2D in Java 6, unless the 6u10 is named as what it really is - a major new version of Java SE.

turingpest

Posts: 5
Re: Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 1:15 PM   in response to: kirillcool
  Click to reply to this thread Reply

kirill, youve jumped the forum.java.sun ship huh?
you realize that 6+ means anything above or including 6uX. ; )
youre right though, this is more likely for J7.

kirillcool

Posts: 796
Re: Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 1:23 PM   in response to: turingpest
  Click to reply to this thread Reply

Jumped ship as in having 554 messages posted on java.net up until now?

trembovetski

Posts: 644
Re: Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 1:37 PM   in response to: turingpest
  Click to reply to this thread Reply

This question is in the wrong forum. It belongs to Java2D -
http://forums.java.net/jive/forum.jspa?forumID=69

But anyway, the difference between rendering a rectangle and a shape
that looks like a rectangle (which is what Rectangle2D is)
is that shape rendering in general is more computationally-intensive,
and you don't want the code to be sprinkled with "instanceof" checks trying
to figure out if some shape you're rendering is actually a Rectangle2D.

Dmitri

turingpest

Posts: 5
Re: Updating Graphics2D for Java 6+
Posted: Mar 20, 2008 2:13 PM   in response to: trembovetski
  Click to reply to this thread Reply

Sorry, the RFE was to change the Graphics class which is in java.awt so I thought this was the right place to post it.

> is that shape rendering in general is more computationally-intensive,

I think this adds further weight to my RFE then. From my (humble attempt at) tests fill(shape) was 7.6 times slower than fillShape().

My RFE was essentially just to overload the draw() methods to take doubles and to add a drawPoint and drawTriangle (optimized over polygons because of lack of windings rules etc, and needed for 3d).

This way we can use doubles without the performance penalty of a shape.

Thanks for your input Dmitri!

turingpest

Posts: 5
Re: Updating Graphics2D for Java 6+
Posted: Apr 1, 2008 10:30 AM   in response to: turingpest
  Click to reply to this thread Reply

Sun sent me the link to the RFE last night. here it is. vote on it if it interests you.
i plan to post an article online clairifying the RFE and showcasing its benefits.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6681949




 XML java.net RSS