@Override protected void renderSimple( BufferedImage area ) { Graphics2D gc = createGraphics( area ); render( gc, area.getWidth() / 2, area.getHeight() / 2, area.getWidth(), area.getHeight(), 0 ); gc.dispose(); }
/** * Draw SVG image to Graphics2D. */ @Override protected void render( Graphics2D gc, int centerX, int centerY, int width, int height, double angleRadians ) { render( gc, svgGraphicsNode, svgGraphicsSize, centerX, centerY, width, height, angleRadians ); }
/** * Load image from InputStream as bitmap image, or SVG image conversion to bitmap image. */ private static SwingUniversalImage loadImage( InputStream in, String filename ) { if ( !SvgSupport.isSvgName( filename ) ) { // bitmap image try { return new SwingUniversalImageBitmap( ImageIO.read( in ) ); } catch ( IOException e ) { throw new RuntimeException( e ); } } else { // svg image - need to convert to bitmap try { return new SwingUniversalImageSvg( SvgSupport.loadSvgImage( in ) ); } catch ( Exception ex ) { throw new RuntimeException( ex ); } } } }
@Override protected Image renderRotated( Device device, int width, int height, double angleRadians ) { BufferedImage doubleArea = SwingUniversalImage.createDoubleBitmap( width, height ); Graphics2D gc = SwingUniversalImage.createGraphics( doubleArea ); SwingUniversalImageSvg.render( gc, svgGraphicsNode, svgGraphicsSize, doubleArea.getWidth() / 2, doubleArea .getHeight() / 2, width, height, angleRadians ); gc.dispose(); return swing2swt( device, doubleArea ); } }
try { SvgImage svg = SvgSupport.loadSvgImage( inputStream ); image = new SwingUniversalImageSvg( svg ); } catch ( Exception ex ) { throw new KettleException( "Unable to load image from classpath : '" + fileName + "'", ex );
@Override protected Image renderSimple( Device device, int width, int height ) { BufferedImage area = SwingUniversalImage.createBitmap( width, height ); Graphics2D gc = SwingUniversalImage.createGraphics( area ); SwingUniversalImageSvg.render( gc, svgGraphicsNode, svgGraphicsSize, width / 2, height / 2, width, height, 0 ); gc.dispose(); return swing2swt( device, area ); }
try { SvgImage svg = SvgSupport.loadSvgImage( inputStream ); image = new SwingUniversalImageSvg( svg ); } catch ( Exception ex ) { throw new KettleException( "Unable to load image from classpath : '" + fileName + "'", ex );
try { SvgImage svg = SvgSupport.loadSvgImage( inputStream ); image = new SwingUniversalImageSvg( svg ); } finally { IOUtils.closeQuietly( inputStream );