Package org.geotools.image.palette

Examples of org.geotools.image.palette.InverseColorMapOp


  }

  public Object parse(String value) throws Exception {
    // palette
    try {
      final InverseColorMapOp model = PaletteManager.getPalette(value);
      if (model == null) {
        throw new WmsException("Palette " + value
            + " could not be found "
            + "in $GEOSERVER_DATA_DIR/palettes directory");
      }
View Full Code Here


      if (fileName.endsWith("pal")) {
        final IndexColorModel icm = new PALFileLoader(file)
            .getIndexColorModel();

        if (icm != null) {
          final InverseColorMapOp eicm = new InverseColorMapOp(
              icm);
          paletteCache.put(name, new PaletteCacheEntry(file, eicm));
          return eicm;
        }
      } else {
        ImageInputStream iis = ImageIO.createImageInputStream(file);
                final Iterator it = ImageIO.getImageReaders(iis);
        if (it.hasNext()) {
          final ImageReader reader = (ImageReader) it.next();
          reader.setInput(iis);
          final ColorModel cm = ((ImageTypeSpecifier) reader
              .getImageTypes(0).next()).getColorModel();
          if (cm instanceof IndexColorModel) {
            final IndexColorModel icm = (IndexColorModel) cm;
            final InverseColorMapOp eicm = new InverseColorMapOp(
                icm);
            paletteCache.put(name,
                new PaletteCacheEntry(file, eicm));
            return eicm;
          }
View Full Code Here

        if (antialias != null)
            antialias = antialias.toUpperCase();

        // figure out a palette for buffered image creation
        IndexColorModel palette = null;
        final InverseColorMapOp paletteInverter = mapContext
        .getPaletteInverter();
        final boolean transparent = mapContext.isTransparent();
        final Color bgColor = mapContext.getBgColor();
        if (paletteInverter != null && AA_NONE.equals(antialias)) {
            palette = paletteInverter.getIcm();
        } else if (AA_NONE.equals(antialias)) {
            PaletteExtractor pe = new PaletteExtractor(transparent ? null : bgColor);
            MapLayer[] layers = mapContext.getLayers();
            for (int i = 0; i < layers.length; i++) {
                pe.visit(layers[i].getStyle());
View Full Code Here

        // get the one required by the GetMapRequest
        GetMapRequest request = mapContext.getRequest();
        final String format = request.getFormat();
        // do we want it to be 8 bits?
        InverseColorMapOp paletteInverter = mapContext.getPaletteInverter();
        if (IMAGE_GEOTIFF8.equalsIgnoreCase(format) || (paletteInverter != null)) {
            image = forceIndexed8Bitmask(image, paletteInverter);
        }
       
        // crating a grid coverage
View Full Code Here

        // /////////////////////////////////////////////////////////////////
        //
        // Now the magic
        //
        // /////////////////////////////////////////////////////////////////
        InverseColorMapOp paletteInverter = mapContext.getPaletteInverter();
        RenderedImage renderedImage = super.forceIndexed8Bitmask(originalImage, paletteInverter);
        ImageWorker imageWorker = new ImageWorker(renderedImage);
        imageWorker.writeGIF(outStream, "LZW", 0.75f);
    }
View Full Code Here

        }

        // get the one required by the GetMapRequest
        final String format = mapContext.getRequest().getFormat();
        if ("image/png8".equalsIgnoreCase(format) || (mapContext.getPaletteInverter() != null)) {
            InverseColorMapOp paletteInverter = mapContext.getPaletteInverter();
            image = forceIndexed8Bitmask(image, paletteInverter);
        }

        Boolean PNGNativeAcc = wms.getPNGNativeAcceleration();
        float quality = (100 - wms.getPngCompression()) / 100.0f;
View Full Code Here

        return null;
    }

    public static InverseColorMapOp getInverseColorMapOp(IndexColorModel icm) {
        // check for cached one, making sure it's not stale
        InverseColorMapOp op = (InverseColorMapOp) opCache.get(icm);
        if (op != null) {
            return op;
        } else {
            op = new InverseColorMapOp(icm);
            opCache.put(icm,  op);
            return op;
        }
  }
View Full Code Here

      if (fileName.endsWith("pal")) {
        final IndexColorModel icm = new PALFileLoader(file)
            .getIndexColorModel();

        if (icm != null) {
          final InverseColorMapOp eicm = new InverseColorMapOp(
              icm);
          paletteCache.put(name, new PaletteCacheEntry(file, eicm));
          return eicm;
        }
      } else {
        ImageInputStream iis = ImageIO.createImageInputStream(file);
                final Iterator it = ImageIO.getImageReaders(iis);
        if (it.hasNext()) {
          final ImageReader reader = (ImageReader) it.next();
          reader.setInput(iis);
          final ColorModel cm = ((ImageTypeSpecifier) reader
              .getImageTypes(0).next()).getColorModel();
          if (cm instanceof IndexColorModel) {
            final IndexColorModel icm = (IndexColorModel) cm;
            final InverseColorMapOp eicm = new InverseColorMapOp(
                icm);
            paletteCache.put(name,
                new PaletteCacheEntry(file, eicm));
            return eicm;
          }
View Full Code Here

  }

  public Object parse(String value) throws Exception {
    // palette
    try {
      final InverseColorMapOp model = PaletteManager.getPalette(value);
      if (model == null) {
        throw new ServiceException("Palette " + value
            + " could not be found "
            + "in $GEOSERVER_DATA_DIR/palettes directory");
      }
View Full Code Here

        if (antialias != null)
            antialias = antialias.toUpperCase();

        // figure out a palette for buffered image creation
        IndexColorModel palette = null;
        final InverseColorMapOp paletteInverter = mapContext.getPaletteInverter();
        final boolean transparent = mapContext.isTransparent() && isTransparencySupported();
        final Color bgColor = mapContext.getBgColor();
        if (paletteInverter != null && AA_NONE.equals(antialias)) {
            palette = paletteInverter.getIcm();
        } else if (AA_NONE.equals(antialias)) {
            PaletteExtractor pe = new PaletteExtractor(transparent ? null : bgColor);
            MapLayer[] layers = mapContext.getLayers();
            for (int i = 0; i < layers.length; i++) {
                pe.visit(layers[i].getStyle());
View Full Code Here

TOP

Related Classes of org.geotools.image.palette.InverseColorMapOp

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.