Yes, the various Java image classes accept all the drawing methods.

In fact, you'll probably get a speed up in performance if you draw to offscreen
buffers and then just draw the image once into the JPanel.

Look in the various foums for info on double buffering.  It's not
so daunting as it sounds.

Olsen Chris wrote:
Ken --

   Thank you very much for your lightning response!

  If I understand what you are saying, that is a terrific solution.  So,
then (to check my understanding), I can use what I think of as the
Graphics2D statements (e.g. drawstring, fillRect, etc) and draw to an
image?
-- Chris

Chris Olsen
H.S. Math / Assessment Facilitator
Educational Service Center
346 2nd Ave. SW
Cedar Rapids, IA  52404-2099


-----Original Message-----
From: Ken Warner [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 13, 2008 10:22 AM
To: Olsen Chris
Cc: [EMAIL PROTECTED]
Subject: Re: [JAVA2D] Alpha blending performance

The simple answer is don't draw into the JPanel -- draw into one of
Java's
image classes (Image, BufferedImage, etc.) and then draw the Image into
the JPanel.  Then save the Image as a jpeg in the usual ways...

Olsen Chris wrote:

Hello All --

 I have what is probably a simple problem to you all, but is so far
baffling me, a statistics guy doing programming.  I am hoping that
someone may have actually done what I am trying to do.

 At the end of some serious mathematical calculations (logistic
regression) I generate a graph in a JPanel.  My problem is that I

might

do this a few hundred times for a given run of the program.  What I

want

to do is save the contents of _each_ graph as a jpeg rather than do

lots

of screen captures.

 In preparation for coding I have been learning a bit about IMAGEIO,
etc., but am stumped about one aspect of my anticipated process: how

do

I get the contents of a content pane into an image format?

 I am assuming that I can't just cast it somehow; I am also assuming
that I cannot simply draw to an image the same way that I draw to the
content pane.  (These assumptions may be wrong??)

 I did run across a forum where someone said that they had not done

it,

but it SHOULD work in practice and then gave a strategy for doing it.

 Is there anyone who HAS done this and could offer a general

strategy?

I am OK with the coding before and after the panel contents --> image
step.  (Strategy much appreciated, sample code that works adored!)

 References to the literature are fine also...

Thank you in advance.
-- Chris

Chris Olsen
H.S. Math / Assessment Facilitator
Educational Service Center
346 2nd Ave. SW
Cedar Rapids, IA  52404-2099



========================================================================
===

To unsubscribe, send email to [EMAIL PROTECTED] and include in the

body

of the message "signoff JAVA2D-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 JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to