private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild((rect.x + xSub - 1) / xSub, 0, (rect.width + xSub - 1) / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
void writeUncompressed(boolean isTopDown, BufferedImage img, int height, int width) throws IOException { // TODO: Fix if (img.getType() != BufferedImage.TYPE_4BYTE_ABGR) { throw new IIOException("Blows!"); } // Support // - TODO: IndexColorModel (ucompressed, RLE4, RLE8 or BI_PNG) // - TODO: ComponentColorModel (1 channel gray, 3 channel BGR and 4 channel BGRA, uncompressed and RLE8? BI_BITFIELDS? BI_PNG? BI_JPEG?) // - TODO: Packed/DirectColorModel (16 and 32 bit, BI_BITFIELDS, BI_PNG? BI_JPEG?) Raster raster = img.getRaster(); WritableRaster rowRaster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, 1, width * 4, 4, new int[]{2, 1, 0, 3}, null); byte[] row = ((DataBufferByte) rowRaster.getDataBuffer()).getData(); for (int i = 0; i < height; i++) { int line = isTopDown ? i : height - 1 - i; rowRaster.setDataElements(0, 0, raster.createChild(0, line, width, 1, 0, 0, new int[]{2, 1, 0, 3})); imageOutput.write(row); if (abortRequested()) { processWriteAborted(); break; } processImageProgress(100f * i / (float) height); } } }
rowRaster.setDataElements(0, 0, raster.createChild(0, y, raster.getWidth(), 1, 0, 0, null)); imageOutput.write(((DataBufferByte) buffer).getData()); break; case DataBuffer.TYPE_USHORT: rowRaster.setDataElements(0, 0, raster.createChild(0, y, raster.getWidth(), 1, 0, 0, null)); short[] shorts = ((DataBufferUShort) buffer).getData(); imageOutput.writeShorts(shorts, 0, shorts.length);
rowRaster.setDataElements(0, 0, tile.createChild(0, y - offsetY, tile.getWidth(), 1, 0, 0, null));
: raster; Raster srcChannel = banded ? tileRowRaster.createChild(tileRowRaster.getMinX(), 0, tileRowRaster.getWidth(), 1, 0, 0, new int[] {band}) : tileRowRaster; : raster; Raster srcChannel = banded ? tileRowRaster.createChild(tileRowRaster.getMinX(), 0, tileRowRaster.getWidth(), 1, 0, 0, new int[] {band}) : tileRowRaster; : raster; Raster srcChannel = banded ? tileRowRaster.createChild(tileRowRaster.getMinX(), 0, tileRowRaster.getWidth(), 1, 0, 0, new int[] {band}) : tileRowRaster; : raster; Raster srcChannel = banded ? tileRowRaster.createChild(tileRowRaster.getMinX(), 0, tileRowRaster.getWidth(), 1, 0, 0, new int[] {band}) : tileRowRaster;
final Raster sourceR = src.getTile(minTileX, minTileY); rasterOp.filter( sourceR.createChild( src.getMinX(), src.getMinY(),
Raster srcChannel = clippedRow.createChild(clippedRow.getMinX(), 0, clippedRow.getWidth(), 1, 0, 0, new int[] {c});
for (int c = 0; c < header.getChannels(); c++) { WritableRaster destChannel = destRaster.createWritableChild(destRaster.getMinX(), destRaster.getMinY(), destRaster.getWidth(), destRaster.getHeight(), 0, 0, new int[] {c}); Raster srcChannel = clippedRow.createChild(clippedRow.getMinX(), 0, clippedRow.getWidth(), 1, 0, 0, new int[] {c});
src = same ? dest : src.createChild(cx, cy, cw, ch, 0, 0, null);
src = same ? dest : src.createChild(cx, cy, cw, ch, 0, 0, null);
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands); }
private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) { if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1) && xSub == 1 && bands == null /* TODO: Compare bands with that of raster */) { return raster; } return raster.createChild((rect.x + xSub - 1) / xSub, 0, (rect.width + xSub - 1) / xSub, 1, 0, 0, bands); }
public Raster getData(Rectangle rect) { int xt0 = getXTile(rect.x); int xt1 = getXTile(rect.x+rect.width-1); int yt0 = getYTile(rect.y); int yt1 = getYTile(rect.y+rect.height-1); if ((xt0 == xt1) && (yt0 == yt1)) { Raster r = getTile(xt0, yt0); return r.createChild(rect.x, rect.y, rect.width, rect.height, rect.x, rect.y, null); } // rect crosses tile boundries... return super.getData(rect); }
public Raster getData(Rectangle rect) { int xt0 = getXTile(rect.x); int xt1 = getXTile(rect.x+rect.width-1); int yt0 = getYTile(rect.y); int yt1 = getYTile(rect.y+rect.height-1); if ((xt0 == xt1) && (yt0 == yt1)) { Raster r = getTile(xt0, yt0); return r.createChild(rect.x, rect.y, rect.width, rect.height, rect.x, rect.y, null); } // rect crosses tile boundries... return super.getData(rect); }