public SVGDrawingPanel() { super(); svg = new SVGIcon(); svg.setScaleToFit(true); addComponentListener(this); }
public static BufferedImage getResourceBitmap(InputStream inputStream, String name, float scaleFactor, float defaultSize, int width, int height, int percent) throws IOException { try { URI uri = SVGCache.getSVGUniverse().loadSVG(inputStream, name); SVGDiagram diagram = SVGCache.getSVGUniverse().getDiagram(uri); double scale = scaleFactor / Math.sqrt((diagram.getHeight() * diagram.getWidth()) / defaultSize); float[] bmpSize = GraphicUtils.imageSize(diagram.getWidth(), diagram.getHeight(), (float) scale, width, height, percent); SVGIcon icon = new SVGIcon(); icon.setAntiAlias(true); icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH); icon.setPreferredSize(new Dimension((int) bmpSize[0], (int) bmpSize[1])); icon.setSvgURI(uri); BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); icon.paintIcon(null, bufferedImage.createGraphics(), 0, 0); return bufferedImage; } catch (Exception e) { throw new IOException(e); } }
if (".svg".equals(fileName.substring(fileName.length() - 4).toLowerCase())) SVGIcon icon = new SVGIcon(); icon.setSvgURI(imageURL.toURI());
if (".svg".equals(fileName.substring(fileName.length() - 4).toLowerCase())) SVGIcon icon = new SVGIcon(); icon.setSvgURI(imageURL.toURI());
if (".svg".equals(fileName.substring(fileName.length() - 4).toLowerCase())) SVGIcon icon = new SVGIcon(); icon.setSvgURI(imageURL.toURI());
if (".svg".equals(fileName.substring(fileName.length() - 4).toLowerCase())) SVGIcon icon = new SVGIcon(); icon.setSvgURI(imageURL.toURI());
SVGIconCreator(URL url) { SVGUniverse svgUniverse = SVGCache.getSVGUniverse(); icon = new SVGIcon(); try { try { new URI(url.toString()); svgUri = svgUniverse.loadSVG(url); } catch (URISyntaxException ex) { svgUri = svgUniverse.loadSVG(url.openStream(), url.getPath()); } final SVGDiagram diagram = svgUniverse.getDiagram(svgUri); aspectRatio = diagram.getHeight() / diagram.getWidth(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Gets the {@code SVGIcon} associated to a particular parameter configuration. * @param map The input configuration. * @return The {@code SVGIcon} for the given configuration * @throws ParameterException If the given configuration can't be processed. */ public SVGIcon getSVGIcon(Map<String,Object> map) throws ParameterException { try { URI uri = new URI(url.getValue(map)); if(!svgCache.containsKey(uri)){ SVGIcon svgIcon = new SVGIcon(); svgIcon.setSvgURI(new URI(url.getValue(map))); svgIcon.setAntiAlias(true); svgCache.put(uri,svgIcon); } return svgCache.get(uri); } catch (URISyntaxException e) { throw new ParameterException("Can't process the input URI", e); } }
icon = new SVGIcon(); icon.setSvgURI(new SVGUniverse().loadSVG(getClass().getResource(name))); icon.setPreferredSize(new Dimension(scalex, scaley));
SVGIcon icon = new SVGIcon(); icon.setSvgURI(source.toURI()); icon.setAntiAlias(antiAlias);
SVGIcon icon = new SVGIcon(); icon.setSvgURI(source.toURI()); icon.setAntiAlias(antiAlias);
SVGIcon icon = new SVGIcon(); icon.setSvgURI(source.toURI()); icon.setAntiAlias(antiAlias);
SVGIcon icon = new SVGIcon(); icon.setSvgURI(source.toURI()); icon.setAntiAlias(antiAlias);
svgIcon = new SVGIcon(); svgIcon.setSvgURI(uri); svgIcon.setAntiAlias(true);
SVGIcon icon = new SVGIcon(); icon.setSvgURI(uri); BufferedImage img;
SVGIcon icon = new SVGIcon(); icon.setAntiAlias(true); icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH);