title: Direct2D drawing arc missing pixels and irritating antialiasing
body: <p>When drawing arcs with pathgeometry and arc segments in d2d there are some glitches compared to other frameworks. I have created a zoomed version from a arc drawn with d2d and with wpf <a href="https://i.stack.imgur.com/ELPCp.png" rel="nofollow noreferrer">wpf vs d2d</a>. I have marked the areas which are imho not drawn correctly in direct2d. Does somebody know what caused such drawings?</p>
  
  <p>Sample code (SharpDX):</p>
  
  <pre><code>private static void TestRender(WindowRenderTarget renderTarget)
  {
      var geo = new PathGeometry(d2dFactory);
      var sink = geo.Open();
  
      Vector2 off = new Vector2(40.0f, 70.0f);
      var arc_1 = new ArcSegment()
      {
          ArcSize = ArcSize.Small,
          RotationAngle = 0,
          Point = off,
          Size = new Size2F(22, 22),
          SweepDirection = SweepDirection.CounterClockwise
      };
  
      sink.BeginFigure(new SharpDX.Mathematics.Interop.RawVector2(84, 70), FigureBegin.Filled);
      sink.AddArc(arc_1);
      sink.EndFigure(FigureEnd.Open);
  
      sink.Close();
  
      StrokeStyle strokeStyle = new StrokeStyle(d2dFactory, new StrokeStyleProperties()
      {
          DashCap = CapStyle.Flat,
          DashStyle = DashStyle.Solid,
          LineJoin = LineJoin.Miter,
          StartCap = CapStyle.Flat,
          EndCap = CapStyle.Flat,
          MiterLimit = 0,
          DashOffset = 0
      }, new float[0]);
  
      var testBrush = new SharpDX.Direct2D1.SolidColorBrush(
          renderTarget,
          new SharpDX.Mathematics.Interop.RawColor4(1.0f, 0.0f, 0.0f, 1.0f),
          new SharpDX.Direct2D1.BrushProperties
          {
              Opacity = 1.0f,
          }
      );
  
      renderTarget.DrawGeometry(geo, testBrush, 10, strokeStyle);
      geo.Dispose();
      sink.Dispose();
  
  }        
  </code></pre>
  
  <p>After digging a bit i have found that if i shift the starting point a half "pixel" in the y direction everything looks good. Question for me is now how to programmaticaly determine which coordinates needs to be transformed.
  Furthermore i wonder how wpf is doing this. I know about UseLayoutRounding and SnapToPixels. I'm interested how they (MS) are doing that for the various shapes.</p>