WritableRaster raster = img.getRaster(); int[] pixel; // fix from Patti Spala Nov-27-2014 if (raster.getNumBands() > 3) { pixel = new int[raster.getNumBands()]; } else { pixel = new int[3];
WritableRaster raster = img.getRaster(); int[] pixel; // fix from Patti Spala Nov-27-2014 if (raster.getNumBands() > 3) { pixel = new int[raster.getNumBands()]; } else { pixel = new int[3];
WritableRaster rowRaster = singleBandRowSpec.createBufferedImage(header.width, 1).getRaster(); boolean banded = destRaster.getDataBuffer().getNumBanks() > 1; int interleavedBands = banded ? 1 : destRaster.getNumBands(); decomposeAlpha(destCM, destRaster.getDataBuffer(), pDest.width, pDest.height, destRaster.getNumBands());
final int interleavedBands = banded ? 1 : raster.getNumBands(); int c = channelInfo.channelId == -1 ? rowRaster.getNumBands() - 1 : channelInfo.channelId;
final WritableRaster raster1 = image1.getRaster(); final WritableRaster raster2 = image2.getRaster(); final int numBands = raster1.getNumBands(); if (raster2.getNumBands() != numBands) { return false;
int bpc = image.getColorModel().getPixelSize() / image.getRaster().getNumBands(); parameters.setInt(COSName.BITS_PER_COMPONENT, bpc); image.getRaster().getNumBands() == 1 && image.getColorModel() instanceof IndexColorModel)
? param.getDestinationBands() : null); checkReadParamBandSettings(param, rawType.getNumBands(), destRaster.getNumBands());
double[] bkg = setBackground ? backgroundValues : new double[dest.getNumBands()]; ImageUtil.fillBackground(dest, destRect, bkg); return;
checkReadParamBandSettings(param, rawType.getNumBands(), destRaster.getNumBands());
checkReadParamBandSettings(param, rawType.getNumBands(), destRaster.getNumBands());
checkReadParamBandSettings(param, rawType.getNumBands(), destRaster.getNumBands());
if (rowRaster.getNumBands() != 3) { throw new IIOException("TIFF PhotometricInterpretation YCbCr requires SamplesPerPixel == 3: " + rowRaster.getNumBands()); createJFIFStream(destRaster.getNumBands(), stripTileWidth, stripTileHeight, qTables, dcTables, acTables, subsampling), createStreamAdapter(imageInput, length), new ByteArrayInputStream(new byte[] {(byte) 0xff, (byte) 0xd9}) // EOI
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnegative @Override public int getBandCount() { return getBufferedImage().getRaster().getNumBands(); }
checkReadParamBandSettings(param, rawType.getNumBands(), destRaster.getNumBands());
@Override public int get(int x, int y) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return 0; //return ((BufferedImage) image).getRGB(x, y); // WritableRaster raster = ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); WritableRaster raster = getRaster(); raster.getDataElements(x, y, getset); if (raster.getNumBands() == 3) { // https://github.com/processing/processing/issues/2030 return getset[0] | 0xff000000; } return getset[0]; }
/** Extracts pixel data as arrays of signed integers, one per channel. */ public static int[][] getInts(WritableRaster r, int x, int y, int w, int h) { if (canUseBankDataDirectly(r, DataBuffer.TYPE_INT, DataBufferInt.class) && x == 0 && y == 0 && w == r.getWidth() && h == r.getHeight()) { return ((DataBufferInt) r.getDataBuffer()).getBankData(); } // NB: an order of magnitude faster than the naive makeType solution int c = r.getNumBands(); int[][] samples = new int[c][w * h]; for (int i=0; i<c; i++) r.getSamples(x, y, w, h, i, samples[i]); return samples; }
/** Extracts pixel data as arrays of signed integers, one per channel. */ public static int[][] getInts(WritableRaster r, int x, int y, int w, int h) { if (canUseBankDataDirectly(r, DataBuffer.TYPE_INT, DataBufferInt.class) && x == 0 && y == 0 && w == r.getWidth() && h == r.getHeight()) { return ((DataBufferInt) r.getDataBuffer()).getBankData(); } // NB: an order of magnitude faster than the naive makeType solution int c = r.getNumBands(); int[][] samples = new int[c][w * h]; for (int i=0; i<c; i++) r.getSamples(x, y, w, h, i, samples[i]); return samples; }
/** Extracts pixel data as arrays of signed integers, one per channel. */ public static int[][] getInts(WritableRaster r, int x, int y, int w, int h) { if (canUseBankDataDirectly(r, DataBuffer.TYPE_INT, DataBufferInt.class) && x == 0 && y == 0 && w == r.getWidth() && h == r.getHeight()) { return ((DataBufferInt) r.getDataBuffer()).getBankData(); } // NB: an order of magnitude faster than the naive makeType solution int c = r.getNumBands(); int[][] samples = new int[c][w * h]; for (int i=0; i<c; i++) r.getSamples(x, y, w, h, i, samples[i]); return samples; }
@Override public void populateImageMetadata() { final BufferedImage img = AWTImageTools.makeBuffered(image); final ImageMetadata iMeta = get(0); iMeta.setAxisTypes(Axes.X, Axes.Y, Axes.CHANNEL, Axes.TIME); iMeta.setAxisLength(Axes.X, img.getWidth()); iMeta.setAxisLength(Axes.Y, img.getHeight()); iMeta.setAxisLength(Axes.CHANNEL, img.getRaster().getNumBands()); iMeta.setAxisLength(Axes.TIME, iMeta.getPlaneCount()); iMeta.setPixelType(AWTImageTools.getPixelType(img)); iMeta.setLittleEndian(false); iMeta.setIndexed(false); iMeta.setFalseColor(false); }
public WritableRaster copyData(WritableRaster wr) { // new Exception("FilterAlphaRed: ").printStackTrace(); // Get my source. CachableRed srcRed = (CachableRed)getSources().get(0); SampleModel sm = srcRed.getSampleModel(); if (sm.getNumBands() == 1) // Already one band of data so we just use it... return srcRed.copyData(wr); PadRed.ZeroRecter.zeroRect(wr); Raster srcRas = srcRed.getData(wr.getBounds()); AbstractRed.copyBand(srcRas, srcRas.getNumBands()-1, wr, wr.getNumBands()-1); return wr; }