# GraphicsPath axis offset?

**URL:** <https://forum.xojo.com/t/graphicspath-axis-offset/54487>\
**Category:** General\
**Created:** [June 29, 2020, 12:32am UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487 "2020-06-29T00:32:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Jones](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/a88e57/32.png) [@Craig\_Jones](https://forum.xojo.com/u/Craig_Jones)\
**Post date:** [June 29, 2020, 12:32am UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/1 "2020-06-29T00:32:54Z")

</div>

I must be missing something but whenever I try to use a GraphicsPath object, it wants to set y=0 exactly halfway down the canvas. I don’t see this documented anywhere, but I don’t see anybody complaining about it either, which makes me wonder if there is somewhere something I’ve set wrong somehow.

Anyways, simply code in a canvas paint method:

[code]Var gp As New GraphicsPath

g.AntiAlias = True  
//some regular lines  
g.DrawingColor = &cffffff  
g.FillRectangle(5,5,g.Width-10,g.Height-10)  
g.DrawingColor = &c000000  
g.DrawLine(g.Width/2,0,g.Width/2,g.Height)  
g.DrawLine(0,g.Height/2,g.Width,g.Height/2)

//some lines that should be…elsewhere  
g.DrawingColor = &ccc1233  
gp.MoveToPoint(0,0)  
gp.AddLineToPoint(g.width,0)  
gp.AddLineToPoint(g.width,g.Height)  
gp.AddLineToPoint(g.width/2,-g.height/2)  
g.DrawPath gp

//and a rectangle that should outline the fill rectangle above, but doesn’t (for me).  
var g2 as new GraphicsPath  
g2.AddRectangle(5,5,g.Width-10,g.Height-10)  
g.DrawingColor=&cFFAAAA  
g.DrawPath g2  
[/code]

Yields the black lines from the DrawLine calls right in the middle as expected and the filled rectangle inset 5 pixels from all sides, but then the GraphicsPath objects are all halfway down the window.

![](http://cires1.colorado.edu/people/jones.craig/GraphicsPathBug.png)

I presume there is something stupid I have missed, either a document describing this…um, unique… coordinate system, or I have something somewhere that influences GraphicsPaths all on their own. Mac OS Mojave, Xojo 2019R3.1. Thanks for insights.

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [June 29, 2020, 1:40am UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/2 "2020-06-29T01:40:03Z")

</div>

I’d say file a bug report as it definitely looks like something is wrong  
x=0, y=0 is at the left edge half way down which seems really wrong

this is code to draw from the middle to all for corners of a canvas but it makes no sense

```auto
Var gp As New GraphicsPath

g.DrawingColor = &cFFFF0000

gp.MoveToPoint(g.width/2,0)
gp.AddLineToPoint(0,g.height/2)

gp.MoveToPoint(g.width/2,0)
gp.AddLineToPoint(0,-g.height/2)

gp.MoveToPoint(g.width/2,0)
gp.AddLineToPoint(g.width,-g.height/2)

gp.MoveToPoint(g.width/2,0)
gp.AddLineToPoint(g.width,g.height/2)

g.DrawPath gp
```

---

<div class="post-metadata">

**Author:** ![Craig\_Jones](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/a88e57/32.png) [@Craig\_Jones](https://forum.xojo.com/u/Craig_Jones)\
**Post date:** [June 29, 2020, 2:29am UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/3 "2020-06-29T02:29:11Z")

</div>

Thanks for confirming I’m not insane.

Bug report 60769 - Y-axis mislocated for GraphicsPath

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [June 29, 2020, 7:33am UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/4 "2020-06-29T07:33:27Z")

</div>

seems mac specific

---

<div class="post-metadata">

**Author:** ![Craig\_Jones](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/a88e57/32.png) [@Craig\_Jones](https://forum.xojo.com/u/Craig_Jones)\
**Post date:** [June 29, 2020, 7:27pm UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/5 "2020-06-29T19:27:03Z")

</div>

Actually gets crazier. If I now embed this within a pretty standard print wrapper and save as pdf, the Y-axis ends up about 40 points below the regular y=0 position near the top of the page. But x=0 is the very edge of the page while the regular DrawLine calls are honoring margins. (The wrapper, from the reference, if anyone cares

`Var ps As New PrinterSetup
If ps.ShowPageSetupDialog Then
  Var g As Graphics
  g = ps.ShowPrinterDialog()
  If g <> Nil Then
  (code as in original post)`

thought this was going to do nice things for me, but heading back to Object2D stuff while this gets sorted out…

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:28pm UTC](https://forum.xojo.com/t/graphicspath-axis-offset/54487/6 "2021-04-29T16:28:48Z")

</div>


