File new-jsvg.patch of Package flatlaf

--- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java
+++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java
@@ -25,6 +25,7 @@
 import java.awt.Paint;
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
+import java.awt.geom.Dimension2D;
 import java.awt.LinearGradientPaint;
 import java.awt.image.BufferedImage;
 import java.awt.image.RGBImageFilter;
@@ -52,7 +53,7 @@
 import com.formdev.flatlaf.util.SoftCache;
 import com.formdev.flatlaf.util.UIScale;
 import com.github.weisj.jsvg.SVGDocument;
-import com.github.weisj.jsvg.geometry.size.FloatSize;
+import com.github.weisj.jsvg.parser.LoaderContext;
 import com.github.weisj.jsvg.parser.SVGLoader;
 
 /**
@@ -271,7 +272,7 @@ public FlatSVGIcon( InputStream in ) throws IOException {
 		this( null, -1, -1, 1, false, null, null );
 
 		try( InputStream in2 = in ) {
-			document = svgLoader.load( in2 );
+			document = svgLoader.load( in2, null, LoaderContext.createDefault() );
 
 			if( document == null ) {
 				loadFailed = true;
@@ -620,9 +621,9 @@ private void paintSvg( Graphics2D g, int x, int y ) {
 
 		UIScale.scaleGraphics( g );
 		if( width > 0 || height > 0 ) {
-			FloatSize svgSize = document.size();
-			double sx = (width > 0) ? width / svgSize.width : 1;
-			double sy = (height > 0) ? height / svgSize.height : 1;
+			Dimension2D svgSize = document.size();
+			double sx = (width > 0) ? width / svgSize.getWidth() : 1;
+			double sy = (height > 0) ? height / svgSize.getHeight() : 1;
 			if( sx != 1 || sy != 1 )
 				g.scale( sx, sy );
 		}
--- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGUtils.java
+++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGUtils.java
@@ -19,6 +19,7 @@
 import java.awt.Dimension;
 import java.awt.Graphics2D;
 import java.awt.Image;
+import java.awt.geom.Dimension2D;
 import java.awt.image.BufferedImage;
 import java.net.URL;
 import java.util.Arrays;
@@ -28,7 +29,6 @@
 import com.formdev.flatlaf.util.MultiResolutionImageSupport;
 import com.formdev.flatlaf.util.SystemInfo;
 import com.github.weisj.jsvg.SVGDocument;
-import com.github.weisj.jsvg.geometry.size.FloatSize;
 
 /**
  * Utility methods for SVG.
@@ -180,9 +180,9 @@ public static BufferedImage svg2image( String svgName, float scaleFactor ) {
 	 */
 	public static BufferedImage svg2image( URL svgUrl, float scaleFactor ) {
 		SVGDocument document = FlatSVGIcon.loadSVG( svgUrl );
-		FloatSize size = document.size();
-		int width = (int) (size.width * scaleFactor);
-		int height = (int) (size.height * scaleFactor);
+		Dimension2D size = document.size();
+		int width = (int) (size.getWidth() * scaleFactor);
+		int height = (int) (size.getHeight() * scaleFactor);
 		return svg2image( document, width, height );
 	}
 
@@ -202,9 +202,9 @@ private static BufferedImage svg2image( SVGDocument document, int width, int hei
 		try {
 			FlatSVGIcon.setRenderingHints( g );
 
-			FloatSize size = document.size();
-			double sx = width / size.width;
-			double sy = height / size.height;
+			Dimension2D size = document.size();
+			double sx = width / size.getWidth();
+			double sy = height / size.getHeight();
 			if( sx != 1 || sy != 1 )
 				g.scale( sx, sy );
 
openSUSE Build Service is sponsored by