Hello,
I have some floating point data that I am scaling and translating to ints
and then creating a TYPE_INT_ARGB BufferedImage.
This BufferedImage will be drawn on top of another BufferedImage. I want
certain pixels in the top image to be partially transparent, and other
pixels to be completely transparent.
When I scale and translate the float data to ints, what I want to do is to
get the higher float values to show up as a shade of red and everything else
to be completely transparent.
So I scale into the range 0 ... 2^24 and then OR in an alpha value for the
highest 8 bits.
What I want is for the reddish pixels to be somewhat transparent and the
other pixels to be completely transparent.
--------------------------------------------------------------------
double maxDataVal = 0.655; // max val in the float data set
int alpha = 0x7f; // pretty much opaque
double scaleFactor = (Math.pow(2, 24) - 1)/maxDataVal ; // in
range 0 ... 2^24 - 1
intData[i] = alpha | ((int)(floatData[i] * scaleFactor) &
0x00ff0000)); // mask off the non-red bits
rgbImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
WritableRaster wr = rgbImage.getRaster( );
wr.setDataElements(0, 0, width, height, intData);
----------------------------------------------------------------------
The result is that the upper image has two colors/shades: red and dark gray
which are both partially transparent.
My question is: how do I turn those dark gray pixels to completely
transparent and at the same time retain the opacity of the red pixels?
Thank you,
Ted Hill
===========================================================================
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".