I'm doing the usual byte shift stuff to make a pixel.  Part of my bi-cubic 
interpolation.  Right now I clamp the value of a byte to be between 255 and 0 
to prevent technicolor speculation.  You know, those little annoying dots of 
out of place color.

This is what I'm doing now.

r = (int)(B0*(yReds[0]&0xff) + B1*(yReds[1]&0xff) + B2*(yReds[2]&0xff) + 
B3*(yReds[3]&0xff));
g = (int)(B0*(yGrns[0]&0xff) + B1*(yGrns[1]&0xff) + B2*(yGrns[2]&0xff) + 
B3*(yGrns[3]&0xff));
b = (int)(B0*(yBlus[0]&0xff) + B1*(yBlus[1]&0xff) + B2*(yBlus[2]&0xff) + 
B3*(yBlus[3]&0xff));

if(r < 0) r = 0;
if(r > 255) r = 255;
if(g < 0) g = 0;
if(g > 255) g = 255;
if(b < 0) b = 0;
if(b > 255) b = 255;

Clumsy and awkward.  Is there a better way to clamp the values?
Maybe with a mask or something?

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