java.awt.image.BufferedImageOp Java Examples
The following examples show how to use
java.awt.image.BufferedImageOp.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawImage.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void transformImage(SunGraphics2D sg, BufferedImage img, BufferedImageOp op, int x, int y) { if (op != null) { if (op instanceof AffineTransformOp) { AffineTransformOp atop = (AffineTransformOp) op; transformImage(sg, img, x, y, atop.getTransform(), atop.getInterpolationType()); return; } else { img = op.filter(img, null); } } copyImage(sg, img, x, y, null); }
Example #2
Source File: DrawImage.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void transformImage(SunGraphics2D sg, BufferedImage img, BufferedImageOp op, int x, int y) { if (op != null) { if (op instanceof AffineTransformOp) { AffineTransformOp atop = (AffineTransformOp) op; transformImage(sg, img, x, y, atop.getTransform(), atop.getInterpolationType()); return; } else { img = op.filter(img, null); } } copyImage(sg, img, x, y, null); }
Example #3
Source File: PathGraphics.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Draws a BufferedImage that is filtered with a BufferedImageOp. * The rendering attributes applied include the clip, transform * and composite attributes. This is equivalent to: * <pre> * img1 = op.filter(img, null); * drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null); * </pre> * @param op The filter to be applied to the image before drawing. * @param img The BufferedImage to be drawn. * This method does nothing if <code>img</code> is null. * @param x,y The location in user space where the image should be drawn. * @see #transform * @see #setTransform * @see #setComposite * @see #clip * @see #setClip */ public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) { if (img == null) { return; } int srcWidth = img.getWidth(null); int srcHeight = img.getHeight(null); if (op != null) { img = op.filter(img, null); } if (srcWidth <= 0 || srcHeight <= 0) { return; } else { AffineTransform xform = new AffineTransform(1f,0f,0f,1f,x,y); drawImageToPlatform(img, xform, null, 0, 0, srcWidth, srcHeight, false); } }
Example #4
Source File: OGLDrawImage.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void transformImage(SunGraphics2D sg, BufferedImage img, BufferedImageOp op, int x, int y) { if (op != null) { if (op instanceof AffineTransformOp) { AffineTransformOp atop = (AffineTransformOp) op; transformImage(sg, img, x, y, atop.getTransform(), atop.getInterpolationType()); return; } else { if (OGLBufImgOps.renderImageWithOp(sg, img, op, x, y)) { return; } } img = op.filter(img, null); } copyImage(sg, img, x, y, null); }
Example #5
Source File: ImageTests.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void runTest(Object ctx, int numReps) { ImageOpTests.Context ictx = (ImageOpTests.Context)ctx; BufferedImageOp op = ictx.bufImgOp; BufferedImage src = ictx.bufSrc; BufferedImage dst = ictx.bufDst; if (ictx.touchSrc) { Graphics gSrc = src.getGraphics(); do { gSrc.fillRect(0, 0, 1, 1); op.filter(src, dst); } while (--numReps > 0); } else { do { op.filter(src, dst); } while (--numReps > 0); } }
Example #6
Source File: ImageTests.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void runTest(Object ctx, int numReps) { ImageOpTests.Context ictx = (ImageOpTests.Context)ctx; BufferedImageOp op = ictx.bufImgOp; BufferedImage src = ictx.bufSrc; BufferedImage dst = ictx.bufDst; if (ictx.touchSrc) { Graphics gSrc = src.getGraphics(); do { gSrc.fillRect(0, 0, 1, 1); op.filter(src, dst); } while (--numReps > 0); } else { do { op.filter(src, dst); } while (--numReps > 0); } }
Example #7
Source File: MlibOpsTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void doTest(BufferedImageOp op) { BufferedImage src = createSrcImage(); BufferedImage dst = createImage(); BufferedImage ret = null; try { ret = ImagingLib.filter(op, src, dst); } catch (Exception e) { throw new RuntimeException("Test FAILED.", e); } if (ret == null) { throw new RuntimeException("Test FAILED: null output"); } System.out.println("ret: " + ret); System.out.println("Test PASSED for " + op.getClass().getName()); }
Example #8
Source File: OGLDrawImage.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void transformImage(SunGraphics2D sg, BufferedImage img, BufferedImageOp op, int x, int y) { if (op != null) { if (op instanceof AffineTransformOp) { AffineTransformOp atop = (AffineTransformOp) op; transformImage(sg, img, x, y, atop.getTransform(), atop.getInterpolationType()); return; } else { if (OGLBufImgOps.renderImageWithOp(sg, img, op, x, y)) { return; } } img = op.filter(img, null); } copyImage(sg, img, x, y, null); }
Example #9
Source File: SunGraphics2D.java From hottub with GNU General Public License v2.0 | 6 votes |
public void drawImage(BufferedImage bImg, BufferedImageOp op, int x, int y) { if (bImg == null) { return; } try { imagepipe.transformImage(this, bImg, op, x, y); } catch (InvalidPipeException e) { try { revalidateAll(); imagepipe.transformImage(this, bImg, op, x, y); } catch (InvalidPipeException e2) { // Still catching the exception; we are not yet ready to // validate the surfaceData correctly. Fail for now and // try again next time around. } } finally { surfaceData.markDirty(); } }
Example #10
Source File: PathGraphics.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Draws a BufferedImage that is filtered with a BufferedImageOp. * The rendering attributes applied include the clip, transform * and composite attributes. This is equivalent to: * <pre> * img1 = op.filter(img, null); * drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null); * </pre> * @param op The filter to be applied to the image before drawing. * @param img The BufferedImage to be drawn. * This method does nothing if <code>img</code> is null. * @param x,y The location in user space where the image should be drawn. * @see #transform * @see #setTransform * @see #setComposite * @see #clip * @see #setClip */ public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) { if (img == null) { return; } int srcWidth = img.getWidth(null); int srcHeight = img.getHeight(null); if (op != null) { img = op.filter(img, null); } if (srcWidth <= 0 || srcHeight <= 0) { return; } else { AffineTransform xform = new AffineTransform(1f,0f,0f,1f,x,y); drawImageToPlatform(img, xform, null, 0, 0, srcWidth, srcHeight, false); } }
Example #11
Source File: ImageLoader.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static Image scaleImage(Image image, double scale) { if (scale == 1.0) return image; if (image instanceof JBHiDPIScaledImage) { return ((JBHiDPIScaledImage)image).scale(scale); } int w = image.getWidth(null); int h = image.getHeight(null); if (w <= 0 || h <= 0) { return image; } int width = (int)Math.round(scale * w); int height = (int)Math.round(scale * h); // Using "QUALITY" instead of "ULTRA_QUALITY" results in images that are less blurry // because ultra quality performs a few more passes when scaling, which introduces blurriness // when the scaling factor is relatively small (i.e. <= 3.0f) -- which is the case here. return Scalr.resize(ImageUtil.toBufferedImage(image), Scalr.Method.QUALITY, Scalr.Mode.FIT_EXACT, width, height, (BufferedImageOp[])null); }
Example #12
Source File: ImageTests.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void runTest(Object ctx, int numReps) { ImageOpTests.Context ictx = (ImageOpTests.Context)ctx; BufferedImageOp op = ictx.bufImgOp; BufferedImage src = ictx.bufSrc; BufferedImage dst = ictx.bufDst; if (ictx.touchSrc) { Graphics gSrc = src.getGraphics(); do { gSrc.fillRect(0, 0, 1, 1); op.filter(src, dst); } while (--numReps > 0); } else { do { op.filter(src, dst); } while (--numReps > 0); } }
Example #13
Source File: MlibOpsTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void doTest(BufferedImageOp op) { BufferedImage src = createSrcImage(); BufferedImage dst = createImage(); BufferedImage ret = null; try { ret = ImagingLib.filter(op, src, dst); } catch (Exception e) { throw new RuntimeException("Test FAILED.", e); } if (ret == null) { throw new RuntimeException("Test FAILED: null output"); } System.out.println("ret: " + ret); System.out.println("Test PASSED for " + op.getClass().getName()); }
Example #14
Source File: MlibOpsTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void doTest(BufferedImageOp op) { BufferedImage src = createSrcImage(); BufferedImage dst = createImage(); BufferedImage ret = null; try { ret = ImagingLib.filter(op, src, dst); } catch (Exception e) { throw new RuntimeException("Test FAILED.", e); } if (ret == null) { throw new RuntimeException("Test FAILED: null output"); } System.out.println("ret: " + ret); System.out.println("Test PASSED for " + op.getClass().getName()); }
Example #15
Source File: BufferedBufImgOps.java From Bytecoder with Apache License 2.0 | 5 votes |
public static void disableBufImgOp(RenderQueue rq, BufferedImageOp biop) { if (biop instanceof ConvolveOp) { disableConvolveOp(rq); } else if (biop instanceof RescaleOp) { disableRescaleOp(rq); } else if (biop instanceof LookupOp) { disableLookupOp(rq); } else { throw new InternalError("Unknown BufferedImageOp"); } }
Example #16
Source File: MlibOpsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { System.out.println("AffineTransformOp:"); BufferedImageOp op = getAffineTransformOp(); doTest(op); System.out.println("ConvolveOp:"); op = getConvolveOp(); doTest(op); System.out.println("LookupOp:"); op = getLookupOp(); doTest(op); }
Example #17
Source File: BufferedBufImgOps.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void disableBufImgOp(RenderQueue rq, BufferedImageOp biop) { if (biop instanceof ConvolveOp) { disableConvolveOp(rq); } else if (biop instanceof RescaleOp) { disableRescaleOp(rq); } else if (biop instanceof LookupOp) { disableLookupOp(rq); } else { throw new InternalError("Unknown BufferedImageOp"); } }
Example #18
Source File: AsyncScalr.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @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); } }); }
Example #19
Source File: SamePackingTypeTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static BufferedImageOp createTestOp() { final int size = 1; final float v = 1f / (size * size); final float[] k_data = new float[size * size]; Arrays.fill(k_data, v); Kernel k = new Kernel(size, size, k_data); return new ConvolveOp(k); }
Example #20
Source File: SamePackingTypeTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example #21
Source File: SamePackingTypeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static BufferedImageOp createTestOp() { final int size = 1; final float v = 1f / (size * size); final float[] k_data = new float[size * size]; Arrays.fill(k_data, v); Kernel k = new Kernel(size, size, k_data); return new ConvolveOp(k); }
Example #22
Source File: PdfGraphics2D.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int) */ @Override public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) { BufferedImage result = img; if (op != null) { result = op.createCompatibleDestImage(img, img.getColorModel()); result = op.filter(img, result); } drawImage(result, x, y, null); }
Example #23
Source File: AsyncScalr.java From icafe with Eclipse Public License 1.0 | 5 votes |
/** * @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); } }); }
Example #24
Source File: AsyncScalr.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @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); } }); }
Example #25
Source File: BufferedBufImgOps.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void disableBufImgOp(RenderQueue rq, BufferedImageOp biop) { if (biop instanceof ConvolveOp) { disableConvolveOp(rq); } else if (biop instanceof RescaleOp) { disableRescaleOp(rq); } else if (biop instanceof LookupOp) { disableLookupOp(rq); } else { throw new InternalError("Unknown BufferedImageOp"); } }
Example #26
Source File: MlibOpsTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static BufferedImageOp getLookupOp() { byte[] inv = new byte[256]; for (int i = 0; i < 256; i++) { inv[i] = (byte)(255 - i); } ByteLookupTable table = new ByteLookupTable(0, inv); return new LookupOp(table, null); }
Example #27
Source File: BufferedBufImgOps.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void enableBufImgOp(RenderQueue rq, SurfaceData srcData, BufferedImage srcImg, BufferedImageOp biop) { if (biop instanceof ConvolveOp) { enableConvolveOp(rq, srcData, (ConvolveOp)biop); } else if (biop instanceof RescaleOp) { enableRescaleOp(rq, srcData, srcImg, (RescaleOp)biop); } else if (biop instanceof LookupOp) { enableLookupOp(rq, srcData, srcImg, (LookupOp)biop); } else { throw new InternalError("Unknown BufferedImageOp"); } }
Example #28
Source File: TestFilterPerformance.java From Pixelitor with GNU General Public License v3.0 | 5 votes |
private static BufferedImageOp getFilter() { var f = new KaleidoscopeFilter("Kaleidoscope Test"); f.setZoom(1.0f); f.setProgressTracker(ProgressTracker.NULL_TRACKER); return f; }
Example #29
Source File: Levels.java From Pixelitor with GNU General Public License v3.0 | 5 votes |
@Override public BufferedImage transform(BufferedImage src, BufferedImage dest) { if (rgbLookup == null) { throw new IllegalStateException("rgbLookup not initialized"); } BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) rgbLookup.getLookupOp()); filterOp.filter(src, dest); return dest; }
Example #30
Source File: AsyncScalr.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @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); } }); }