Vaidya,

Funny you should ask this just now. Just minutes ago I rewrote some code to
reuse the ImageComponent2Ds that my Rasters use. I have a static Hashtable
and every time I need an ImageComponent2D, I check the table first to see if
it already contains what I need. If not, then I create one and put it into
the table with a key that contains the text, background color and foreground
color. Works fine.

As far as FontMetrics goes, I do basically what you're describing. It seems
like there should be a better way but I don't think there is.

I agree that Raster text looks better. It knows exactly which pixels to draw
to look like normal text whereas Text2D is (as I understand it) 3D geometry.

Raffi

-----Original Message-----
From: R Vegan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 6:06 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Question on Raster Labels


Hi

I am trying to create scores of Raster Labels for annotating
the nodes of a wireframe object (see earlier threads on this
by Corysia Taware and Daniel Selman). Is there a way to optimize
the creation of various objects involved in creating the raster ?
Can the objects such as BufferedImage, Graphics, and ImageComponent2D,
be reused to create subsequent labels after creating the
first one ?

Also, to determine the exact size of the BufferedImage for creating
a specific String label, one needs to get a FontMetrics object for
which one needs a Graphics object which again has to be obtained
from a BufferedImage object. Kinda Looks like a Catch22  situation !
Is there any other way to get a Graphics object ? Creating a
FontMetrics object directly is apparently not advisable according
to the API. Currently, I first create a dummy BufferedImage and
Graphics object to get a FontMetrics object, which I then repeatedly
use for creating subsequent labels. Seems to work quite well,
and I can determine rather nicely the exact sizes of various
strings. Would someone know of a better approach ?

While at it, let me also mention that the visual quality of the
Raster Text appears to be much better than a Text2D label !! Is
there any particular reason ? Can rendering and/or texture attributes
be fine tuned on a Text2D appearance object to make it look better ?

Please let me know if any of you have any comments.

Thanks in advance

Vaidya
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to