LineJoinTypes.Miter does not have any effect

Hey guys,

I’m wondering what I am doing wrong with the DrawPath instruction. For some reason I cannot get the LineJoinTypes.Miter to draw as a sharp point as it should. It is as if it uses the LineJoinTypes.Bevel setting and it ignores the Miter setting.

Here is the code (in the Canvas.Paint event) that I’m using to draw the three different types (Bevel, Miter, Round):

Var gp As new GraphicsPath

gp.MoveToPoint 10, 10
gp.AddLineToPoint 50, 100
gp.AddLineToPoint 90, 10

g.DrawingColor = &c000000
g.PenSize = 10

g.LineJoin = Graphics.LineJoinTypes.Bevel
g.DrawPath gp
g.DrawText "LineJoinTypes.Bevel", 10, 130

g.Translate(200, 0)
g.LineJoin = Graphics.LineJoinTypes.Miter
g.DrawPath gp
g.DrawText "LineJoinTypes.Miter", 10, 130

g.Translate(200, 0)
g.LineJoin = Graphics.LineJoinTypes.Round
g.DrawPath gp
g.DrawText "LineJoinTypes.Round", 10, 130

And here is the screenshot of the output for the code above. As you can see the Miter setting does not have any effect and is not drawing a sharp point as it should (it is drawn as a blunt bevel point). Is there any setting I’m missing to get this to work correctly?

Miter

Thank you in advance for any help.

Version of Xojo: 2021.r3
Windows or Mac: Mac
Version of OS: Mojave

This is what I get and it seems to be correct. In this environment it is sharp.

In your own graphic submission, it does have an effect. The Miter version is a little less blunt than the Bevel version although it is not actually knife sharp.

What are the details of your environment?

Thank you for taking the time to verify Robert.

My environment details are:

Version of Xojo: 2021r3 and 2021r3.1
Windows or Mac: Windows
Version of OS: 10 Pro

So it seems this is a bug on Windows. I will file a feedback case for this.

I don’t see a property in the Graphics object that represents the notion of miter limit, but that’s what is probably being mis-set (or not set at all) on Windows.

You are probably right Eric, thank you for pointing that out.

The first prize fix would be to expose the MiterLimit property so that you do have control over this setting, and can adjust it according to your project’s needs.

But having this setting consistent between Mac and Windows would definitely also be a great enhancement (or least have it on a default setting that creates the sharp points shown in Robert’s screenshot).

I see there is already a case open for the Miter bug.

<https://xojo.com/issue/65491>

I would like to give a big thanks to William Yu… I see this ticket has been tagged as fixed and is waiting verification.

This is going to help me a lot with a project I’m currently working on.

As per request I’ve created a new feature request to expose the MiterLimit property on the Graphics object.

<https://xojo.com/issue/68052>

3 Likes