protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {

	Raster source = sources[0];
	Rectangle srcRect = source.getBounds();

        int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);

        MediaLibAccessor srcAccessor = new MediaLibAccessor(source, srcRect,
							    formatTag);
        MediaLibAccessor dstAccessor = new MediaLibAccessor(dest, destRect,
							    formatTag);

	// Get the floating point scale factors
	float mlibScaleX = scaleX;
	float mlibScaleY = scaleY;

        // Translation to be specified to Medialib. Note that we have to 
	// specify an additional translation since all images are 0 based
	// in Medialib.  Note that scale and translation scalars have
	// rational representations.
	    
	// Calculate intermediate values using rational arithmetic.
	long tempDenomX = scaleXRationalDenom * transXRationalDenom;
        long tempDenomY = scaleYRationalDenom * transYRationalDenom;
	long tempNumerX = (srcRect.x * scaleXRationalNum * transXRationalDenom) + 
	                  (transXRationalNum * scaleXRationalDenom) - 
			  (destRect.x * tempDenomX);
	long tempNumerY = (srcRect.y * scaleYRationalNum * transYRationalDenom) +
	                  (transYRationalNum * scaleYRationalDenom) -
			  (destRect.y * tempDenomY);
        float tx = (float)tempNumerX/(float)tempDenomX;
	float ty = (float)tempNumerY/(float)tempDenomY;

	mediaLibImage srcML[], dstML[];

        switch (dstAccessor.getDataType()) {
        case DataBuffer.TYPE_BYTE:
        case DataBuffer.TYPE_USHORT:
        case DataBuffer.TYPE_SHORT:
        case DataBuffer.TYPE_INT:
            srcML = srcAccessor.getMediaLibImages();
            dstML = dstAccessor.getMediaLibImages();
            for (int i = 0 ; i < dstML.length; i++) {
                Image.ZoomTranslate(dstML[i], srcML[i],
						    (double)mlibScaleX,
						    (double)mlibScaleY,
						    (double)tx, (double)ty, 
						    Constants.MLIB_NEAREST,
                                                    Constants.MLIB_EDGE_DST_NO_WRITE);
            }
            break;

	case DataBuffer.TYPE_FLOAT:
	case DataBuffer.TYPE_DOUBLE:
            srcML = srcAccessor.getMediaLibImages();
            dstML = dstAccessor.getMediaLibImages();
            for (int i = 0 ; i < dstML.length; i++) {
                Image.ZoomTranslate_Fp(dstML[i], srcML[i],
						       (double)mlibScaleX,
						       (double)mlibScaleY,
						       (double)tx, (double)ty, 
						       Constants.MLIB_NEAREST,
						       Constants.MLIB_EDGE_DST_NO_WRITE);
            }
            break;
	    
        default:
            String className = this.getClass().getName();
            throw new RuntimeException(JaiI18N.getString("Generic2"));
        }

        if (dstAccessor.isDataCopy()) {
            dstAccessor.clampDataArrays();
            dstAccessor.copyDataToRaster();
        }
    }