Package java.awt.image

Examples of java.awt.image.BandedSampleModel


                                                        hasAlpha,
                                                        isAlphaPremultiplied,
                                                        transparency,
                                                        dataType);
       
        SampleModel sampleModel = new BandedSampleModel(dataType,
                                                        1,
                                                        1,
                                                        1,
                                                        bankIndices,
                                                        bandOffsets);
View Full Code Here


/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public static TiledImage createBanded(int minX, int minY, int width, int height, int dataType, int tileWidth, int tileHeight, int[] bankIndices, int[] bandOffsets)
/*      */   {
/*  443 */     SampleModel sm = new BandedSampleModel(dataType, tileWidth, tileHeight, tileWidth, bankIndices, bandOffsets);
/*      */
/*  449 */     return new TiledImage(minX, minY, width, height, minX, minY, sm, PlanarImage.createColorModel(sm));
/*      */   }
View Full Code Here

                        false, // isAlphaPremultiplied,
                        Transparency.OPAQUE,
                        dataType);

        SampleModel sm = banded
                ? new BandedSampleModel(dataType, cols, rows, samples)
                : new PixelInterleavedSampleModel(dataType, cols, rows,
                        samples, cols * samples, bandOffsets());
        WritableRaster raster = Raster.createWritableRaster(sm, null);
        return new BufferedImage(cm, raster, false, null);
    }
View Full Code Here

        bytes[i] = new byte[pixels];
        bands[i].get(bytes[i]);
      }
      imgBuffer = new DataBufferByte(bytes, pixels);
      buffer_type = DataBuffer.TYPE_BYTE;
      sampleModel = new BandedSampleModel(buffer_type,
          xsize, ysize, xsize, banks, offsets);
      data_type = (poBand.GetRasterColorInterpretation() ==
        gdalconstConstants.GCI_PaletteIndex)?
        BufferedImage.TYPE_BYTE_INDEXED : BufferedImage.TYPE_BYTE_GRAY;
    } else if(buf_type == gdalconstConstants.GDT_Int16) {
      short[][] shorts = new short[bandCount][];
      for(int i = 0; i < bandCount; i++) {       
        shorts[i] = new short[pixels];
        bands[i].asShortBuffer().get(shorts[i]);
      }
      imgBuffer = new DataBufferShort(shorts, pixels);
      buffer_type = DataBuffer.TYPE_USHORT;
      sampleModel = new BandedSampleModel(buffer_type,
          xsize, ysize, xsize, banks, offsets);
      data_type = BufferedImage.TYPE_USHORT_GRAY;
    } else if(buf_type == gdalconstConstants.GDT_Int32) {
      int[][] ints = new int[bandCount][];
      for(int i = 0; i < bandCount; i++) {       
        ints[i] = new int[pixels];
        bands[i].asIntBuffer().get(ints[i]);
      }
      imgBuffer = new DataBufferInt(ints, pixels);
      buffer_type = DataBuffer.TYPE_INT;
      sampleModel = new BandedSampleModel(buffer_type,
          xsize, ysize, xsize, banks, offsets);
      data_type = BufferedImage.TYPE_CUSTOM;
    }

    WritableRaster raster = Raster.createWritableRaster(sampleModel, imgBuffer, null);
View Full Code Here

                // int bandOffset = (tileWidth * tileHeight * pixelType.getBitsPerSample()) / 8;
                for (int i = 0; i < numberOfBands; i++) {
                    bankIndices[i] = i;
                    bandOffsets[i] = 0;// (i * bandOffset);
                }
                sampleModel = new BandedSampleModel(dataType, sampleImageWidth, sampleImageHeight,
                        sampleImageWidth, bankIndices, bandOffsets);
            }
            its = new ImageTypeSpecifier(colorModel, sampleModel);
        }

View Full Code Here

        /*
         * Do not use colorModel.createCompatibleSampleModel cause it creates a
         * PixelInterleavedSampleModel and we need a BandedSampleModel so it matches how the data
         * comes out of ArcSDE
         */
        SampleModel sampleModel = new BandedSampleModel(dataType, sampleImageWidth,
                sampleImageHeight, 4);

        its = new ImageTypeSpecifier(colorModel, sampleModel);
        return its;
    }
View Full Code Here

        int transparency = Transparency.OPAQUE;
        int transferType = dataType;
        ColorModel colorModel = new ComponentColorModel(colorSpace, new int[] { 8, 8, 8 },
                hasAlpha, isAlphaPremultiplied, transparency, transferType);

        SampleModel sampleModel = new BandedSampleModel(dataType, sampleImageWidth,
                sampleImageHeight, 3);

        its = new ImageTypeSpecifier(colorModel, sampleModel);
        return its;
    }
View Full Code Here

        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            GridEnvelope2D gridRange = spatialDomain.getGridGeometry().getGridRange2D();
            RasterLayout rasterElement = spatialDomain.getRasterElements(false, null).iterator().next();
            SampleModel sampleModel = new BandedSampleModel(DataBuffer.TYPE_DOUBLE, (int)gridRange.getWidth(), (int)gridRange.getHeight(), 1);
            ColorModel colorModel = ImageIOUtilities.createColorModel(sampleModel);
            Rectangle rect = rasterElement.toRectangle();
            ImageLayout layout = new ImageLayout(rect.x, rect.y, rect.width, rect.height);
            layout.setSampleModel(sampleModel);
            layout.setColorModel(colorModel);
View Full Code Here

        assertEquals(rasterLayout.getTileGridXOffset(), 0);
        assertEquals(rasterLayout.getTileGridYOffset(), 0);
        assertEquals(rasterLayout.getTileWidth(), 0);
        assertEquals(rasterLayout.getTileHeight(), 0);
       
        SampleModel sm = new BandedSampleModel(DataBuffer.TYPE_BYTE, 50, 50, 3);
        ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        TiledImage ri = new TiledImage(10, 10, 50, 50, 5, 5, sm, cm);
       
        RasterLayout rasterLayoutToBeCloned = new RasterLayout(ri);
        RasterLayout rasterLayout3 = new RasterLayout(ri);
View Full Code Here

        width = variableDS.getDimension(rank - NetCDFUtilities.X_DIMENSION).getLength();
        height = variableDS.getDimension(rank - NetCDFUtilities.Y_DIMENSION).getLength();
        numBands = rank > 2 ? variableDS.getDimension(2).getLength() : 1;
       
        final int bufferType = NetCDFUtilities.getRawDataType(variableDS);
        sampleModel = new BandedSampleModel(bufferType, width, height, 1);
       
       
        // range type
        String description = variableDS.getDescription();
        final StringBuilder sb = new StringBuilder();
View Full Code Here

TOP

Related Classes of java.awt.image.BandedSampleModel

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.