Package java.awt.image

Examples of java.awt.image.IndexColorModel.convertToIntDiscrete()


      return null;
    }
    ColorModel colorModel = img.getColorModel();
    if (colorModel instanceof IndexColorModel) {
      IndexColorModel indexModel = (IndexColorModel)colorModel;
      return indexModel.convertToIntDiscrete(img.getData(), false);
    }
    return null;
  }

View Full Code Here


      return null;
    }
    ColorModel colorModel = img.getColorModel();
    if (colorModel instanceof IndexColorModel) {
      IndexColorModel indexModel = (IndexColorModel)colorModel;
      return indexModel.convertToIntDiscrete(img.getData(), false);
    }
    return null;
  }

View Full Code Here

        // Use a faster conversion if this is an IndexColorModel
        if (inCM instanceof IndexColorModel &&
            ((outCM.equals(ColorModel.getRGBdefault())) ||
             (outCM.equals(XRGBModel)))) {
            IndexColorModel icm = (IndexColorModel) inCM;
            BufferedImage dbi = icm.convertToIntDiscrete(inRaster, false);
            return dbi.getRaster();
        }

        BufferedImage dbi =
            new BufferedImage(outCM,
View Full Code Here

        WritableRaster raster = model.createCompatibleWritableRaster(width, height);
        byte[] pixels = ((DataBufferByte) raster.getDataBuffer()).getData();
        for (int row = 0; row < height; row++)
            for (int col = 0; col < width; col++)
                pixels[row * width + col] = (byte) (startVal + col * bandsTotal / width);
        BufferedImage legend = model.convertToIntDiscrete(raster, false);
        Graphics2D gr = legend.createGraphics();
        gr.setColor(new Color(0));
        gr.drawString("travel time (minutes)", 0, 10);
        float scale = width / (float) bandsTotal;
        for (int i = startVal; i < bandsTotal; i += labelSpacing)
View Full Code Here

            //
            // Need to expand the indexed data to components.
            // The convertToIntDiscrete method is used to perform this.
            //
            IndexColorModel icm = (IndexColorModel)colorModel;
            bi = icm.convertToIntDiscrete(wRas, false);
            j2dEP = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam(bi);
        } else {
            bi = new BufferedImage(colorModel, wRas, false, null);
            j2dEP = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam(bi);
        }
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.