Bucket tool went weird today
Keeper-CP1 opened this issue · 5 comments
For some reason, the bucket tool on JSpaint suddenly sucks since today. When i fill something drawn with the brush tool, some white dots are still there.
What is meant to be obtained:
What is actually obtained:
So far it only happens since right now because the problem doesn't occur for me before.
My device is a Huawei P30 pro on Chrome 113.0.5672.162.
I figured out the problem is only on Android because the bucket tool acts like usual on computers.
I haven't updated JS Paint any time recently, so it wouldn't be from a regression in my code.
The browser's Canvas API doesn't have any guaranteed precision, and some browsers or browser extensions randomize pixels as a security measure (called "farbling"). It's likely there's not much I can do here. I already have a threshold for the fill tool to avoid artifacts from these "farbling" security measures. It's possible increasing the threshold could fix this, although I wouldn't want it too high.
Did you draw something before drawing the shape you tried to fill? The pattern of the dots looks like it might be following the curve of some brush strokes (unlike canvas farbling which introduces more random noise).
Well, i guess i've drawn stuff but i "selected all and deleted the stuff". All shapes i tried to draw (and fill) gave me those "farbled" white dots. Apparently i got weird grey colors on top of the brush. I used the paint drop on it: when i use a brush with that color, the brush is rainbow until i released the finger.
For the "completely filled" shape, i used a brush/polygon tool on that shape to hide the dots
If the brush is showing as rainbow, that means it detected the current color as translucent, and (according to this line)
the alpha component was less than 253. Assuming you didn't select a translucent color, that should be 255.
As noted in a comment in the code there, I've ran into a similar thing in Firefox and so added a slight threshold.
I could increase all the hacky thresholds in the app, but I don't really want to do that.
Maybe one day I'll rewrite the app so the canvas element is only used for output, and not for storing the state of the image, so it never needs to get pixels from the canvas context, and that will eliminate these issues.
For now I think you'll have to find another app or another browser, sorry.
Okay, thanks!
I'm gonna use jspaint on my PC until the bug gets fixed
See you!