title: Performance improvement on rendering - WinUi 3
body: <p>I am working on .Net MAUI and new to native rendering. I am trying to render a line with stroke width based on the touch dragged velocity. For this, I have calculated Bezier points with stroke width and stored calculated points and rendered repeatedly for each interaction. This results in performance issues on higher point counts. Since we don't have bitmap support on MAUI yet, I have raised <a href="https://github.com/dotnet/maui/issues/4094" rel="nofollow noreferrer">feature request</a> for the same and this was considered MAUI team. To overcome this for now, I have moved to native rendering for android, windows and ios platforms.</p>
  <p>For Android, I have drawn the points on bitmap parallelly and rendered the existing bitmap to the view on each interaction. So this lets canvas draw the bitmap alone at invalidate. This saves lots of work on rendering.</p>
  <p>Now for WinUI 3, I have tried the following cases but it is not efficient as Android,</p>
  <ul>
  <li><p>We cannot add segments, since the width of the line needs to be increased linearly bases on velocity.</p>
  </li>
  <li><p>Tried creating a writablebitmap, and modified easy pixel on rendering as below.</p>
  <p><code>image = new Image(); </code></p>
  <p><code>bitmap = new WriteableBitmap((int)Width, (int)Height);</code></p>
  <p><code>image.Height  this.Height;</code></p>
  <p><code>image.Width = this.Width; </code></p>
  <p><code>image.Source = bitmap; </code></p>
  <p><code>stream = fastRenderSurface.PixelBuffer.AsStream(); </code></p>
  <p><code>buffer = new byte[(int)(this.Width) * (int)(this.Height) * 4];</code></p>
  <p><code>grid.Childern.Add(image);</code></p>
  <p>Used the pixel buffer and manipulated pixels for rendering points but the line is aliased.</p>
  </li>
  <li><p>I have referred existing SignaturePad samples in windows and xamarin which is achieved using InkPresenter. But we don't have support for InkPresenter control in WinUi-3.</p>
  </li>
  </ul>
  <p>I think the possible solution is to draw points on bitmap using W2DCanvas session available here, but we don't have direct API's here like Android.
  Can anyone suggest me how to render on bitmap using session or is there any other possible solution to approach this?.</p>
  <p>Thanks.</p>