processing / processing/processing4

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

Đang mở
#691 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

has attachment help wanted
Ngôn ngữ chính
Java
Star
494
Fork
183
Merge trung bình
4 giờ 39 phút
Pull request đã merge (30 ngày)
3

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy sketch được cung cấp với P2D và FX2D trên macOS, so sánh kết quả với mật độ pixel mặc định và với pixelDensity(1) hoặc pixelDensity(2). Theo dõi cách mỗi renderer xử lý pixelDensity(), loadPixels() và updatePixels(); được xem là hoàn tất khi các sketch tương đương tạo ra cùng một đầu ra mà không có hiện tượng mờ của FX2D.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
computer-graphics
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.