Package java.awt.image

Examples of java.awt.image.DataBuffer


    public BufferedImageSurface(BufferedImage image) {
        super(image.getWidth(), image.getHeight());
        this.model = image.getColorModel();
        this.sImage = image;
        final Raster raster = image.getRaster();
        final DataBuffer dataBuffer = raster.getDataBuffer();
        final SampleModel sampleModel = raster.getSampleModel();
        if (sampleModel instanceof SinglePixelPackedSampleModel) {
            final SinglePixelPackedSampleModel sppSM = (SinglePixelPackedSampleModel) sampleModel;
            final int dataType = dataBuffer.getDataType();
            final int dataTypeSize = DataBuffer.getDataTypeSize(dataType);
            this.bitmapGraphics = BitmapGraphics.createInstance(dataBuffer, width, height,
                sppSM.getScanlineStride() * dataTypeSize / 8, model.getTransparency());
        } else {
            this.bitmapGraphics = null;
View Full Code Here


        if (y + recSize > height){
          h = height - y;
        }
        Rectangle r = new Rectangle(x, y, w, h);
        Raster rs = gcRaw.getRenderedImage().getData(r);
        DataBuffer df  = rs.getDataBuffer();
        for (int i = 0; i < df.getSize(); i ++){
          Double v = df.getElemDouble(i);
          if (!ignoreset.contains(v)){
            data.add(v);
          }
        }
      }
View Full Code Here

          h = height - y;
        }
        Rectangle r = new Rectangle(x, y, w, h);
       
        Raster rs = gcRaw.getRenderedImage().getData(r);
        DataBuffer df  = rs.getDataBuffer();
        for (int i = 0; i < df.getSize(); i ++){
          results.add(df.getElemDouble(i));
          if (results.size() >= SingleBandEditorPage.MAX_ENTRIES){
            errorMessage = MessageFormat.format(Messages.UniqueValuesDialog_MaxValueError, SingleBandEditorPage.MAX_ENTRIES);
            maxReached = true;
            break;
          }
View Full Code Here

                graphics.drawImage(image, 0, 0, null);
                graphics.dispose();
                image = packedImage;
            }

            DataBuffer dBuf = image.getData().getDataBuffer();
            if (dBuf.getDataType() == DataBuffer.TYPE_BYTE)
            {
                decoded.write(((DataBufferByte) dBuf).getData());
            }
            else
            {
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    // check simple case
    DataBuffer b1 = new DataBufferInt(new int[] {1, 2, 3}, 3, 1);
    harness.check(b1.getOffset() == 1);

    // check that offset reflects setting in array
    DataBuffer b2 = new DataBufferInt(new int[][] {{1, 2, 3, 4}, {5, 6, 7, 8}}, 2, new int[] {1 , 2});
    harness.check(b2.getOffset() == 1);
  }
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    //
    DataBuffer b1 = new DataBufferInt(new int[] {1, 2, 3}, 3, 1);
    int[] offsets = b1.getOffsets();
    harness.check(offsets.length == 1);
    harness.check(offsets[0] == 1);
  }
View Full Code Here

  }
 
  private void test1(TestHarness harness)
  {
    harness.checkPoint("(int, int, int, double, DataBuffer)")
    DataBuffer db = new DataBufferDouble(12);
    ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE,
            3, 2, 2, 6, new int[] {0, 1});
    m.setSample(2, 1, 0, 99.9, db);
    harness.check(db.getElem(0, 10), 99.0d);
    m.setSample(2, 1, 1, 88.8, db);
    harness.check(db.getElem(0, 11), 88.0d);
   
    // what happens if the data buffer doesn't hold doubles?
    DataBuffer db2 = new DataBufferInt(12);
    m.setSample(2, 1, 0, 99.9d, db2);
    harness.check(db2.getElem(0, 10), 99);
    m.setSample(2, 1, 1, 88.8d, db2);
    harness.check(db2.getElem(0, 11), 88);

    // check that a null data buffer generates a NullPointerException
    boolean pass = false;
    try
      {
View Full Code Here

  public void testMethod1(TestHarness harness)
  {
    harness.checkPoint("(int, int, int, int, int, int[], DataBuffer)");
    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10,
            20, new int[] { 224, 28, 3 });
    DataBuffer db = m.createDataBuffer();
    int[] samples = new int[6];
    m.getSamples(1, 2, 2, 3, 1, samples, db);
    harness.check(Arrays.equals(samples, new int[] {0, 0, 0, 0, 0, 0}));
    m.setSamples(1, 2, 2, 3, 0, new int[] {1, 2, 3, 4 ,5 ,6}, db);
    m.getSamples(1, 2, 2, 3, 0, samples, db);
View Full Code Here

  public void testMethod2(TestHarness harness)
  {
    harness.checkPoint("(int, int, int, int, int, float[], DataBuffer)");    
    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10,
            20, new int[] { 224, 28, 3 });
    DataBuffer db = m.createDataBuffer();
    float[] samples = new float[6];
    m.getSamples(1, 2, 2, 3, 1, samples, db);
    harness.check(Arrays.equals(samples, new float[] {0, 0, 0, 0, 0, 0}));
    m.setSamples(1, 2, 2, 3, 0, new float[] {1, 2, 3, 4 ,5 ,6}, db);
    m.getSamples(1, 2, 2, 3, 0, samples, db);
View Full Code Here

  public void testMethod3(TestHarness harness)
  {
    harness.checkPoint("(int, int, int, int, int, double[], DataBuffer)");    
    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10,
            20, new int[] { 224, 28, 3 });
    DataBuffer db = m.createDataBuffer();
    double[] samples = new double[6];
    m.getSamples(1, 2, 2, 3, 1, samples, db);
    harness.check(Arrays.equals(samples, new double[] {0, 0, 0, 0, 0, 0}));
    m.setSamples(1, 2, 2, 3, 0, new double[] {1, 2, 3, 4 ,5 ,6}, db);
    m.getSamples(1, 2, 2, 3, 0, samples, db);
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.