Package java.awt.image

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


         */
        if (hasMask())
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xff };
            IndexColorModel cm = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
            raster = cm.createCompatibleWritableRaster(cols, rows);
            bufferData = ((DataBufferByte) raster.getDataBuffer()).getData();

            byte[] array = ((DataBufferByte) image.getData().getDataBuffer()).getData();
            System.arraycopy(array, 0, bufferData, 0,
                    (array.length < bufferData.length ? array.length : bufferData.length));
View Full Code Here


         */
        if (hasMask())
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xff };
            IndexColorModel cm = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
            raster = cm.createCompatibleWritableRaster(cols, rows);
            bufferData = ((DataBufferByte) raster.getDataBuffer()).getData();

            byte[] array = ((DataBufferByte) image.getData().getDataBuffer()).getData();
            System.arraycopy(array, 0, bufferData, 0,
                    (array.length < bufferData.length ? array.length : bufferData.length));
View Full Code Here

        else
        {
            map = new byte[] {(byte)0xff};
        }
        ColorModel cm = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
        WritableRaster raster = cm.createCompatibleWritableRaster( cols, rows );
        DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();
        byte[] bufferData = buffer.getData();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int bytesRead;
View Full Code Here

         */
        if (hasMask())
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xff };
            IndexColorModel cm = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
            raster = cm.createCompatibleWritableRaster(cols, rows);
            bufferData = ((DataBufferByte) raster.getDataBuffer()).getData();

            byte[] array = ((DataBufferByte) image.getData().getDataBuffer()).getData();
            System.arraycopy(array, 0, bufferData, 0,
                    (array.length < bufferData.length ? array.length : bufferData.length));
View Full Code Here

                                        cmap, 0, (nbits > 1), -1,
                                        DataBuffer.TYPE_BYTE);
                // Note that this constructor has bugs pre 1.4...
                // bimg = new BufferedImage(64/nbits, 1, type, icm);
                WritableRaster wr =
                    icm.createCompatibleWritableRaster(64/nbits, 1);
                bimg = new BufferedImage(icm, wr, false, null);
            }
            for (int i = 0; i < bimg.getWidth(); i++) {
                bimg.setRGB(i, 0, rgbvals[i&3]);
            }
View Full Code Here

            finalVal = 120;
            labelSpacing = 30;
        }
  int bandsTotal = finalVal - startVal;

        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);
View Full Code Here

        int w = 256 * 2;
        int h = 200;

        dx = w / (numColors);

        WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
        for (int i = 0; i < numColors; i ++) {
            int rx = i * dx;

            int[] samples = new int[h * dx];
            Arrays.fill(samples, i);
View Full Code Here

    }

    private static BufferedImage createFrame(int[] palette) {
        IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
            palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
        WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
        int[] samples = new int[w * h];
        Arrays.fill(samples, 0);
        wr.setSamples(0, 0, w, h, 0, samples);

        BufferedImage img = new BufferedImage(icm, wr, false, null);
View Full Code Here

    //
    // Create the destination image
    //
    // //
    final IndexColorModel icm = getIndexColorModel();
    final WritableRaster destWr = icm.createCompatibleWritableRaster(src
        .getWidth(), src.getHeight());
    final BufferedImage dst = new BufferedImage(icm, destWr, false, null);

    // //
    //
View Full Code Here

         */
        if(hasMask())
        {
          byte map[] = new byte[] {(byte)0x00, (byte)0xff};
        IndexColorModel  cm = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
         raster = cm.createCompatibleWritableRaster( image.getWidth(), image.getHeight() );
           buffer = (DataBufferByte)raster.getDataBuffer();
          bufferData = buffer.getData();
 
          byte array[] = ((DataBufferByte)image.getData().getDataBuffer()).getData();
          System.arraycopy( array, 0,bufferData, 0,
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.