Skip to content
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

Automatically build source SVG icons to PNG for GAMA interface usage #5

Open
RoiArthurB opened this issue Mar 3, 2023 · 12 comments
Open
Assignees

Comments

@RoiArthurB
Copy link
Contributor

Is your request related to a problem? Please describe.
Right now, every source icons file have been pushed under the SVG format in ummisco.gama.ui.shared/svg, but Eclipse doesn't support this format and requires PNG ones.

Describe the improvement you'd like
Creating a Github Action which would be triggered everytime this sub-folder is edited and regenerate every icons for GAMA (with the support of zoomed format x1 x1.5 and x2).

Additional context
Eclipse provides a custom java tool to generate those icons from svg files to png for this exact purpose ( 3d-p tutorial there : https://www.vogella.com/tutorials/Eclipse4Notes/article.html )

@RoiArthurB RoiArthurB self-assigned this Mar 3, 2023
@AlexisDrogoul
Copy link
Member

Actually the most useful link is: https://github.com/eclipse-platform/eclipse.platform.images (contains the Maven Mojos that can be triggered).

@AlexisDrogoul
Copy link
Member

AlexisDrogoul commented Mar 4, 2023

I have committed a first batch of icons produced using an algorithm similar to the one used in the link above (passing -Dproduce_icons=true to GAMA in GUI mode generates the icons). The only problem, of course, is that it requires the whole batik library to work... So it will be better, in any case, to have a separate plugin and/or maven module...

RoiArthurB referenced this issue in gama-platform/gama.old Mar 6, 2023
This workflow can be triggered either Manually or when a commit modify ummisco.gama.ui.shared/svg folder
It uses eclipse-platform/eclipse.platform.images to generate every svg icons used in GAMA and deploy them in needed places in the repository
(this generation is outside the JAVA project source, therefore the batik library isn't needed for that in the project)
Doesn't do anything yet as it's a WIP, feel free to trigger it at your will for testing
Related #3647
@RoiArthurB
Copy link
Contributor Author

Hi @AlexisDrogoul ! I have a first step to generate icons from SVG inside GAMA 🥳

It's an automatic workflow triggered when editing files in ummisco.gama.ui.shared/svg folder (or manually triggered) and using (externally) eclipse images' package.

I haven't finished and enabled this workflow (doesn't commit anything yet) as I noticed some issues :

  1. disabled icons aren't present in the SVG folder.
    • Do we need them and, if yes, how did you generate them (automatic process from eclipse GUI or manual trigger)?
  2. As you can see in the dry-run of the workflow (step Regenerate icon from SVG) like there, the package have some issues with some SVG
    • I might need some help for this one (I don't know much about SVGs) 😃

@AlexisDrogoul
Copy link
Member

disabled icons are produced on the fly. And it seems that the original eclipse images jar is a bit too sensitive to SVG peculiarities. I wonder if we should not produce our own independent jar that would include GamaIconsLoader and its dependencies. Should probably be reworked a bit (with files operations rather than bundle operations, etc.) but it would probably be safer. What do you think ? I could maybe try this and produce either a Mojo or a main...

@AlexisDrogoul
Copy link
Member

I am producing a version of GamaIconsLoader that does not have any dependencies towards GAMA and/or SWT. Only Java and Batik. Could then perfectly host a main() that could be invoked with the appropriate input and output paths. What do you think ?

AlexisDrogoul referenced this issue in gama-platform/gama.old Mar 6, 2023
- no dependencies towards GAMA and/or SWT / Eclipse
- can be run inside a jar
- a simple main() has been implemented
@RoiArthurB
Copy link
Contributor Author

Hi, 2 points/questions on this :

  1. I saw in your commit that you added the option to generate images while starting GAMA if those are missing. Does it means that we do not remove that generation step out from GAMA ?
  2. While you made a main not depending on GAMA nor else, shouldn't we move it to another repository and (therefore) remove batik from GAMA (making the project lightest and removing one less-usefull dependency) ?

@AlexisDrogoul
Copy link
Member

AlexisDrogoul commented Mar 7, 2023

EDIT: I forgot to commit the last changes -- I do it now.

Hi,

  1. I actually removed the generation of images if they are missing. Now only the loading of icons is done at startup (ie reading the PNGs)
  2. Excellent suggestion. I just need to remove some constants that are still there (and used by 2 other classes) and it should be ready to move !

Alex

@AlexisDrogoul
Copy link
Member

After that, to be totally honest, there are some issues (one open, gama-platform/gama2#27 and several closed, e.g. gama-platform/gama#1487, gama-platform/gama#1119) that require a better support of SVG in GAMA, and I suspect Batik would be the best library to do so...

@RoiArthurB RoiArthurB changed the title Automatically build SVG to PNG for GAMA Automatically build source SVG icons to PNG for GAMA interface usage Mar 7, 2023
@RoiArthurB
Copy link
Contributor Author

I can see the interest of having better SVG support in GAMA, but (at least for the still open issue), it doesn't seem to be target for the next release but for the future rewriting GAMA base. Also, not the old issues nor the GamaSVGFile class are using batik (from a quick code reading/research).

Therefore, I only see the benefice of removing batik from the project 🤷

@AlexisDrogoul
Copy link
Member

AlexisDrogoul commented Mar 7, 2023

OK ok... Just saying. I think I'm gonna work on my own plugin then !

Let me one more hour so that I can completely isolate the production of icons into a nice little self-contained Eclipse project (not OSGI, just plain Java project + source files like SVG and Graffle), and after that you'll do what you want with it.

@AlexisDrogoul
Copy link
Member

AlexisDrogoul commented Mar 7, 2023

Done. It's available from there : https://github.com/gama-platform/gama.resources/tree/2b59e18a7e3af8b5d22f20b2b0bb6dfe6b1273a4/icons/ummisco.gama.icons.producer

The two arguments are the input and output paths. If none are specified, then svg and icons are used locally. If only one is specified, svg is used as input (the icons are already in the project) and the sole argument as output.

I attached a launch configuration to it so that it can also be run from Eclipse.
(I did not produce neither a jar nor a Maven Mojo)

@AlexisDrogoul
Copy link
Member

This one is put on Standby for the moment, as there is no real urgency in having an integrated pipeline immediately, now that we have a runnable project (in the gama.resources) repository.

@AlexisDrogoul AlexisDrogoul transferred this issue from gama-platform/gama.old Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants