Search in sources :

Example 1 with RenderContext

use of java.awt.image.renderable.RenderContext in project jdk8u_jdk by JetBrains.

the class SunGraphics2D method drawRenderableImage.

public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
    if (img == null) {
        return;
    }
    AffineTransform pipeTransform = transform;
    AffineTransform concatTransform = new AffineTransform(xform);
    concatTransform.concatenate(pipeTransform);
    AffineTransform reverseTransform;
    RenderContext rc = new RenderContext(concatTransform);
    try {
        reverseTransform = pipeTransform.createInverse();
    } catch (NoninvertibleTransformException nte) {
        rc = new RenderContext(pipeTransform);
        reverseTransform = new AffineTransform();
    }
    RenderedImage rendering = img.createRendering(rc);
    drawRenderedImage(rendering, reverseTransform);
}
Also used : NoninvertibleTransformException(java.awt.geom.NoninvertibleTransformException) RenderContext(java.awt.image.renderable.RenderContext) FontRenderContext(java.awt.font.FontRenderContext) AffineTransform(java.awt.geom.AffineTransform) RenderedImage(java.awt.image.RenderedImage)

Example 2 with RenderContext

use of java.awt.image.renderable.RenderContext in project jdk8u_jdk by JetBrains.

the class ProxyGraphics2D method drawRenderableImage.

public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
    if (img == null) {
        return;
    }
    AffineTransform pipeTransform = getTransform();
    AffineTransform concatTransform = new AffineTransform(xform);
    concatTransform.concatenate(pipeTransform);
    AffineTransform reverseTransform;
    RenderContext rc = new RenderContext(concatTransform);
    try {
        reverseTransform = pipeTransform.createInverse();
    } catch (NoninvertibleTransformException nte) {
        rc = new RenderContext(pipeTransform);
        reverseTransform = new AffineTransform();
    }
    RenderedImage rendering = img.createRendering(rc);
    drawRenderedImage(rendering, reverseTransform);
}
Also used : NoninvertibleTransformException(java.awt.geom.NoninvertibleTransformException) RenderContext(java.awt.image.renderable.RenderContext) FontRenderContext(java.awt.font.FontRenderContext) AffineTransform(java.awt.geom.AffineTransform) RenderedImage(java.awt.image.RenderedImage)

Aggregations

FontRenderContext (java.awt.font.FontRenderContext)2 AffineTransform (java.awt.geom.AffineTransform)2 NoninvertibleTransformException (java.awt.geom.NoninvertibleTransformException)2 RenderedImage (java.awt.image.RenderedImage)2 RenderContext (java.awt.image.renderable.RenderContext)2