Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.TiledImage


    private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        theObject = in.readObject();
        if(isWritable) {
            theObject = new TiledImage((RenderedImage)theObject, true);
        }
    }
View Full Code Here


                // Create an ROI in destination rendered space.
                ROIShape roi = new ROIShape(at.createTransformedShape(rgn));

                // Create a TiledImage to contain the masked result.
                TiledImage ti = new TiledImage(rendering.getMinX(),
                                               rendering.getMinY(),
                                               rendering.getWidth(),
                                               rendering.getHeight(),
                                               rendering.getTileGridXOffset(),
                                               rendering.getTileGridYOffset(),
                                               rendering.getSampleModel(),
                                               rendering.getColorModel());

                // Set the TiledImage data source to the rendering.
                ti.set(rendering, roi);

                // Create a constant-valued image for the background.
                pb = new ParameterBlock();
                pb.add((float)ti.getWidth());
                pb.add((float)ti.getHeight());
                Byte[] bandValues =
                    new Byte[ti.getSampleModel().getNumBands()];
                for(int b = 0; b < bandValues.length; b++) {
                    bandValues[b] = new Byte((byte)255);
                }
                pb.add(bandValues);

                ImageLayout il = new ImageLayout();
                il.setSampleModel(ti.getSampleModel());
                RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT,
                                                       il);

                PlanarImage constImage = JAI.create("constant", pb, rh);

                // Compute a complement ROI.
                ROI complementROI =
                    (new ROIShape(ti.getBounds())).subtract(roi);;

                // Fill the background.
                int maxTileY = ti.getMaxTileY();
                int maxTileX = ti.getMaxTileX();
                for(int j = ti.getMinTileY(); j <= maxTileY; j++) {
                    for(int i = ti.getMinTileX(); i <= maxTileX; i++) {
                        if(!roi.intersects(ti.getTileRect(i, j))) {
                            ti.setData(constImage.getTile(i, j),
                                       complementROI);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.TiledImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.