processing / processing/processing4

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

Abierto
#691 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

has attachment help wanted
Lenguaje dominante
Java
Estrellas
494
Forks
183
Merge medio
4 h 39 min
PR fusionados (30 d)
3

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza ejecutando el sketch proporcionado con P2D y FX2D en macOS, comparando los resultados con la densidad de píxeles predeterminada y con pixelDensity(1) o pixelDensity(2). Sigue cómo cada renderer gestiona pixelDensity(), loadPixels() y updatePixels(); se considera terminado cuando los sketches equivalentes producen la misma salida sin el desenfoque de FX2D.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
computer-graphics
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.