processing / processing/processing4

screenX etc. "broken" with pixelDensity(2) combined with JAVA2D renderer

Open
#557 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has attachment
Dominant language
Java
Stars
494
Forks
183
Avg merge
4h 39m
Merged PRs (30d)
3

Description

Created by: clankill3r

The following code:

void setup() {
  size(600, 600, JAVA2D);
  pixelDensity(2);
  println(screenX(600, 0));
}

prints out 1200.

If I change the pixelDensity to 1 it prints out 600.

For P2D and P3D it will always be 600, no matter the pixelDensity (like it should be).

I compared the screenXImpl here are the results (not sure if this helps):

JAVA2D with pixelDensity 1

_JAVA2D_PD1

JAVA2D with pixelDensity 2

_JAVA2D_PD2

P2D with pixelDensity 1

_P2D_PD1

P2D with pixelDensity 2

_P2D_PD2

My first impression is that the pixelDensity 2 for JAVA2D is bit of a cheap hack. (But what do I know!).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied sketch with the JAVA2D renderer and compare its screenXImpl behavior at pixelDensity 1 and 2 with the P2D results described in the issue. Trace the renderer-specific screenX path and verify that screenX(600, 0) reports 600 regardless of pixel density, while preserving the existing behavior for the other renderers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.