HaikuArchives / ArtPaint

ArtPaint is a painting and image processing program.
https://haikuarchives.github.io/ArtPaint/
29 stars 18 forks source link

Width oddity with freehand and line tool #618

Closed humdingerb closed 1 year ago

humdingerb commented 1 year ago

This is a zoomed in image of single freehand-tool dots with widths from 1 to 6 points (the red dots are just there to help count pixels):

freehand_1-6

"Width" = 1: shows as 1 pixel width/height "Width" = 2: shows as 1 pixel width/height "Width" = 3: shows as 2 pixel width/height "Width" = 4: shows as 3 pixel width/height "Width" = 5: shows as 4 pixel width/height "Width" = 6: shows as 5 pixel width/height

A one-off issue?

Same with the straight line tool:

line_1-6pt

"Width" = 1: shows as 1 pixel width/height "Width" = 2: shows as 3 pixel width/height "Width" = 3: shows as 3 pixel width/height "Width" = 4: shows as 5 pixel width/height "Width" = 5: shows as 5 pixel width/height "Width" = 6: shows as 7 pixel width/height

A rounding issue?

dsizzle commented 1 year ago

well, the code is completely different for those. For Freehand, it actually creates an Elliptical brush of (presumably) the correct size. I wonder if Brush sizes are just off by 1 pixel?

For the Straight line tool it's supposed to be drawing a filled rectangle of the appropriate width. I'm guessing it's a floating-point rounding issue as you mention.

dsizzle commented 1 year ago

Closing via #619 and #620