tags:

views:

71

answers:

0

Hello

I'm trying to use JAI to create a single mosaic consisting of 4 TIF images each of which is 5000 x 5000. The code I have written is as follows ..

    RenderedOp mosaic=null;
    ParameterBlock pbMosaic=new ParameterBlock();
    pbMosaic.add(MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
    RenderedOp in=null;
    // Get 4 tiles and add them to the Mosaic
    in=returnRenderedOp(path,"northwest.tif");
    pbMosaic.addSource(in);
    in=returnRenderedOp(path,"northeast.tif");
    pbMosaic.addSource(in);
    in=returnRenderedOp(path,"southwest.tif");
    pbMosaic.addSource(in);     
    in=returnRenderedOp(path,"southeast.tif");
    pbMosaic.addSource(in);
    // Setup the ImageLayout
    ImageLayout imageLayout=new ImageLayout(0,0,10000,10000);
    imageLayout.setTileWidth(5000);
    imageLayout.setTileHeight(5000);
    imageLayout.setColorModel(in.getColorModel());
    imageLayout.setSampleModel(in.getSampleModel());
    mosaic=JAI.create("mosaic",pbMosaic,new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));

The problem is that all 4 images are being positioned in the same place in the top left hand corner of the mosaic so the other three quarters of it is empty. Can anyone tell me how I can choose the position of each picture that makes up the mosaic so each appears in the correct place ?

Thanks

Ian