FileDocCategorySizeDatePackage
ICompositeContext.javaAPI DocAndroid 1.5 API3172Wed May 06 22:41:54 BST 2009org.apache.harmony.awt.gl

ICompositeContext

public class ICompositeContext extends Object implements CompositeContext
This class represent implementation of the CompositeContext interface

Fields Summary
Composite
composite
ColorModel
srcCM
ColorModel
dstCM
org.apache.harmony.awt.gl.ImageSurface
srcSurf
org.apache.harmony.awt.gl.ImageSurface
dstSurf
Constructors Summary
public ICompositeContext(Composite comp, ColorModel src, ColorModel dst)

        composite = comp;
        srcCM = src;
        dstCM = dst;
    
Methods Summary
public voidcompose(java.awt.image.Raster srcIn, java.awt.image.Raster dstIn, java.awt.image.WritableRaster dstOut)


        if(!srcCM.isCompatibleRaster(srcIn)) {
            // awt.48=The srcIn raster is incompatible with src ColorModel
            throw new IllegalArgumentException(Messages.getString("awt.48")); //$NON-NLS-1$
        }

        if(!dstCM.isCompatibleRaster(dstIn)) {
            // awt.49=The dstIn raster is incompatible with dst ColorModel
            throw new IllegalArgumentException(Messages.getString("awt.49")); //$NON-NLS-1$
        }

        if(dstIn != dstOut){
            if(!dstCM.isCompatibleRaster(dstOut)) {
                // awt.4A=The dstOut raster is incompatible with dst ColorModel
                throw new IllegalArgumentException(Messages.getString("awt.4A")); //$NON-NLS-1$
            }
            dstOut.setDataElements(0, 0, dstIn);
        }
        WritableRaster src;
        if(srcIn instanceof WritableRaster){
            src = (WritableRaster) srcIn;
        }else{
            src = srcIn.createCompatibleWritableRaster();
            src.setDataElements(0, 0, srcIn);
        }
        srcSurf = new ImageSurface(srcCM, src);
        dstSurf = new ImageSurface(dstCM, dstOut);

        int w = Math.min(srcIn.getWidth(), dstOut.getWidth());
        int h = Math.min(srcIn.getHeight(), dstOut.getHeight());

        NativeImageBlitter.getInstance().blit(0, 0, srcSurf, 0, 0, dstSurf,
                w, h, composite, null, null);

    
public voiddispose()

        srcSurf.dispose();
        dstSurf.dispose();