Vector based Graphic support? #1468
chengenzhao
started this conversation in
Ideas
Replies: 1 comment
-
|
Thanks, looks quite interesting. Is there a full specification for the format? How is it different to SVG syntax-wise? I didn't see anything specific to FXGL, so you can probably actually target JavaFX in general as a standalone project, so that non-FXGL devs can make use of it. You can then make this available as a library? This looks like could work as a substitute for javafx serialization. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi:
Currently JavaFX/FXGL supports pixel bitmap Image & ImageView as basic Node
I would like to provide vector based graphic node to FXGL just like SVG
but different from that
We called it JVG which means Java/Json based vector graphic while SVG is xml based
Here is the source code:
https://github.com/chengenzhao/fxcity/tree/main/src/main/java/com/whitewoodcity/fxgl/vectorview
and JVG is made of different JVGLayers
each layer is a Path shape and can be described as a String
like
M x,y L x1,y1 etc.
and JVG combine these layers as a Group
and since this data is just a string so it could be wrapped as Json and persist as Json too
so JVG and JVGLayer also have toJson and fromJson method
which will generate persistent Json data
and also restore Object from it
& json based resources could be released to the maven central
and we also provide JVG editor here is the sample

JVG editor project is here:
https://github.com/chengenzhao/svg-editor
the source code of this JVG is here:
https://github.com/chengenzhao/xtrike-resources/blob/main/src/main/resources/com/whitewoodcity/xtrikeresources/clancy/scarl.jvg
and released on maven central:
https://mvnrepository.com/artifact/io.github.chengenzhao/xtrike-resources
and the best part of vector based graphic is scaling will reserve the shape of graphics
so there is zoom method in the JVG & JVGLayer
which allow users to amplify or narrow the graphics
and finally we also provide snapshot of JVG & JVGLayer
using .toImage or .toImageView to transfer the vector graphics to bitmap
Any suggestions would be helpful?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions