RoundRectShape corner antialiasing

I’m trying to get a RoundRectShape to look good but the corners’ antialiasing just does not look right.

I added the code below to a canvas’ Paint() event within an empty window, and the result looks terrible. I tried changing cornerWidth and cornerHeight to different values but they still look quite awful.

Any ideas?

  Dim margin as Double
  Dim originX, originY as Double
  
  originX = 0
  originY = 0
  
  Dim r as New RoundRectShape
  
  r.width=me.Width - (2 * margin)
  r.height=me.Height - (2 * margin)
  r.X = r.width / 2
  r.Y = r.height / 2
  r.border=100
  r.bordercolor=RGB(52,170,220)
  r.fillcolor=RGB(255,255,255)
  r.cornerHeight=20
  r.cornerWidth=20
  r.borderwidth=2
  g.DrawObject r,originX + margin,originY + margin

try Graphics.FillRoundRect and Graphics.DrawRoundRect.

  Dim margin as Double
  Dim originX, originY as Double
  
  originX = 0
  originY = 0
  
  g.ForeColor = RGB(255,255,255)
  g.FillRoundRect(0, 0, me.Width - (2 * margin), me.Height - (2 * margin), 20, 20)
  
  g.ForeColor = RGB(52,170,220)
  g.PenHeight = 2
  g.PenWidth = 2
  g.DrawRoundRect(0, 0, me.Width - (2 * margin), me.Height - (2 * margin), 20, 20)

It actually is anti-aliased, just anti-aliasing a mangled shape. Use a Slider (with livescroll on) to adjust corner radius and zoom in (option-command-+). The shape of the line dents and bulges as you drag, like the coordinates of the arc path are being clamped to integers. I’ve run into other wiggles like this with Object2D and instead always use Graphics and/or CoreGraphics declares where it’s never wrinkled.

Thank you both!