Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
daf606e
Allow access to paint clean-up in GraphicsUtil
SonarSonic Jul 31, 2025
105aa1d
Deprecate Output.setClip() for removal
SonarSonic Jul 31, 2025
e5416f1
Upgrade batik to a modular version
SonarSonic Jul 31, 2025
2ff834b
Create JavaFX sub module
SonarSonic Jul 31, 2025
20b4c12
Add AWT to JFX inter-op bridge
SonarSonic Jul 31, 2025
71caf3c
Add FXOutput implementation
SonarSonic Jul 31, 2025
f65252c
Add FXSVGCanvas + FXSVGCanvasSkin + renderer implementations
SonarSonic Jul 31, 2025
b830054
Add FXOutput unit testing
SonarSonic Jul 31, 2025
850d04b
Add JavaFX test viewer application
SonarSonic Jul 31, 2025
93424ed
Add package-info for jsvg-javafx packages
SonarSonic Jul 31, 2025
a944937
Make relevant packages available to jsvg.javafx module
SonarSonic Jul 31, 2025
a2e4174
Make FXOutput final
weisJ Sep 2, 2025
b6e0408
Add more nullability annotations
weisJ Sep 2, 2025
2a9d4e3
Expose FXOutput
weisJ Sep 2, 2025
544150b
Turn FXSVGRenderer into an interface
weisJ Sep 2, 2025
666bbbe
Fixup expose FXOutput
weisJ Sep 2, 2025
a3c25f2
Remove unused function
weisJ Sep 2, 2025
b27ab80
Move Javafx renderer implementations into own package
weisJ Sep 2, 2025
dcef505
Add convenience task to run JavaFX test application
weisJ Sep 2, 2025
775f25f
Make JavaFX test class non-public
weisJ Sep 2, 2025
5b28fb7
Wrap newSingleThreadExecutor with try-with-resource
weisJ Sep 2, 2025
161541a
Fix JavaFX Test Initialization
SonarSonic Sep 4, 2025
60ad744
Fix FXSVGCanvas not loading the SVGDocument's animation
SonarSonic Sep 4, 2025
a12209d
Fix Spotless formatting
SonarSonic Sep 4, 2025
8ae33d5
Hide implementation of FXOutput
weisJ Jan 13, 2026
e8ddba4
Run spotless
weisJ Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ me.champeau.jmh.version = 0.6.6
org.sonarqube.version = 5.1.0.4882
jacoco.version = 0.8.12
biz.aQute.bnd.lib.version = 7.1.0
org.openjfx.javafxplugin.version = 0.1.0

#Dependencies
# Libraries
nullabilityAnnotations.version = 23.0.0
javaxAnnotations.version = 1.3.2
osgiAnnotations.version = 2.0.0
slf4jApi.version = 2.0.17
javafx.version = 17.0.15
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require java 17? If yes we should update the language version for the javafx module to reflect this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're slightly out of sync, so this actually only requires Java 11


# Test libraries
junit.version = 5.6.2
imageCompare.version = 1.0.0
batik.version = 1.17
batik.version = 1.19
svgSalamander.version = 1.1.3
darklaf.version = 3.1.0
swingExtensions.version = 0.1.4-SNAPSHOT
Expand Down
78 changes: 78 additions & 0 deletions jsvg-javafx/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
`java-library`
jacoco
id("biz.aQute.bnd.builder")
id("org.openjfx.javafxplugin")
}

javafx {
version = rootProject.extra["javafx.version"].toString()
modules("javafx.controls", "javafx.fxml", "javafx.swing")
}

dependencies {
compileOnly(projects.jsvg)
compileOnly(libs.nullabilityAnnotations)
compileOnly(toolLibs.errorprone.annotations)
compileOnly(libs.osgiAnnotations)

testImplementation(projects.jsvg)
testImplementation(testLibs.junit.api)
testImplementation(testLibs.imageCompare)
testImplementation(gradleApi())

testRuntimeOnly(testLibs.junit.engine)

testCompileOnly(libs.nullabilityAnnotations)
testCompileOnly(toolLibs.errorprone.annotations)
}
tasks {

compileTestJava {
options.release.set(21)
}

jar {
bundle {
bnd(
bndFile(
moduleName = "com.github.weisj.jsvg.javafx",
requiredModules =
listOf(
Requires("com.github.weisj.jsvg"),
Requires("org.jetbrains.annotations", static = true),
Requires("com.google.errorprone.annotations", static = true),
Requires("org.osgi.annotation.bundle", static = true),
),
),
)
}
}

withType<JavaExec> {
environment("JAVAFX_TEST_SVG_PATH" to File(project.rootDir, "jsvg/src/test/resources").absolutePath)
}

test {
dependsOn(jar)
doFirst {
workingDir = File(project.rootDir, "build/ref_test").also { it.mkdirs() }
}
useJUnitPlatform()
testLogging {
showStandardStreams = true
showExceptions = true
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
}
}

register<JavaExec>("SVGViewerFX") {
group = "application"
description = "Runs the JavaFX SVG Viewer application."
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.weisj.jsvg.renderer.jfx.viewer.FXViewerMain")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* MIT License
*
* Copyright (c) 2026 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.github.weisj.jsvg.renderer.jfx;

import javafx.scene.canvas.GraphicsContext;

import org.jetbrains.annotations.NotNull;

import com.github.weisj.jsvg.renderer.jfx.impl.FXOutputImpl;
import com.github.weisj.jsvg.renderer.jfx.impl.bridge.FXRenderingHintsUtil;
import com.github.weisj.jsvg.renderer.output.Output;

/**
* A utility class for retrieving an {@link Output} implementation that uses a {@link GraphicsContext} to draw to.
*/
public final class FXOutput {

private FXOutput() {}

/**
* Example usage:
* <pre><code>
* Output output = FXOutput.createForGraphicsContext(graphics);
* svgDocument.renderWithPlatform(NullPlatformSupport.INSTANCE, output, null, null);
* output.dispose();
* </code></pre>
*/
public static @NotNull Output createForGraphicsContext(@NotNull GraphicsContext context) {
FXOutputImpl output = new FXOutputImpl(context);
FXRenderingHintsUtil.setupDefaultJFXRenderingHints(output);
return output;
}
}
Loading
Loading