DrawPolygon deprecated

DrawPolygon will be deprecated but I do not see how to replace it
// now

Var points(6) As Double points(1) = 10 points(2) = 5 points(3) = 40 points(4) = 40 points(5) = 5 points(6) = 60 g.DrawPolygon(points)

// NEW SYSTEM (I tried different approach but does not work, and there is not any exemple on the documentation of DrawPath or GraphicsPath

[code]var path as new GraphicsPath
Var points(6) As Double
points(1) = 10
points(2) = 5
points(3) = 40
points(4) = 40
points(5) = 5
points(6) = 60

path.MoveToPoint(points(1),points(2))
path.MoveToPoint(points(2),points(3))
path.MoveToPoint(points(4),points(5))
path.MoveToPoint(points(5),points(6))
g.DrawPath(path, False) [/code]

either doesn work

[quote]path.MoveToPoint(points(1),points(2))
g.DrawPath(path, False)
path.MoveToPoint(points(3),points(4))
g.DrawPath(path, False)
path.MoveToPoint(points(5),points(6))
g.DrawPath(path, False) [/quote]

DrawPolygon is deprecated - not removed
you can still use it today util such time as

that said moveto point is for moving the “pen” without drawing anything
you probably need a bunch of addlinetopoint calls instead of movetopoint calls

Var path As New GraphicsPath path.MoveToPoint(10, 5) path.AddLineToPoint(40, 40) path.AddLineToPoint(5, 60) g.DrawPath(path, True)

Please note that if you are working with Retina Display on macOS, there is a bug in GraphicsPath that draws the polygon at the wrong position. The bug was fixed in an alpha version of Xojo 2020r1. feedback://showreport?report_id=59334

so the OP should just go back to the old API in use until the new one ships
that is unless updates have broken it as well

Hmm, can you break a perpetual beta?

I am somewhat confused by drawing polygons or lines for that matter with

GraphicsPath

vs

Object2D

GraphicsPath is the new kid on the block but I don’t quite see in many cases what advantage it has. If you were trying to draw polygons, why wouldn’t you be using the 2D Object FigureShape?

It seems to me that many (? most) things that you could draw with GraphicsPath are basically equivalent to creating an Object2D or a collection of Object2D (Group2D) and drawing them to the canvas.

I am confused by GraphicsPath. The documentation contains few examples. Why is it so great?

Probably build from a far better Library.

Worst: it is not even obvious (no auto complete here *) how to set a Pen Color.

I wanted to explorate it, then save the result, but… API2 strikes again :frowning:

Sorry, I was not helpful.

PS: the generated Arc Angle was nice.

  • Not even for the Canvas (API2 newly created project, saved on disk).