mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Extras: Support JSVG 2.0.0. Minimum JSVG version is now 1.6.0. (issue #997)
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (23, ) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (23, ) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 3.7-SNAPSHOT
|
||||
|
||||
- Extras: Support JSVG 2.0.0. Minimum JSVG version is now 1.6.0. (issue #997)
|
||||
|
||||
|
||||
## 3.6
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
@@ -41,6 +41,11 @@ If SVG classes are used, `jsvg-<version>.jar` is also required:
|
||||
|
||||
[](https://maven-badges.herokuapp.com/maven-central/com.github.weisj/jsvg)
|
||||
|
||||
Supported JSVG versions:
|
||||
|
||||
- FlatLaf 3.7+ supports JSVG 1.6.0 and later.
|
||||
- FlatLaf 3.6- supports only JSVG 1.x (but not 2.x).
|
||||
|
||||
|
||||
Tools
|
||||
-----
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.Image;
|
||||
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.MultiResolutionImageSupport;
|
||||
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 class FlatSVGIcon
|
||||
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 @@ public class FlatSVGIcon
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.extras;
|
||||
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 javax.swing.JWindow;
|
||||
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 class FlatSVGUtils
|
||||
*/
|
||||
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 @@ public class FlatSVGUtils
|
||||
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 );
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ junit = "5.10.2"
|
||||
sigtest = "org.netbeans.tools:sigtest-maven-plugin:1.7"
|
||||
|
||||
# flatlaf-extras
|
||||
jsvg = "com.github.weisj:jsvg:1.4.0"
|
||||
jsvg = "com.github.weisj:jsvg:2.0.0"
|
||||
|
||||
# flatlaf-jide-oss
|
||||
jide-oss = "com.formdev:jide-oss:3.7.15"
|
||||
|
||||
Reference in New Issue
Block a user