Package org.geotools.image

Examples of org.geotools.image.ImageWorker.forceComponentColorModel()


        //
        // /////////////////////////////////////////////////////////////////
        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


     * switch to component color model which is really easier to handle even
     * if it much more memory expensive. Once we are in component color
     * model is really easy to go to Gif and similar.
     */
    if (image.getColorModel() instanceof DirectColorModel) {
      worker.forceComponentColorModel();
      image = worker.getRenderedImage();
    }

    /**
     * ADJUSTMENTS FOR VARIOUS FILE FORMATS
View Full Code Here

       * this properly. NOTE. The only transfert types avalaible for
       * IndexColorModel are byte and ushort.
       */
      if (image.getColorModel() instanceof IndexColorModel
          && (image.getSampleModel().getTransferType() != DataBuffer.TYPE_BYTE)) {
        worker.forceComponentColorModel();
        image = worker.getRenderedImage();
      }

      /**
       * component color model is not well digested by the gif encoder we
View Full Code Here

            }
            PlanarImage alphaChannel=null;   
            if (hasAlpha || doInputTransparency) {
                ImageWorker w = new ImageWorker(granule);
                if (granule.getSampleModel() instanceof MultiPixelPackedSampleModel||granule.getColorModel() instanceof IndexColorModel) {
                    w.forceComponentColorModel();
                    granule=w.getRenderedImage();
                }
                // doing this here gives the guarantee that I get the correct index for the transparency band
                alphaIndex[0] = granule.getColorModel().getNumComponents() - 1;
                assert alphaIndex[0]< granule.getSampleModel().getNumBands();
View Full Code Here

    if (transparentColor != null) {
      if (LOGGER.isLoggable(Level.FINE))
        LOGGER.fine("Support for alpha on final image");
      final ImageWorker w = new ImageWorker(image);
      if (image.getSampleModel() instanceof MultiPixelPackedSampleModel)
        w.forceComponentColorModel();
      return w.makeColorTransparent(transparentColor).getRenderedImage();
 
    }
    return image;
  }
View Full Code Here

            ImageWorker w = new ImageWorker(img);
            // I have to force going to ComponentColorModel in
            // case the image is indexed.
            if (img.getSampleModel() instanceof MultiPixelPackedSampleModel
                    || img.getColorModel() instanceof IndexColorModel) {
                w.forceComponentColorModel();
                img = w.getRenderedImage();
            }
            boolean hasAlpha = img.getColorModel() != null ? img.getColorModel().hasAlpha() : false;
            if (hasAlpha) {
                alphaChannel |= hasAlpha;
View Full Code Here

        if(transparentColor==null){
            return image;
        }
        final ImageWorker w = new ImageWorker(image);
        if (image.getSampleModel() instanceof MultiPixelPackedSampleModel){
            w.forceComponentColorModel();
        }
        return w.makeColorTransparent(transparentColor).getRenderedImage();
    }

    static public ImageReadParam cloneImageReadParam(ImageReadParam param) {
View Full Code Here

        // Reformatting this image for png
        //
        // /////////////////////////////////////////////////////////////////
        final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(output);
        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

            }
            if (location == null) {
                RenderedImage image = coverage.getRenderedImage();
                if (forceTransparent) {
                    ImageWorker iw = new ImageWorker(image);
                    iw.forceComponentColorModel();
                    final ImageLayout tempLayout = new ImageLayout(image);
                    tempLayout.unsetValid(ImageLayout.COLOR_MODEL_MASK).unsetValid(
                            ImageLayout.SAMPLE_MODEL_MASK);
                    RenderedImage alpha = ConstantDescriptor.create(
                            Float.valueOf(image.getWidth()), Float.valueOf(image.getHeight()),
View Full Code Here

        // Reformatting this image for png
        //
        // /////////////////////////////////////////////////////////////////
        final MemoryCacheImageOutputStream memOutStream = new MemoryCacheImageOutputStream(output);
        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

TOP
Copyright © 2018 www.massapi.com. 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.