Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@potatoes1286
Copy link
Contributor

Fixes #733

I had discovered what caused bug #733 was that "-" and "" are treated differently by the dash engine. So it wasn't noticeable at lower widths, but at larger widths it would cause those artifacts. This fix defaults the "-" dash pattern to "" internally, preventing this issue and drawing it as the user expects.

This approach may be considered a little too hacky? An alternative would be to make the default dashpattern "".

However, this led to a second issue, was that the polygon engine auto-defaults to use LineCap.Square. This would produce another artifact in drawing the circle. Defaulting to LineCap.Butt would fix this issue, but it would break rectangle drawing, and hard-coding in to make an exception for ellipse drawing would suck.

So i modified the polygon engine to support each shape drawing tool defining its own linecap. Ellipse tool uses Butt, Rectangle tool uses Square, and Rounded Rectangle uses Butt. Using any dashpattern other than "-" enforces square because dash patterns don't work with butt.

Before dashpattern fix:
image
image

After dashpattern fix:

image
image

Final result:

image

And dash patterns still work.

image

@cameronwhite
Copy link
Member

Thanks for looking at this! I'll need to do some testing of the shape drawing changes, but for the dash pattern I'd suggest fixing the behaviour for the single dash in CairoExtensions.CreateDashPattern() (and also rely on that method's return value to determine if there is any dashing)

@cameronwhite
Copy link
Member

Looks good, thanks for your contribution!

@cameronwhite cameronwhite merged commit 2da27e4 into PintaProject:master Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dashed outline circle with large brush width

2 participants