Package java.awt.image

Examples of java.awt.image.DataBuffer


            raster = null;
            return;
        }

        // Restore the DataBuffer from its serialized form.
        DataBuffer dataBuffer = (DataBuffer)dataBufferState.getObject();

        // Reconstruct the Raster.
        raster = Raster.createRaster(sampleModel, dataBuffer, location);
    }
View Full Code Here


        }

  if (checkDataBuffer) {
      Raster ras = source.getTile(source.getMinTileX(), source.getMinTileY());
      if (ras != null) {
    DataBuffer db = ras.getDataBuffer();
    if (db != null &&
        SerializerFactory.getSerializer(db.getClass()) == null)
        throw new IllegalArgumentException(JaiI18N.getString("SerializableRenderedImage4"));
      }
  }

        // Set server flag.
View Full Code Here

        }
    }

    public Raster computeTile(int tileX, int tileY) {
        if(getTileWidth() == getWidth() && getTileHeight() == getHeight()) {
            DataBuffer dataBuffer = new DataBufferInt(pixels, pixels.length);
            return Raster.createWritableRaster(getSampleModel(),
                                               dataBuffer,
                                               new Point(tileXToX(tileX),
                                                         tileYToY(tileY)));
        }
View Full Code Here

    /*
     * Create a Raster from the data of an uncompressed tile.
     */
    private Raster getUncompressedTile(int tx, int ty, byte[] data) {
        DataBuffer dataBuffer = new DataBufferByte(data, data.length);

        return Raster.createRaster(sampleModel, dataBuffer, new Point(tx, ty));
    }
View Full Code Here

                data[i++] = B;
                data[i++] = A;
            }
        }

        DataBuffer dataBuffer = new DataBufferByte(data, data.length);

        return Raster.createRaster(sampleModel, dataBuffer, new Point(tx, ty));
    }
View Full Code Here

     * Creates a <code>DataBuffer</code> that corresponds to this <code>ComponentSampleModel</code>.
     * The <code>DataBuffer</code>'s data type, number of banks, and size
     * will be consistent with this <code>ComponentSampleModel</code>.
     */
    public DataBuffer createDataBuffer() {
        DataBuffer dataBuffer = null;

        int size = (int)getBufferSize();
        switch (dataType) {
        case DataBuffer.TYPE_BYTE:
            dataBuffer = new DataBufferByte(size, numBanks);
View Full Code Here

        ComponentSampleModel sm = (ComponentSampleModel)raster.getSampleModel();

        if (type == sampleType) {
            // Data are stored in the requested array type; no need to copy.

            DataBuffer db = raster.getDataBuffer();
            int[] bankIndices = sm.getBankIndices();

            switch (sampleType) {
            case DataBuffer.TYPE_BYTE:
                byte[][] bbd = ((DataBufferByte)db).getBankData();
                byte[][] bd = new byte[numBands][];

                for (int b = 0; b < numBands; b++) {
                    bd[b] = bbd[bankIndices[b]];
                }
                data = bd;
                break;

            case DataBuffer.TYPE_USHORT:
            case DataBuffer.TYPE_SHORT:
                short[][] sbd = sampleType == DataBuffer.TYPE_USHORT ?
                                ((DataBufferUShort)db).getBankData() :
                                ((DataBufferShort)db).getBankData();
                short[][] sd = new short[numBands][];

                for (int b = 0; b < numBands; b++) {
                    sd[b] = sbd[bankIndices[b]];
                }
                data = sd;
                break;

            case DataBuffer.TYPE_INT:
                int[][] ibd = ((DataBufferInt)db).getBankData();
                int[][] id = new int[numBands][];

                for (int b = 0; b < numBands; b++) {
                    id[b] = ibd[bankIndices[b]];
                }
                data = id;
                break;

            case DataBuffer.TYPE_FLOAT:
                float[][] fbd = DataBufferUtils.getBankDataFloat(db);
                float[][] fd = new float[numBands][];

                for (int b = 0; b < numBands; b++) {
                    fd[b] = fbd[bankIndices[b]];
                }
                data = fd;
                break;

            case DataBuffer.TYPE_DOUBLE:
                double[][] dbd = DataBufferUtils.getBankDataDouble(db);
                double[][] dd = new double[numBands][];

                for (int b = 0; b < numBands; b++) {
                    dd[b] = dbd[bankIndices[b]];
                }
                data = dd;
                break;
            }

            pixelStride = sm.getPixelStride();
            lineStride = sm.getScanlineStride();

            // Determine offsets.
            int[] dbOffsets = db.getOffsets()// DataBuffer offsets
            int x = rect.x - raster.getSampleModelTranslateX();
            int y = rect.y - raster.getSampleModelTranslateY();

            offsets = new int[numBands];
            for (int b = 0; b < numBands; b++) {
View Full Code Here

            } else {

                MultiPixelPackedSampleModel sm =
                    (MultiPixelPackedSampleModel)sampleModel;

                DataBuffer db = raster.getDataBuffer();
                int dbOffset = db.getOffset();

                int x = rect.x - raster.getSampleModelTranslateX();
                int y = rect.y - raster.getSampleModelTranslateY();

                int smLineStride = sm.getScanlineStride();
View Full Code Here

                                              rect);
            } else {
                MultiPixelPackedSampleModel sm =
                    (MultiPixelPackedSampleModel)sampleModel;

                DataBuffer db = raster.getDataBuffer();
                int dbOffset = db.getOffset();

                int x = rect.x - raster.getSampleModelTranslateX();
                int y = rect.y - raster.getSampleModelTranslateY();

                int lineStride = sm.getScanlineStride();
View Full Code Here

                                      scanlineStride,
                                      dataOffset,
                                      dbi.getData());
                break;
            case DataBuffer.TYPE_FLOAT:
                DataBuffer dbf = raster.getDataBuffer();
                mlimages = new mediaLibImage[1];
                mlimages[0] =
                    new mediaLibImage(Constants.MLIB_FLOAT,
                                      numBands,
                                      rect.width,
                                      rect.height,
                                      scanlineStride,
                                      dataOffset,
                                      DataBufferUtils.getDataFloat(dbf));
                break;
            case DataBuffer.TYPE_DOUBLE:
                DataBuffer dbd = raster.getDataBuffer();
                mlimages = new mediaLibImage[1];
                mlimages[0] =
                    new mediaLibImage(Constants.MLIB_DOUBLE,
                                      numBands,
                                      rect.width,
View Full Code Here

TOP

Related Classes of java.awt.image.DataBuffer

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.