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

Set default pixel density to the display's density #950

Open
SableRaf opened this issue Feb 21, 2025 · 4 comments
Open

Set default pixel density to the display's density #950

SableRaf opened this issue Feb 21, 2025 · 4 comments
Assignees
Labels
core enhancement New feature or request

Comments

@SableRaf
Copy link
Collaborator

Most relevant area for this enhancement?

Core/Environment/Rendering

Feature to enhance

pixelDensity()

Desired enhancement

Currently, Processing defaults to pixelDensity(1), requiring users to manually set pixelDensity(2) or pixelDensity(displayDensity()) for high-DPI support. This proposal sets the default to the display's actual density, improving visual quality by default while allowing users to override it.

Potential benefits

Sharper rendering on high-DPI displays.

Possible drawbacks

No response

Additional context

No response

Would you like to work on the issue?

This is a small change which would make a good first issue. I'm happy to leave it to a new contributor.

@SableRaf SableRaf added the enhancement New feature or request label Feb 21, 2025
@SableRaf SableRaf moved this to Backlog in Processing Roadmap Feb 21, 2025
@SableRaf SableRaf added the core label Feb 21, 2025
@yehiarasheed
Copy link
Contributor

I can work on this issue, please assign it to me. I will follow up with a proposed solution here as well since this is the first time for me to contribute to this repo.

@yehiarasheed
Copy link
Contributor

yehiarasheed commented Mar 13, 2025

Hello @Stefterv @SableRaf,

Just to make sure that I'm on the right track for solving this issue, I've tried setting the pixelDensity variable in the PApplet.java class dynamically by calling the displayDensity() method as the assignment value.

That said, whenever I try to set the pixel density to 1 using pixelDensity(1), it works just fine. Even if I call pixelDensity(int density) multiple times in the sketch, the last method call is the one that actually sets the value of the pixelDensity variable.

I know that the pixelDensity(int density) method is supposed to be called only once (as mentioned in the JavaDocs), but I tested calling it multiple times, and it worked as expected.

Demo

Normal Scaling

Normal.Scaling.Non-HiDPI.mode.mp4

Custom scaling (Hi-DPI)

High.Scaling.HiDPI.mode.mp4

@Stefterv Stefterv moved this from Backlog to In progress in Processing Roadmap Mar 13, 2025
@Stefterv
Copy link
Collaborator

Hi @yehiarasheed Sorry for not replying earlier,

This change is best to be as minimal as possible, if you find other issues on the way, please create separate PR's for those or just document them through a separate issue.

@yehiarasheed
Copy link
Contributor

Hi @Stefterv, no worries! I now understand that you're aiming for a minimal enhancement—I initially thought Jim's comments reflected the entire team's vision.

@SableRaf SableRaf assigned yehiarasheed and unassigned Stefterv Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

3 participants