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 摘要。