Accessing Rasters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark McKay

    Accessing Rasters

    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 CompositeContex t class that will perform the actual work
    of composition my shape with the background. However, I don't know very
    much about rasters.

    The CompositeContex t 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
Working...