Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
RFE: from Flamingo to tool to directly support "SVG to code" in Codename One #2797
On December 2017 I discovered your Flaming SVG Transcoder fork for Codename One https://github.com/codenameone/flamingo-svg-transcoder, I was enthusiast to the possibility to use vectorial images, I submitted two PRs and, after that... I stopped to use it because it simply doesn't work in the most of cases (producing not compilable code).
After all this time, I'm again interested in Flaming SVG Transcoder.
Indeed I tried to handcode arrows using a GeneralPath, it's nearly impossible. I tried to use raster arrows... they are satisfying in a demo, but for the actual app the quality is low (they have different sizes and are scaled at runtime, the quality of that scaling is not very good). Probably vector images is the best choice, in this case.
However, generalizing this problem, I suppose that an official support to "SVG to code" (like Android, that has several tools to convert SVG images to Android vector drawable) can open a lot of use cases, especially when the size of a multi-color icon or drawn image (not renderable with ttf) is not known.
Can you create a such tool, for example integrated in the Codename One plugin or in a web page, that produces code really usable with Codename One?
I know that this RFE seems generic: I'm asking for a true svg support. For example, the svgs available on https://pixabay.com/ are not usable (in my tests), because the Java files produced by your fork of Flamingo cannot be compiled in Codename One.
Thank you for your support. You wrote that "the code is relatively simple and easy to enhance if you need support for additional features". I hope it's so ;-)
I read your article about the Flamingo improvements:
Maybe there is something that I'm missing, because flamingo doesn't produce for me any output or error.
I tried to convert to Java the image Football.svg (that you can download from this zip), using this command:
There is not
Of course I changed the current directory to the one in which I placed the jar and the svg. I used the jar you linked in the blog post:
I'm using Java "1.8.0_212" on Linux.
I've just tried an actual SVG:
It works, even if with small differences from the original image, but ... it's a significant improvement compared to before. Thank you.
Have you noted that the Java classes produced by Flamingo cannot be scaled? At the moment they can be only inserted in the center of a BorderLayout.
A code like the following throws an exception:
I haven't checked recent versions - but in June 2017 this used to work: