I suppose that there are overloaded versions of getRGB() and setRGB()
for manipulating rectangular blocks of pixels, such as:
int[] getRGB( int x, int y, int w, int h, int[] data, int offset,
int scansize )
But I have also read that getRGB() is not a very recommended way
of grabbing info. in some situations.
The apparently recommended ones are those in Raster and WritableRaster,
which are:
int[] getPixel(...) for getting data from a single pixel, and
int[] getPixels(...) for that from a block of pixels.
I have been getting a hang of these just recently...
Raj Vaidya
>On Fri, 16 Nov 2001 12:45:37 -0700, Corysia Taware <[EMAIL PROTECTED]> wrote:
> 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".