@Override protected Image renderSimple( Device device ) { return renderSimple( device, (int) Math.round( svgGraphicsSize.getWidth() ), (int) Math.round( svgGraphicsSize .getHeight() ) ); }
@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 ); } }
SwtUniversalImage image = new SwtUniversalImageSvg( svg );
/** * Load image from InputStream as bitmap image, or SVG image conversion to bitmap image. */ private static SwtUniversalImage loadImage( Display display, InputStream in, String filename ) { if ( !SvgSupport.isSvgName( filename ) ) { // bitmap image return new SwtUniversalImageBitmap( new Image( display, in ) ); } else { // svg image - need to convert to bitmap try { return new SwtUniversalImageSvg( SvgSupport.loadSvgImage( in ) ); } catch ( Exception ex ) { throw new RuntimeException( ex ); } } } }
SwtUniversalImage image = new SwtUniversalImageSvg( svg );
@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 ); }