processing / processing/libprocessing

`stroke()` does not handle float values correctly

Open
#132 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
69
Forks
14
Avg merge
15d 22h
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Rust implementation of stroke() and run the provided mewnala reproduction. Compare the handling of integer and float grayscale and RGB inputs, using the Processing sketch as the expected reference. Done means equivalent float and integer values render the same colors, with coverage in the relevant tests if they exist.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.