|
@@ -1,4 +1,5 @@
|
|
|
-using QuestPDF.Infrastructure;
|
|
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using QuestPDF.Infrastructure;
|
|
|
using QuestPDF.Skia;
|
|
using QuestPDF.Skia;
|
|
|
using QuestPDF.Skia.Text;
|
|
using QuestPDF.Skia.Text;
|
|
|
|
|
|
|
@@ -6,6 +7,13 @@ namespace QuestPDF.Drawing
|
|
|
{
|
|
{
|
|
|
internal sealed class FreeCanvas : ICanvas, IRenderingCanvas
|
|
internal sealed class FreeCanvas : ICanvas, IRenderingCanvas
|
|
|
{
|
|
{
|
|
|
|
|
+ #region Internal State
|
|
|
|
|
+
|
|
|
|
|
+ private Stack<CanvasMatrix> MatrixStack { get; set; } = new();
|
|
|
|
|
+ private CanvasMatrix Matrix { get; set; } = new();
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
#region IRenderingCanvas
|
|
#region IRenderingCanvas
|
|
|
|
|
|
|
|
public bool DocumentContentHasLayoutOverflowIssues { get; set; }
|
|
public bool DocumentContentHasLayoutOverflowIssues { get; set; }
|
|
@@ -41,17 +49,17 @@ namespace QuestPDF.Drawing
|
|
|
|
|
|
|
|
public void Save()
|
|
public void Save()
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ MatrixStack.Push(Matrix);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void Restore()
|
|
public void Restore()
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ Matrix = MatrixStack.Pop();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void Translate(Position vector)
|
|
public void Translate(Position vector)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ Matrix = Matrix.Translate(vector.X, vector.Y);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void DrawFilledRectangle(Position vector, Size size, Color color)
|
|
public void DrawFilledRectangle(Position vector, Size size, Color color)
|
|
@@ -121,12 +129,17 @@ namespace QuestPDF.Drawing
|
|
|
|
|
|
|
|
public void Rotate(float angle)
|
|
public void Rotate(float angle)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ Matrix = Matrix.Rotate(angle);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void Scale(float scaleX, float scaleY)
|
|
public void Scale(float scaleX, float scaleY)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ Matrix = Matrix.Scale(scaleX, scaleY);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public CanvasMatrix GetCurrentMatrix()
|
|
|
|
|
+ {
|
|
|
|
|
+ return Matrix;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|