The AffineTransformOp can do affine transforms of images for you
and the filter() method that does the work takes an optional
second parameter that is the destination BufferedImage to store
the data into.  Try using that with your own temporary image
to store the transformed results into.  If you are using rotation
then the destination image should support alpha - I'd suggest
using INT_ARGB or INT_ARGB_PRE (try both and see which one
performs better - which will depend on whether we have a loop
that accepts one or the other of those types as the destination
for the source that you are trying to transform)...

...jim

--On Wednesday, November 19, 2003 08:40:59 -0800 eli curtz
<[EMAIL PROTECTED]> wrote:

Thanks for the information Dmitri,

I've been doing this testing on 1.4.2_02 on Windows, but it seems to
be an issue with previous versions as well. The garbage is getting
cleaned up fairly quickly, but there's so much of it it's causing
serious problems. Why is it necessary to create this raster? Can't it
just draw into the Graphics2D object? Or is there a way to force it
to keep the scratch raster around? As a last resort we can do our own
transformed drawing, but that seems like a poor solution.

Thanks,
eli


Hi Eli,


On Tue, Nov 18, 2003 at 04:07:24PM -0800, eli curtz wrote:
 > I'm working on a suite of simulation software which does a lot of
drawing
 > between BufferedImages and I have run into a memory issue with
 > Graphics2D.drawImage(Image, AffineTransform, ImageObserver), where
 > AffineTransform includes a rotation.
 >
 > According to J-Sprint 99%+ of my memory allocation is occuring
 > when DrawImage.transformImage calls
 > IntegerInterleavedRaster.createCompatibleWritableRaster(int,
 > int). This
is
> causing massive thrashing in the garbage collector and horrible
stuttering
 > in my graphics.
 >
 > Anybody have any advice on how to eliminate this? The source and
destination
> images are identical format. I'm not even sure what it's doing -
creating a
> temporary raster to draw the rotated image into?

That's exactly what it's doing.

  What java release are you using?
  We've improved our memory usage pattern somewhat in 1.4.1, I
  believe, by using our own thread to dispose of Java2D-generated
  garbage.

  Thank you,
    Dmitri

 >
 > thanks,
 > eli curtz
 >
 > [EMAIL PROTECTED]
 >
 >
=====================================================================
======
 > 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".

=========================================================================== 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