public void runTest(Object ctx, int numReps) { ImageOpTests.Context ictx = (ImageOpTests.Context)ctx; RasterOp op = ictx.rasterOp; Raster src = ictx.rasSrc; WritableRaster dst = ictx.rasDst; if (ictx.touchSrc) { Graphics gSrc = ictx.bufSrc.getGraphics(); do { gSrc.fillRect(0, 0, 1, 1); op.filter(src, dst); } while (--numReps > 0); } else { do { op.filter(src, dst); } while (--numReps > 0); } }
public static void main(String[] args) { byte[][] data = new byte[1][10]; ByteLookupTable lut = new ByteLookupTable(0, data); RasterOp op = new LookupOp(lut, null); int[] bandOffsets = {0}; Point location = new Point(0, 0); DataBuffer db = new DataBufferByte(10 * 10); SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, 10, 10, 1, 10, bandOffsets); Raster src = Raster.createRaster(sm, db, location); op.filter(src, null); // this used to result in NullPointerException }
public static WritableRaster filter(RasterOp op, Raster src, WritableRaster dst) { if (useLib == false) { return null; } // Create the destination tile if (dst == null) { dst = op.createCompatibleDestRaster(src); } WritableRaster retRaster = null; switch (getNativeOpIndex(op.getClass())) { case LOOKUP_OP: // REMIND: Fix this! LookupTable table = ((LookupOp)op).getTable(); if (table.getOffset() != 0) { // Right now the native code doesn't support offsets return null; } if (table instanceof ByteLookupTable) { ByteLookupTable bt = (ByteLookupTable) table; if (lookupByteRaster(src, dst, bt.getTable()) > 0) { retRaster = dst; } } break; case AFFINE_OP: AffineTransformOp bOp = (AffineTransformOp) op; double[] matrix = new double[6]; bOp.getTransform().getMatrix(matrix); if (transformRaster(src, dst, matrix, bOp.getInterpolationType()) > 0) { retRaster = dst; } break; case CONVOLVE_OP: ConvolveOp cOp = (ConvolveOp) op; if (convolveRaster(src, dst, cOp.getKernel(), cOp.getEdgeCondition()) > 0) { retRaster = dst; } break; default: break; } if (retRaster != null) { SunWritableRaster.markDirty(retRaster); } return retRaster; }
public static WritableRaster filter(RasterOp op, Raster src, WritableRaster dst) { return null; }