int type = sampleModel.getTransferType(); long numBanks = 0; long size = 0;
@Override public boolean isCompatibleSampleModel(SampleModel sm) { if (!(sm instanceof ComponentSampleModel)) { return false; } // Must have the same number of components return numComponents == sm.getNumBands() && transferType == sm.getTransferType(); }
/** Checks if the specified {@code SampleModel} is compatible with this {@code ColorModel}. */ public boolean isCompatibleSampleModel(final SampleModel sm) { return (sm instanceof ComponentSampleModel) && sm.getTransferType() == transferType && sm.getNumBands() == numBands && (1 << sm.getSampleSize(visibleBand)) >= getMapSize(); } }
private WritableRaster buildSolidRaster(int tileWidth, int tileHeight, int value) { SampleModel sampleModel = getMPSampleModel(tileWidth, tileHeight); // build the raster WritableRaster newRaster = RasterFactory.createWritableRaster(sampleModel, new java.awt.Point(0, 0)); // sanity checks int dataType = sampleModel.getTransferType(); int numBands = sampleModel.getNumBands(); if (dataType != DataBuffer.TYPE_BYTE) { throw new IllegalArgumentException( "The code works only if the sample model data type is BYTE"); } if (numBands != 1) { throw new IllegalArgumentException("The code works only for single band rasters!"); } if (value != 0) { // flood fill int w = sampleModel.getWidth(); int h = sampleModel.getHeight(); int[] data = new int[w * h]; Arrays.fill(data, value); newRaster.setSamples(0, 0, w, h, 0, data); } return newRaster; }
if (specifier.getSampleModel().getTransferType() == dest.getSampleModel().getTransferType() && specifier.getNumBands() <= dest.getSampleModel().getNumBands()) { found = true;
protected final int getTransferType(final IIOImage image) { return image.hasRaster() ? image.getRaster().getTransferType() : image.getRenderedImage().getSampleModel().getTransferType(); }
int type = sampleModel.getTransferType(); long numBanks = 0; long size = 0;
.createBufferedImage(renderedImage.getWidth(), 1) .getRaster() : renderedImage.getSampleModel().getTransferType() == DataBuffer.TYPE_INT ? ImageTypeSpecifiers.createInterleaved(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]{2, 1, 0}, DataBuffer.TYPE_BYTE, false, false) .createBufferedImage(renderedImage.getWidth(), 1)
private void writeImageData(final IIOImage image) throws IOException { // - dump data as is (or convert, if TYPE_INT_xxx) // Enforce RGB/CMYK order for such data! // TODO: Loop over x/y tiles, using 0,0 is only valid for BufferedImage // TODO: PNM/PAM does not support tiling, we must iterate all tiles along the x-axis for each row we write Raster tile = image.hasRaster() ? image.getRaster() : image.getRenderedImage().getTile(0, 0); SampleModel sampleModel = tile.getSampleModel(); DataBuffer dataBuffer = tile.getDataBuffer(); int tileWidth = tile.getWidth(); int tileHeight = tile.getHeight(); final int transferType = sampleModel.getTransferType(); Object data = null; for (int y = 0; y < tileHeight; y++) { data = sampleModel.getDataElements(0, y, tileWidth, 1, data, dataBuffer); // TODO: Support other (short, float) data types if (transferType == DataBuffer.TYPE_BYTE) { imageOutput.write((byte[]) data); } else if (transferType == DataBuffer.TYPE_USHORT) { short[] shortData = (short[]) data; imageOutput.writeShorts(shortData, 0, shortData.length); } processImageProgress(y * 100f / tileHeight); // TODO: Take tile y into account if (abortRequested()) { processWriteAborted(); break; } } }
@Override public boolean isCompatibleSampleModel(SampleModel sm) { return sm.getTransferType() == transferType && sm.getNumBands() == 1; }
(cm instanceof DirectColorModel) ? DataBuffer.TYPE_BYTE : image.getSampleModel().getTransferType(); final RenderingHints hints = getRenderingHints(type); ParameterBlock pb = new ParameterBlock();
@Override public boolean isCompatibleSampleModel(SampleModel sm) { return sm.getTransferType() == transferType && sm.getNumBands() == 1; }
@Override public boolean isCompatibleSampleModel(SampleModel sm) { return ((sm instanceof ComponentSampleModel) && (numbands == sm.getNumBands()) && (sm.getTransferType() == transferType)); }
assertEquals(expectedModel.getNumDataElements(), resultModel.getNumDataElements()); assertTrue(Arrays.equals(expectedModel.getSampleSize(), resultModel.getSampleSize())); assertEquals(expectedModel.getTransferType(), resultModel.getTransferType()); for (int i = 0; i < expectedModel.getNumBands(); i++) { assertEquals(expectedModel.getSampleSize(i), resultModel.getSampleSize(i));
&& (image.getSampleModel().getTransferType() != DataBuffer.TYPE_BYTE)) { worker.forceComponentColorModel(); image = worker.getRenderedImage();
CachedTileImpl(TileId tileId, Raster tile, Object tileCacheMetric) { this.tileId = tileId; this.file = new File(cacheDir, getImageId(tileId.owner.get()) + "-" + tileId.tileX + "-" + tileId.tileY); this.tileCacheMetric = tileCacheMetric; this.sampleModel = tile.getSampleModel(); this.tileSize = sampleModel.getNumDataElements() * DataBuffer.getDataTypeSize(sampleModel.getTransferType()); this.location = tile.getBounds().getLocation(); this.writable = tile instanceof WritableRaster; this.tileTimeStamp = System.currentTimeMillis(); }
/** * Checks if the specified {@code SampleModel} is compatible * with this {@code ColorModel}. */ public boolean isCompatibleSampleModel(final SampleModel sm) { return (sm instanceof ComponentSampleModel) && sm.getTransferType() == transferType && sm.getNumBands() == numBands && (1 << sm.getSampleSize(visibleBand)) >= getMapSize(); } }
/** * Checks if the specified {@code SampleModel} is compatible * with this {@code ColorModel}. */ public boolean isCompatibleSampleModel(final SampleModel sm) { return (sm instanceof ComponentSampleModel) && sm.getTransferType() == transferType && sm.getNumBands() == numBands && (1 << sm.getSampleSize(visibleBand)) >= getMapSize(); } }
/** * Checks if the specified {@code SampleModel} is compatible with this {@code ColorModel}. * This method performs the same checks than the standard implementation except for the number * of bands and for not accepting {@code MultiPixelPackedSampleModel}. */ @Override public boolean isCompatibleSampleModel(final SampleModel sm) { return (sm instanceof ComponentSampleModel) && sm.getTransferType() == transferType && sm.getNumBands() == numBands && (1 << sm.getSampleSize(visibleBand)) >= getMapSize(); } }
switch (sourceImage.getSampleModel().getTransferType()) { case DataBuffer.TYPE_DOUBLE: case DataBuffer.TYPE_FLOAT: