How to draw a dotted line? #155
-
I'm trying to port some code currently using I want to draw a dotted (not dashed) line. The code based on My current attempt (without round caps, using a pattern of What it should eventually look like: Is there an easy way to draw a dotted line with ImageSharp.Drawing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Personally, I'm not super familiar with the API, but if I'm getting it right, our current Pen structure doesn't support custom caps, however this method may actually support it. It generates a shape from an line path, so you can draw it with one of the If it works out, I think it would make sense to expose /cc @tocsoft |
Beta Was this translation helpful? Give feedback.
-
@0xced I've just pushed a PR to the repository to update the sample code. #157 The ImageSharp.Drawing/samples/DrawShapesWithImageSharp/Program.cs Lines 196 to 204 in 3ce36e0 Here's example output with |
Beta Was this translation helpful? Give feedback.
Personally, I'm not super familiar with the API, but if I'm getting it right, our current Pen structure doesn't support custom caps, however this method may actually support it. It generates a shape from an line path, so you can draw it with one of the
.Fill()
overloads. This example might be also interesting. Can you give it a try?If it works out, I think it would make sense to expose
JointStyle
andEndCapStype
on theIPen
API./cc @tocsoft