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

Avoid ImageIcon use in more places, to preserve HiDPI icon resolution #7472

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

eirikbakke
Copy link
Contributor

@eirikbakke eirikbakke commented Jun 13, 2024

Replace various instances of 'new ImageIcon' with ImageUtilities.image2Icon in the platform module. This preserves HiDPI icons (e.g. SVG icons loaded by ImageUtilities) when relevant, and preserves rendering hints in ImageUtilities for bitmap icon scaling.

(These changes were made to ensure that the SVG icons added in #7463 actually show up in high resolution in various places.)

…e2Icon in the platform module. This preserves HiDPI icons (e.g. SVG icons loaded by ImageUtilities) where relevant.
@eirikbakke eirikbakke added UI User Interface Platform [ci] enable platform tests (platform/*) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jun 13, 2024
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build from source - saw no change on "normal DPI", but changes look sane to me.

@eirikbakke
Copy link
Contributor Author

@matthiasblaesing Thanks! Yeah, with no HiDPI scaling, icons should look identical.

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I suspected as much, I was between Comment and Approve. I eyeballed it, it builds, so it should work. If it does what it promises, would need someone with HiDPI setup.

@eirikbakke
Copy link
Contributor Author

Verifying that things don't break on regular 1:1 scaling is probably good enough, since any visual difference is purely cosmetic. I've also tested the patch in my working IDE and NetBeans Platform app for the last 6 months, confirming no breakage.

(On Windows, I think scaling can be enabled from the "Display settings" control panel app whether or not the screen is actually HiDPI. On MacOS, every MacBook or Apple display is Retina i.e. 2x scaling these days.)

@eirikbakke eirikbakke merged commit 37bdd47 into apache:master Jul 2, 2024
32 checks passed
@mbien mbien added this to the NB23 milestone Jul 18, 2024
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 2, 2025
Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 2, 2025
Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 2, 2025
Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 2, 2025
Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 5, 2025
…. (Manually applied PR#8109.)

Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 24, 2025
…. (Commit 1: Single-line changes.)

Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 24, 2025
…. (Commit 1: The simplest/most localized changes.)

Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit to eirikbakke/incubator-netbeans that referenced this pull request Jan 24, 2025
…. (Commit 1: The simplest/most localized changes.)

Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in apache#7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
eirikbakke added a commit that referenced this pull request Feb 22, 2025
…. (Commit 1: The simplest/most localized changes.)

Replace most of the remaining trivial uses of the ImageIcon(Image) constructor, replacing these with ImageUtilities.image2Icon or ImageUtilities.loadImageIcon. This allows SVG icons, when/once present, to render in full resolution on HiDPI/Retina displays. Bitmap icons also benefit from the improved scaling hints applied by ImageUtilities.

Similar work was done, for the platform module only, in #7472 . This commit covers most of the remaining trivial cases; I grepped the codebase for 'new ImageIcon' and adjusted the code to avoid ImageIcon whenever this could be done easily (not changing APIs, requiring only a visual code review).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Platform [ci] enable platform tests (platform/*) UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants