I don't have the code in front of me, but you can iterate through the
buffered image one scan line at a time and pull them into an array of ints.
I do this to manipulate textures all the time.  It is much faster to
manipulate the scan lines and then plop them back into the buffered image
than it is to use the setRGB

Dave

-----Original Message-----
From: Corysia Taware [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 2:46 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Accessing BufferedImage data


  I'm probably spending too much time on this because I don't know if I'll
get a speed increase or not.

  I've got a texture which I need to tweak the color of.  Right now, I'm
using a nested for loop to move over the data and pull each pixel with
getRGB(x,y).  Is there a faster or better way to do this?

  I looked into getting a BufferData object from WritableRaster, but when I
pulled the int value with BufferData.getElem(x), it didn't seem to contain
the correct data.

  What I'm currently doing:

    for (int x = 0; x < w; x++)
        for (int y = 0; y < h; y++) {
            int color = originalBufferedImage.getRGB(x, y);
            // some code to modify color
            newBufferedImage.setRGB(x, y, color);
        }

  Is there a way to optimize this?



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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