På yggenyk.dk bruger vi cookies til at give dig en god oplevelse og til at indsamle statistik, der kan være med til at forbedre brugeroplevelsen. Hvis du klikker på et link på yggenyk.dk, accepterer du samtidig vores cookiepolitik.

SkiaSharp

From Yggenyk
Revision as of 06:11, 25 March 2018 by WikiSysop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SkiaSharp

Fiddles

Disposable Transform

<syntaxhighlight lang="C#" line='line'>

   using (new Transform(canvas))
   {
   }
   public class Transform : IDisposable
   {
       private readonly SKCanvas _canvas;
       public Transform(SKCanvas canvas)
       {
           _canvas = canvas;
           canvas.Save();
       }
       public void Dispose()
       {
           _canvas.Restore();
       }
   }

</syntaxhighlight >

Transform point from current transformation matrix to original grid

<source lang="cpp">

   // Transform point from current transformation matrix to original grid
   var originalPoints = new[] { new SKPoint(0, 0) };
   var pointInCurrentTransformationMatrix = new[] { new SKPoint(0, 0) };
   canvas.TotalMatrix.MapPoints(originalPoints, pointInCurrentTransformationMatrix);
   // Transform point from original grid to current transformation matrix
   canvas.TotalMatrix.TryInvert(out var inverseMatrix);
   var snappedPixelPointsInCurrentTransformationMatrix = new[] { new SKPoint(0, 0) };
   inverseMatrix.MapPoints(snappedPixelPointsInCurrentTransformationMatrix, originalPoints);

</source>

Typography Line Terms.png

Clipping with Paths and Regions

WPF

id=siteTree