Package org.geotools.image

Examples of org.geotools.image.ImageWorker


                            // create a color mask
                            String[] colorSplit = ((String) maskColor).split(":"); //$NON-NLS-1$
                            Color color = new Color(Integer.parseInt(colorSplit[0]), Integer.parseInt(colorSplit[1]),
                                    Integer.parseInt(colorSplit[2]));
                            RenderedImage image = coverage.getRenderedImage();
                            ImageWorker iw = new ImageWorker(image);
                            iw.makeColorTransparent(color);
                            image = iw.getRenderedImage();
                            GridCoverageFactory gcF = CoverageFactoryFinder.getGridCoverageFactory(null);
                            coverage = gcF.create(coverage.getName(), image, coverage.getCoordinateReferenceSystem(), coverage
                                    .getGridGeometry().getGridToCRS(), coverage.getSampleDimensions(), null, null);
                        }
                 
View Full Code Here


                            // create a color mask
                            String[] colorSplit = ((String) maskColor).split(":"); //$NON-NLS-1$
                            Color color = new Color(Integer.parseInt(colorSplit[0]), Integer.parseInt(colorSplit[1]),
                                    Integer.parseInt(colorSplit[2]));
                            RenderedImage image = coverage.getRenderedImage();
                            ImageWorker iw = new ImageWorker(image);
                            iw.makeColorTransparent(color);
                            image = iw.getRenderedImage();
                            GridCoverageFactory gcF = CoverageFactoryFinder.getGridCoverageFactory(null);
                            coverage = gcF.create(coverage.getName(), image, coverage.getCoordinateReferenceSystem(), coverage
                                    .getGridGeometry().getGridToCRS(), coverage.getSampleDimensions(), null, null);
                        }
                     
View Full Code Here

        //
        // Reformatting this image for png
        //
        // /////////////////////////////////////////////////////////////////
        final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(out);
        final ImageWorker worker = new ImageWorker(image);
        final PlanarImage finalImage = (image.getColorModel() instanceof DirectColorModel)
            ? worker.forceComponentColorModel().getPlanarImage() : worker.getPlanarImage();

        // /////////////////////////////////////////////////////////////////
        //
        // Getting a writer
        //
View Full Code Here

     */
    public void writeTo(OutputStream out) throws IOException, ServiceException {
        //GR: shall we add a palette parameter to GetLegendGraphic too?
        final BufferedImage legendGraphic = getLegendGraphic();
        RenderedImage forcedIndexed8Bitmask = ImageUtils.forceIndexed8Bitmask(legendGraphic, null);
        ImageWorker imageWorker = new ImageWorker(forcedIndexed8Bitmask);
        imageWorker.writeGIF(out, "LZW", 0.75f);
    }
View Full Code Here

        // /////////////////////////////////////////////////////////////////
        //
        // Now the magic
        //
        // /////////////////////////////////////////////////////////////////
        new ImageWorker(super.forceIndexed8Bitmask(originalImage)).writeGIF(outStream, "LZW", 0.75f);
    }
View Full Code Here

        if (format.equalsIgnoreCase("image/png8") || (this.mapContext.getPaletteInverter() != null)) {
            image = forceIndexed8Bitmask(image);
        }

        float quality = (100 - wms.getPngCompression()) / 100.0f;
        new ImageWorker(image).writePNG(outStream, "FILTERED", quality, PNGNativeAcc.booleanValue(),
            image.getColorModel() instanceof IndexColorModel);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing png image ... done!");
        }
View Full Code Here

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("About to write a JPEG image.");
        }
       
        float quality = (100 - wms.getJpegCompression()) / 100.0f;
        new ImageWorker(image).writeJPEG(outStream, "JPEG", quality, JPEGNativeAcc);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing a JPEG done!!!");
        }
    }
View Full Code Here

            // Storing Image ...
            //
            // /////////////////////////////////////////////////////////////////
            final ZipEntry e = new ZipEntry("layer_" + (i) + ".png");
            outZ.putNextEntry(e);
            new ImageWorker(curImage).writePNG(outZ, "FILTERED", 0.75f, false, false);
            //final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(outZ);
            /*final PlanarImage encodedImage = PlanarImage
                            .wrapRenderedImage(curImage);
            //final PlanarImage finalImage = encodedImage.getColorModel() instanceof DirectColorModel?ImageUtilities
            //                .reformatColorModel2ComponentColorModel(encodedImage):encodedImage;
View Full Code Here

                // The image is indexed on 8 bits and the color model is
                // Translucent, we have to perform some color operations in
                // order to convert it to bitmask.
                //
                // //
                image = new ImageWorker(originalImage)
                        .forceBitmaskIndexColorModel().getRenderedImage();
            }
        } else {
            // /////////////////////////////////////////////////////////////////
            //
            // NOT IndexColorModel and DataBuffer.TYPE_BYTE
            //
            // ///
            //
            // We got an image that needs to be converted.
            //
            // /////////////////////////////////////////////////////////////////

            if (invColorMap != null) {

                // make me parametric which means make me work with other image
                // types
                image = invColorMap.filterRenderedImage(originalImage);
            } else {
                // //
                //
                // We do not have a paletteInverter, let's create a palette that
                // is as good as possible.
                //
                // //
                // make sure we start from a componentcolormodel.
                image = new ImageWorker(originalImage)
                        .forceComponentColorModel().getRenderedImage();

                // //
                //
                // Build the CustomPaletteBuilder doing some good subsampling.
View Full Code Here

        ////
        //
        // ImageWorker
        //
        ////
        final ImageWorker worker= new ImageWorker(source);
        worker.setRenderingHints(hints);
        worker.affine(
                (AffineTransform)parameters.getObjectParameter("transform") ,
                interpolation,
                (double[])parameters.getObjectParameter("backgroundValues"));
        return worker.getRenderedImage();
    }
View Full Code Here

TOP

Related Classes of org.geotools.image.ImageWorker

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.