-
-
Notifications
You must be signed in to change notification settings - Fork 17
JavaFX Output Implementation - V2 #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The current behaviour of the FXSVGCanvas while rendering is that it changes the width and height of the Canvas. Here is my 'renderer': |
|
@MrKuip Thanks for the suggestion, I think that's something I could look at adding when I'm next working on this, most likely by allowing user defined width + height on the FXSVGCanvas. |
weisJ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made some changes in my version of the branch: https://github.com/weisJ/jsvg/tree/javafx-final
Looking very good now 🚀
| javaxAnnotations.version = 1.3.2 | ||
| osgiAnnotations.version = 2.0.0 | ||
| slf4jApi.version = 2.0.17 | ||
| javafx.version = 17.0.15 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| import com.github.weisj.jsvg.renderer.output.Output; | ||
| import com.github.weisj.jsvg.view.FloatSize; | ||
|
|
||
| public class FXOutputTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not get the tests to run locally. It got stuck trying to initialise the tests. Not sure whether this is a problem on my end.
However I checked using the test application and the results look very good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-with-resources prevents the test initialization as the JavaFX thread expects the thread which calls it to stay open. Launching JavaFX out of it's own lifecycle has some strange behaviour. Reverting the last commit should fix your local tests. We could just directly create the thread and not use an Executor Service at all in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, what a footgun! 😅 Directly using a thread is fine. Maybe add a comment about why we don't properly join the thread.
jsvg-javafx/src/main/java/com/github/weisj/jsvg/ui/jfx/skin/FXSVGCanvasSkin.java
Show resolved
Hide resolved
d381511 to
783b4b0
Compare
|
There is one issue I still need to work out when using a different sized ViewBox some of the masked SVGs don't seem to work, just seems to be a transform issue of some kind. I will look into that again soon, then most likely switch to using the SVGs own ViewBox by default instead of it's size for the FXSVGCanvas. |
|
It has been some time now and I would like to pick up this PR again. @SonarSonic if you currently don't have the time to work on it I might be able to complete the work of the remaining issues. The feature doesn't need to be fully fletched on the first iteration. Appreciate all the work you have been putting into getting support for JavaFX! |
|
Hey @weisJ |
Hey Jannis,
Here is the second version of the JavaFX output implementation, I've created a fresh pull request to resolve the re-basing issues with the master branch and to show the changes more clearly.
Best wishes,
Ollie