1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.22k stars 562 forks source link

Blending algorithm #42

Open chayleaf opened 6 years ago

chayleaf commented 6 years ago

I don't really know the details, but mspaint allowed you to do gradients like this: http://www.nerdparadise.com/mspaint/lineargradient which isn't possible in jspaint.

elamperti commented 6 years ago

It is a resizing issue (blending is how the colors mix). After playing with different canvas sizes, I think it's computing only some of the pixels in the line instead of using all of them (which is why ms paint creates a gradient).

1j01 commented 6 years ago

MS Paint in Win98/95, which is what jspaint is mainly a clone of, doesn't seem to support this, although I could add it as an option, probably without too much difficulty (if my Win10 install wasn't super broken rn)

(you can try it here if you want: https://copy.sh/v86/?profile=windows98)

shaunlebron commented 6 years ago

Played with imageSmoothQuality to see if possible, but I couldn't quite get a clean gradient:

screen shot 2018-01-18 at 3 26 22 pm

1j01 commented 4 years ago

@Mikejmoffitt points out selections are always scaled with nearest neighbor sampling.

1j01 commented 4 years ago

Looks like gradients work in the Windows XP version, but not Windows 98. JS Paint is primarily targeting parity with Windows 98. I'm not ruling out this feature, because it seems fun to support various old hacks, but I'm not interested in working on it at this point.

MS Paint might use "box sampling" so that all pixels contribute to the output.