private static BufferedImage svg2image( SVGDocument document, int width, int height ) {
		BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB );

		Graphics2D g = image.createGraphics();
		try {
			FlatSVGIcon.setRenderingHints( g );

			Dimension2D size = document.size();
			double sx = width / size.getWidth();
			double sy = height / size.getHeight();
			if( sx != 1 || sy != 1 )
				g.scale( sx, sy );

			document.render( null, g );
		} finally {
			g.dispose();
		}
		return image;
	}
Creates a buffered image and renders the given SVGDocument into it.

@param document the SVG document
@param width the width of the image
@param height the height of the image
@return the image
@throws RuntimeException if failed to render SVG file
flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGUtils.java