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

Sprites scale awkwardly with windows scale settings. #85

Open
whistler-1 opened this issue Sep 7, 2023 · 1 comment
Open

Sprites scale awkwardly with windows scale settings. #85

whistler-1 opened this issue Sep 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@whistler-1
Copy link

Description of the bug & expected behaviour
When scale is set to 150% in Windows 10 sprites will scale up accordingly but in a way that messes up the spritework. Ideally sprites shouldn't be sized up in a way that makes them look "crunchy" like this, maybe only resize them at intervals of 1x, 2x, 3x etc?

You can see here that some lines become really thick and some stay 1px wide:
pkmn-progressbar-scaling

Environment Info

  • OS: Windows 10 Education 21H2
  • JetBrains Product: IntelliJ Ultimate
  • JetBrains Product Version: 2023.2.1
  • Plugin Version: 2.1.1

Steps to reproduce

  1. In display settings, set "Scale and Layout" to 150%
  2. Open pokemon progress settings in IntelliJ to see the sprites.
@whistler-1 whistler-1 added the bug Something isn't working label Sep 7, 2023
@kagof
Copy link
Owner

kagof commented Feb 18, 2024

Hi @whistler-1, really sorry for sucha delayed reply to this ticket. Due to the nature of pixel art, scaling up by a non-whole number will necessarily cause those sorts of chunky artifacts, as you've pointed out.

I'm thinking the following might work, based somewhat on this Stackoverflow answer:

  1. in the paint method get the Window of the Component
  2. from the Window get the scaleX and scaleY of the GraphicsConfiguration
  3. call .scale(Math.round(scaleX) / scaleX, Math.round(scaleY) / scaleY) on the Graphics2D object which should then result in the scale being rounded to the nearest integer value

I'm not at all familiar with how Windows scaling works under the hood or how it interacts with Java so I might be mistaken about the above, but it seems promising to me, and worth a try. Does it seems reasonable to you, or am I missing something obvious?

If it work, this could easily be made another configurable option, something like "force integer dispay scaling".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants