gradient paint algoritm

i want to perform a gradient paint that maps between say ‘RED’ (RGB = 1,0,0) and say gray(128, 128, 128 ) the values from ranges from -2048 to 2047. how should i do this? give each color component a value of 4 bits( the range is 12 bits ) and interpolate between them?

cheers,

Paul

Not really sure if I understand you right, but here’s a link to a tutorial showing you how to fill a shape with gradient.

http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html#Java2D-Tutorial-Paint-Example1