-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
FlatSVGIcon explicit scaling #196
Comments
It will be also useful to be able to create multiple FlatSVGIcon with different sizes from the same SVG file once loaded. So we have a single SVG icon file and can use it with size 16x16 in the main menu, 24x24 in the toolbar and 32x32 as an icon in the message dialog window, for example. Looks like overriding size in constructor is a good idea: |
Thx, this is now implemented in master branch. There are additional constructors in FlatLaf/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java Lines 91 to 101 in 4c141fe
or a scale factor: FlatLaf/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java Lines 121 to 132 in 4c141fe
There are also FlatLaf/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java Lines 161 to 168 in 4c141fe
|
Exactly what I had in mind. Works well, good job. Not just with this but with the project overall. Looks great and it's nice to see all the progress you're making with each update. 👍 |
Hello,
I was wondering if there is any way to set a FlatSVGIcon's size directly that it would scale the svg itself into given dimensions like 16x16, eg. the same size as a 16x16 pixel ImageIcon.
From what I understand right now. The svg icon renders in whatever size the source .svg file has defined in the file itself.
To elaborate on why I'm interested in such functionality. When I download an .svg file from, say, an online icon library. It's not necessarily going to be 16x16 pixels and I have to use some tools to scale it into the size I desire.
Another issue arises when I want to have a set of 16 pixel icons and a bigger set that is like 24 pixels big for some other use cases. One would think that when I'm already using svg icons such icons could be generated by just scaling the same .svg file.
The ability to support multiple sizes is certainly part of the appeal of using svg icons. Am I missing something or is there no way to achieve that so it would work with hiDpi scaling and so on?
The text was updated successfully, but these errors were encountered: