Closed dsizzle closed 1 year ago
Nice! There seems to be an off-by-1 error, or better 2 off-by-0.5 errors...:
This is with a "size" of 4. The sampling seems to take an additional half-pixel all around.
To add: A size of 1 shows the sampling box is centered on the top left corner of a pixel. Shouldn't it center on the center? Now it appears as if you sample the 4 "half-pixels" around the mouse pointer, when in fact the one on the bottom right is sampled. A visual...:
Hmm, also looking at the 4px example maybe it’s not 0.5 all around, but rather it just needs to be shifted down and right by 0.5 ? The pointer doesn’t look centered in that case (although it does in the 1px case)
That is just a result of being zoomed in so much that you can move the mouse pointer around within the area of one pixel and the samplebox only jumping to the next pixel-border when you cross over to the next pixel. If you know what I mean... video: http://0x0.st/oFaS.mpg
this was a bit harder than I thought - can you please give it a try? I think it's working.
Almost. Works nicely with all sizes >1. Maybe a 1-pixel sample box needs special casing (?), as the box picks the pixel one pixel to the top and left of the one under the mouse pointer:
Odd, 1 pixel worked fine for me. I guess I’ll try it again tomorrow.
Ok, it should be fixed now. I also changed the sampling. It was doing some weird square root distance thing and wasn't getting all the pixels. I changed it to just average all the pixels in the square.
Yep. Works perfectly now, thanks!
It occurred to me that perhaps the old method was trying to do a circular sample rather than square - but imo not sure if that’s useful or intuitive in a pixel drawing app?
Yeah, I think going with a square sampling box is a good decision, because we end up with whole pixels being in/outside the sampling.
Fixes #325
I'm sure it would be desirable to show the sample square even when the mouse button isn't down, but that isn't the way ArtPaint works right now. Same problem with #304 - "tools" in ArtPaint only operate at all when you press the mouse.
of course with code all things are possible... ;D