Package javax.media.jai

Examples of javax.media.jai.ImageLayout


            }
          }
        }

        if (images.size() > 0) {
          ImageLayout imageLayout = new ImageLayout(0, 0, (int) pixelBounds.getWidth(),
              (int) pixelBounds.getHeight());
          imageLayout.setTileWidth(tileWidth);
          imageLayout.setTileHeight(tileHeight);

          // create the mosaic image
          ParameterBlock pbMosaic = new ParameterBlock();
          pbMosaic.add(MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
          for (RenderedImage renderedImage : images) {
View Full Code Here


     * @return
     */
    private RenderedImage optimizeSampleModel(RenderedImage source) {
        int w = source.getWidth();
        int h = source.getHeight();
        ImageLayout layout = new ImageLayout();
        layout.setColorModel(source.getColorModel());
        layout.setSampleModel(source.getColorModel().createCompatibleSampleModel(w, h));
        // if I don't force tiling off with this setting an exception is thrown
        // when writing the image out...
        layout.setTileWidth(w);
        layout.setTileHeight(h);
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
        return LookupDescriptor.create(source, IDENTITY_TABLE, hints);
    }
View Full Code Here

                // bitmask
                dstColorModel = new IndexColorModel(
                    bitsPerPixel, maxNumEntries, reds, greens, blues, alphas);
            }

            ImageLayout il = new ImageLayout();
            il.setColorModel(dstColorModel);
            RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);

            // reformat this image to use the new ColorModel (and its new color map)
            ParameterBlock formatPB = new ParameterBlock();
            formatPB.addSource(src);
View Full Code Here

            -1,
            oldModel.getTransferType());

        // Create an image layout from the input image (this makes the
        // layout have the same values as the imput image).
        ImageLayout layout = new ImageLayout(src);
        // Set the color model of the ImageLayout to the new ColorModel
        // without the alpha/transparency included
        layout.setColorModel(newModel);
        // Create renderinghints to tell the format operation what to do
        // i.e. use the image layout created above and use it during
        // the formatting operation.
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT,
                                                  layout);
View Full Code Here

        int bitSize = numBitsToIndexColourmap(colorMapSize);

        KernelJAI kernel = getKernelFor(params, bitSize);
        IndexColorModel cm = getIndexColorModel(src, colorMapSize);
        ImageLayout layout = new ImageLayout();
        layout.setColorModel(cm);
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
        if (src.getColorModel().getTransparency() != Transparency.OPAQUE &&
            (!(src.getColorModel() instanceof IndexColorModel))) {

           // RenderedOp alpha = ImageUtils.extractAlphaChannel(src);
View Full Code Here

        // format of the image. This has caused numerous problems.
        // Therefore the brute force aprroach is here taken to change the
        // in-memory format of the image to a type that we know the
        // operator likes. This is not fool proof. It converts all images
        // into non-indexed representations that have a byte pixel width
        ImageLayout layout = new ImageLayout();
        layout.setSampleModel(
            new BandedSampleModel(DataBuffer.TYPE_BYTE,
                                  src.getWidth(),
                                  src.getHeight(),
                                  src.getColorModel().getNumColorComponents()));
        // set up the rendering hints object that is passed to the format
View Full Code Here

                // transparency.
                converted = ImageUtils.applyAlphaChannel(converted, 0);

                // now we coerce the data into a format that the BMP writer
                // seems happy with.
                ImageLayout layout = new ImageLayout();
                SampleModel sampleModel =
                    RasterFactory.createComponentSampleModel(
                        converted.getSampleModel(),
                        converted.getSampleModel().getDataType(),
                        converted.getWidth(),
                        converted.getHeight(),
                        3);
                layout.setSampleModel(sampleModel);
                RenderingHints hints = new RenderingHints(
                    JAI.KEY_IMAGE_LAYOUT, layout);
                converted = FormatDescriptor.create(
                    converted,
                        converted.getSampleModel().getDataType(),
View Full Code Here

                                    -1,
                                    oldModel.getTransferType());

            // Create an image layout from the input image (this makes the
            // layout have the same values as the imput image).
            ImageLayout layout = new ImageLayout(input);
            // Set the color model of the ImageLayout to the new ColorModel
            // without the alpha/transparency included.
            layout.setColorModel(newModel);
            // Create renderinghints to tell the format operation what to do
            // i.e. use the image layout created above and use it during
            // the formatting operation.
            RenderingHints rHint = new RenderingHints(JAI.KEY_IMAGE_LAYOUT,
                                                      layout);
View Full Code Here

            pb.add(colorMap);
            pb.add(KernelJAI.DITHER_MASK_441);
        }
       
        //Create an image layout for a monochrome b/w image
        ImageLayout layout = new ImageLayout();
        byte[] map = new byte[] {(byte)0x00, (byte)0xff};
        ColorModel cm = new IndexColorModel(1, 2, map, map, map);
        layout.setColorModel(cm);

        // Create a hint containing the layout.
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

        // Dither the image.
View Full Code Here

            pb.add(colorMap);
            pb.add(KernelJAI.DITHER_MASK_441);
        }
       
        //Create an image layout for a monochrome b/w image
        ImageLayout layout = new ImageLayout();
        byte[] map = new byte[] {(byte)0x00, (byte)0xff};
        ColorModel cm = new IndexColorModel(1, 2, map, map, map);
        layout.setColorModel(cm);

        // Create a hint containing the layout.
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

        // Dither the image.
View Full Code Here

TOP

Related Classes of javax.media.jai.ImageLayout

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.