Hi,
On Nov 28, 2008, at 6:21 PM, John Kershaw wrote:
> Sorry if this is a real newbie question, but I cannot figure out
> the syntax
> to change the color components in an RGB image. I am using:
>
> ip.putPixel( x, y, int[] ????)
>
> I cannot seem to figure out how to specify the Array values in java
> (I'm not
> a java program, but am learning).
>
>
In this case you can do something like the following...
int[] col = {0, 255, 0};
ip.putPixel(x, y, col) ;
On the other hand, if you can compose the RGB triplet values into a
single color integer then you can call the method...
ip.putPixel(x,y, value);
You can convert from the color triplets to the integer value using
the step Wayne uses (see the source code for ColorProcessor putPixel
methods.) He does it like this ...
value = (r<<16)+(g<<8)+b
Cheers,
Ben