Accessing Rasters

From: Mark McKay (mark_at_kitfox.com)
Date: 04/01/04


Date: 1 Apr 2004 13:43:22 -0800

I need to implement a 'multiply' method for a filled shape, and figured
the best way to do this is by extending Composite. I've done this, and
also created a CompositeContext class that will perform the actual work
of composition my shape with the background. However, I don't know very
much about rasters.

The CompositeContext interface provides me with the method

   public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
   {

   }

Somehow I need to determine the RGBA values of each pixel in src and
dstIn, perform a calculation, and write the result to the coresposding
pixel in dstOut. These rasters should have the same dimensions.

The interface methods also provide me with a ColorModel srcColorModel
and a ColorModel dstColorModel.

Any idea what I can do? I can't figure out how to convert a Raster and
a ColorModel into RGBA.

Mark McKay