processing / processing/libprocessing

`stroke()` does not handle float values correctly

未關閉
#132 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug
主要語言
Rust
星號
69
分支
14
平均合併
15 天 22 小時
30 天內合併 PR
3

描述

stroke() appears to mis-handle float inputs. When using floats (e.g. 150.0), the rendered color is incorrect

Expected behavior

Float values in the same range as integers should produce identical results, as in Processing.

Actual behavior
  • stroke(150) → correct grayscale
  • stroke(150.0) → renders as white
Reproduction (mewnala)
from mewnala import *

def setup():
    size(640, 360)
    background(255)

def draw():
    stroke(150.0)
    line(0, 0, width, height)
    line(width, 0, 0, height)

    stroke(155.0, 100.0, 0.0)
    line(0, height // 2, width, height // 2)
    line(width // 2, 0, width // 2, height)

run()
Image
Equivalent Processing sketch (works as expected)
void setup() {
  size(640, 360);
  background(255);
}

void draw() {
  stroke(150.0);
  line(0, 0, width, height);
  line(width, 0, 0, height);

  stroke(155.0, 100.0, 0.0);
  line(0, height/2, width, height/2);
  line(width/2, 0, width/2, height);
}
Image

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先定位 stroke() 的 Rust 實作,並執行提供的 mewnala 重現。以 Processing sketch 作為預期參考,比較整數和浮點灰階輸入及 RGB 輸入的處理方式。當等效的浮點值和整數值渲染出相同顏色,且在相關測試存在時包含相應的測試覆蓋,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
rust
領域
computer-graphics
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。