org.apache.batik.ext.awt.image.GraphicsUtil Java Examples

The following examples show how to use org.apache.batik.ext.awt.image.GraphicsUtil. 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: SVGIcon.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected Image createAndPaintImage(
        Component c, ColorModel colorModel, int deviceWidth, int deviceHeight, double scale)
{
    BufferedImage img = createBufferedImage(colorModel, deviceWidth, deviceHeight);
    /* Use Batik's createGraphics method to improve performance and avoid the
    "Graphics2D from BufferedImage lacks BUFFERED_IMAGE hint" warning. */
    final Graphics2D g = GraphicsUtil.createGraphics(img);
    try {
        g.scale(scale, scale);
        try {
            GraphicsNode graphicsNode = getGraphicsNode();
            g.addRenderingHints(createHints());
            graphicsNode.paint(g);
        } catch (IOException e) {
            LOG.log(Level.WARNING,
                    "Unexpected exception while re-loading an SVG file that previously loaded successfully", e);
        }
    } finally {
        g.dispose();
    }
    return img;
}
 
Example #2
Source File: SimpleRenderToImageAwareDataRenderer.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Graphics2D createGraphics(BufferedImage bi)
{
	Graphics2D graphics = GraphicsUtil.createGraphics(bi);
	if (isAntiAlias())
	{
		graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		//FIXME use JPG instead of PNG for smaller size?
	}
	return graphics;
}
 
Example #3
Source File: BatikRenderer.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Graphics2D createGraphics(BufferedImage bi)
{
	Graphics2D graphics = GraphicsUtil.createGraphics(bi);
	if (antiAlias)
	{
		graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		//FIXME use JPG instead of PNG for smaller size?
	}
	return graphics;
}
 
Example #4
Source File: AbstractSvgDataToGraphics2DRenderer.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Graphics2D createGraphics(BufferedImage bi)
{
	Graphics2D graphics = GraphicsUtil.createGraphics(bi);
	return graphics;
}