Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Java2D

Java2D
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Nov 25, 2001, 07:10 PM
 
Does anyone know what Apple did to fix up the Java2D Demo? (/Developer/Examples/Java/JFC/Java2D/Java2D.app). Running that even on my G3/300 gives impressive frame rates (~27fps), etc, and yet my own app which calls Graphics.drawImage(image, 0, 0, component) takes over 800ms just to draw a single 200x200 image?
     
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Nov 26, 2001, 11:46 AM
 
Word to the wise - NEVER use BufferedImage.TYPE_4BYTE_ABGR! I don't remember why I chose this, but removing it boosted draw from 800ms to about 15ms. I replaced it with BufferedImage.TYPE_INT_ARGB.
     
Mac Elite
Join Date: May 2001
Location: Up north
Status: Offline
Reply With Quote
Nov 29, 2001, 10:52 PM
 
This is just a guess, but I think TYPE_4BYTE_ABGR is using 4 bytes of mem per pixel, and TYPE_INT_ARGB is just using 2. So then there is less stuff to copy, and I find that odd exponenetial speed increases occur when you switch from copying big portions of memory to smaller ones, in this case not the expected 2x increase in speed. Why, hmmm, pixie dust?
Perhaps TYPE_INT_ARGB is faster cus apple has there code optimized better for it.

Anyways, I would be interested to know if my suspicions about 2 bytes vs 4 byte memory copying are right... and if I am wrong even better, cus then I will know something more.
     
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Nov 30, 2001, 03:40 PM
 
Originally posted by 11011001:
<STRONG>Anyways, I would be interested to know if my suspicions about 2 bytes vs 4 byte memory copying are right... and if I am wrong even better, cus then I will know something more.</STRONG>
I looked at the source code, and it looks like the biggest difference is that the TYPE_INT_ARGB uses a DirectColorModel and the TYPE_4BYTE_ABGR uses a ComponentColorModel. I have read in other places that there is a specific ColorModel that Java2D on OS X works best with, but I don't remember specifics.
     
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Nov 30, 2001, 05:14 PM
 
Originally posted by 11011001:
Do you prefer to be called 217 or -39?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:16 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2