Examples of DataBuffer


Examples of java.awt.image.DataBuffer

        this.tileCacheMetric = tileCacheMetric;  // may be null

        key = hashKey(owner, tileX, tileY);

        // tileMemorySize(Raster tile) inlined for performance
        DataBuffer db = tile.getDataBuffer();
        memorySize = db.getDataTypeSize(db.getDataType()) / 8L *
                     db.getSize() * db.getNumBanks();

    }
View Full Code Here

Examples of java.awt.image.DataBuffer

        if(location == null) {
           location = new Point(0,0);
        }

        DataBuffer db = null;

        int type = sampleModel.getTransferType();
        long numBanks = 0;
        long size = 0;
View Full Code Here

Examples of java.awt.image.DataBuffer

    /**
     * Recycle the given tile.
     */
    public void recycleTile(Raster tile) {
        DataBuffer db = tile.getDataBuffer();

        Long key = new Long(((long)db.getDataType() << 56) |
                            ((long)db.getNumBanks() << 32) |
                            (long)db.getSize());

        if(DEBUG) {
            System.out.println("Recycling array for: "+
                               db.getDataType()+" "+
                               db.getNumBanks()+" "+
                               db.getSize());
            //System.out.println("recycleTile(); key = "+key);
        }

        synchronized(recycledArrays) {
            Object value = recycledArrays.get(key);
            ArrayList arrays = null;
            if(value != null) {
                arrays = (ArrayList)value;
            } else {
                arrays = new ArrayList();
            }

            memoryUsed += getDataBankSize(db.getDataType(),
                                          db.getNumBanks(),
                                          db.getSize());

            arrays.add(getBankReference(db));

            if(value == null) {
                recycledArrays.put(key, arrays);
View Full Code Here

Examples of java.awt.image.DataBuffer

  // Get the data array out of the DataBuffer
  byte bdata[] = null;
  short sdata[] = null;
  int idata[] = null;
  float fdata[] = null;
  DataBuffer buffer = sampleModel.createDataBuffer();

  int dataType = sampleModel.getDataType();
  if (dataType == DataBuffer.TYPE_BYTE) {
      bdata = ((DataBufferByte)buffer).getData();
  } else if (dataType == DataBuffer.TYPE_USHORT) {
      sdata = ((DataBufferUShort)buffer).getData();
  } else if (dataType == DataBuffer.TYPE_SHORT) {
      sdata = ((DataBufferShort)buffer).getData();
  } else if (dataType == DataBuffer.TYPE_INT) {
      idata = ((DataBufferInt)buffer).getData();
  } else if (dataType == DataBuffer.TYPE_FLOAT) {
            if(buffer instanceof DataBufferFloat) {
                fdata = ((DataBufferFloat)buffer).getData();
            } else {
                // This is a hack to make this work with JAI which in some
                // cases downcasts the DataBuffer to a type-specific class.
                // In the case of float data this current means the JAI class
                // com.lightcrafts.mediax.jai.DataBufferFloat.
                try {
                    Method getDataMethod =
                        buffer.getClass().getMethod("getData", null);
                    fdata = (float[])getDataMethod.invoke(buffer, null);
                } catch(Exception e) {
                    String message = JaiI18N.getString("TIFFImage18");
                    ImagingListenerProxy.errorOccurred(message,
                                           new ImagingException(message, e),
View Full Code Here

Examples of java.awt.image.DataBuffer

    @Override
    public void append(BufferedImage img, int lines) throws IOException {

      /* get raw data of image */
      DataBuffer imageDataBuffer = img.getRaster().getDataBuffer();
      int[] data = (((DataBufferInt)imageDataBuffer).getData());
     
      /* create one ImageLine that will be refilled and written to png */
      ImageLineByte bline = new ImageLineByte(imgInfo);
      byte[] line = bline.getScanline();
View Full Code Here

Examples of java.awt.image.DataBuffer

      // collect and write content

      ByteBuffer writeBuffer = ByteBuffer.allocate(
          3 * img.getWidth() * lines);
     
      DataBuffer imageDataBuffer = img.getRaster().getDataBuffer();
      int[] data = (((DataBufferInt)imageDataBuffer).getData());
     
      for (int i = 0; i < img.getWidth() * lines; i++) {
        int value = data[i];
        writeBuffer.put((byte)(value >>> 16));
View Full Code Here

Examples of java.awt.image.DataBuffer

                    intDataArrays[i] = dbi.getData(bankIndices[i]);
                }
                break;

            case DataBuffer.TYPE_FLOAT:
                DataBuffer dbf = (DataBuffer)raster.getDataBuffer();
                floatDataArrays = new float[numBands][];
                for (int i = 0; i < numBands; i++) {
                    floatDataArrays[i] =
                        DataBufferUtils.getDataFloat(dbf, bankIndices[i]);
                }
                break;

            case DataBuffer.TYPE_DOUBLE:
                DataBuffer dbd = (DataBuffer)raster.getDataBuffer();
                doubleDataArrays = new double[numBands][];
                for (int i = 0; i < numBands; i++) {
                    doubleDataArrays[i] =
                        DataBufferUtils.getDataDouble(dbd, bankIndices[i]);
                }
View Full Code Here

Examples of java.awt.image.DataBuffer

            theObject = null;
            return;
        }

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

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

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

Examples of java.awt.image.DataBuffer

        }

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