processing / processing/processing4

Inconsistencies with `pixelDensity()` across P2D and FX2D renderers in MacOS

Ouverte
#691 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

has attachment help wanted
Langage dominant
Java
Étoiles
494
Forks
183
Merge moyen
4 h 39 min
PR mergées (30 j)
3

Description

Created by: haschdl

I was playing around with loadPixels() and updatePixels() and I found a strange behaviour, in which using FX2D with MacOS creates a blur effect after redraws. Another person using Windows did not experience that, which led to me to check for pixelDensity() - adding pixeldDensity(2) to the sketch running FX2D "fixes" the problem.

It would be great to know what is happening "behind the scenes", as this difference in behaviour affects other sketches. In particular, is there a reason why leaving out pixelDensity() or adding pixelDensity(1) creates the blur effect?

As for the bug report, I believe P2D and FX2D should produce the same output for such trivial examples. Perhaps the bug is along the lines "FX2D renderer does not detect the correct pixel density in MacOS" or something like that.

The following code works as expected in P2D, but produces an unexpected blur effect when using FX2D.

import processing.javafx.*;

void setup() {
  size(500, 500);
  background(0);
}

void draw() {
  noFill();
  stroke(255, 200);
  circle(random(width), random(height), random(100, 200));
  loadPixels();
  updatePixels();
}

Using P2D:
Image

Using FX2D:
Image

Description

Using the code above produces different output using F2XD.

Expected Behavior

Output should be same regardless of renderer.

Current Behavior

There is a blur effect using FX2D.

Steps to Reproduce

Run a sketch using the code below, alternating between P2D and FX2D renderers.

Your Environment

  • Processing version: 4.2
  • Operating System and OS version: MacOS 13.1 Ventura, Macbook pro 13-inch
  • Other information: Other users reported this behavior cannot be reproduced in Windows

Possible Causes / Solutions

This seems to be related to pixelDensity(), or to be precise, the default value for pixelDensity() using FX2D seems to be incorrect.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter le sketch fourni avec P2D et FX2D sur macOS, en comparant les résultats avec la densité de pixels par défaut et avec pixelDensity(1) ou pixelDensity(2). Suivez la façon dont chaque renderer gère pixelDensity(), loadPixels() et updatePixels() ; le travail est terminé lorsque les sketches équivalents produisent la même sortie sans le flou de FX2D.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
computer-graphics
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.