/** * @see Scalr#resize(BufferedImage, Method, Mode, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final Method scalingMethod, final Mode resizeMode, final int targetSize, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, scalingMethod, resizeMode, targetSize, ops); } }); }
/** * @see Scalr#resize(BufferedImage, int, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final int targetWidth, final int targetHeight, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, targetWidth, targetHeight, ops); } }); }
private static void crashTest() { Raster src = createSrcRaster(); WritableRaster dst = createDstRaster(); ConvolveOp op = createConvolveOp(ConvolveOp.EDGE_NO_OP); try { op.filter(src, dst); } catch (ImagingOpException e) { /* * The test pair of source and destination rasters * may cause failure of the medialib convolution routine, * so this exception is expected. * * The JVM crash is the only manifestation of this * test failure. */ } System.out.println("Test PASSED."); }
public void doTest(int type) { System.out.println("Test for type " + describeType(type)); BufferedImage src = createTestImage(type); BufferedImage res = null; System.out.println("Testing null destination..."); try { res = op.filter(src, null); } catch (ImagingOpException e) { throw new RuntimeException("Test FAILED!", e); } if (res == null || ((src.getType() != BufferedImage.TYPE_BYTE_INDEXED) && (res.getType() != src.getType()))) { throw new RuntimeException("Test FAILED!"); } System.out.println("Test PASSED."); }
/** * @see Scalr#apply(BufferedImage, BufferedImageOp...) */ public static Future<BufferedImage> apply(final BufferedImage src, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.apply(src, ops); } }); }
/** * @see Scalr#crop(BufferedImage, int, int, BufferedImageOp...) */ public static Future<BufferedImage> crop(final BufferedImage src, final int width, final int height, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.crop(src, width, height, ops); } }); }
/** * @see Scalr#crop(BufferedImage, int, int, int, int, BufferedImageOp...) */ public static Future<BufferedImage> crop(final BufferedImage src, final int x, final int y, final int width, final int height, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.crop(src, x, y, width, height, ops); } }); }
/** * @see Scalr#pad(BufferedImage, int, BufferedImageOp...) */ public static Future<BufferedImage> pad(final BufferedImage src, final int padding, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.pad(src, padding, ops); } }); }
/** * @see Scalr#pad(BufferedImage, int, Color, BufferedImageOp...) */ public static Future<BufferedImage> pad(final BufferedImage src, final int padding, final Color color, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.pad(src, padding, color, ops); } }); }
/** * @see Scalr#resize(BufferedImage, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final int targetSize, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, targetSize, ops); } }); }
/** * @see Scalr#resize(BufferedImage, Method, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final Method scalingMethod, final int targetSize, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, scalingMethod, targetSize, ops); } }); }
/** * @see Scalr#resize(BufferedImage, Mode, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final Mode resizeMode, final int targetSize, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, resizeMode, targetSize, ops); } }); }
/** * @see Scalr#resize(BufferedImage, Mode, int, int, BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final Mode resizeMode, final int targetWidth, final int targetHeight, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, resizeMode, targetWidth, targetHeight, ops); } }); }
/** * @see Scalr#resize(BufferedImage, Method, Mode, int, int, * BufferedImageOp...) */ public static Future<BufferedImage> resize(final BufferedImage src, final Method scalingMethod, final Mode resizeMode, final int targetWidth, final int targetHeight, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.resize(src, scalingMethod, resizeMode, targetWidth, targetHeight, ops); } }); }
/** * @see Scalr#rotate(BufferedImage, Rotation, BufferedImageOp...) */ public static Future<BufferedImage> rotate(final BufferedImage src, final Rotation rotation, final BufferedImageOp... ops) throws IllegalArgumentException, ImagingOpException { checkService(); return service.submit(new Callable<BufferedImage>() { public BufferedImage call() throws Exception { return Scalr.rotate(src, rotation, ops); } }); }
public static void main(String[] args) { BufferedImageOp op = createTestOp(); try { System.out.print("Integer-based images... "); doTest(op, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE); System.out.println("done."); System.out.print("Byte-based images... "); doTest(op, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE); System.out.println("done"); } catch (ImagingOpException e) { throw new RuntimeException("Test FAILED", e); } }