Return bounding boxes for letters

This commit is contained in:
modest-as
2018-03-30 23:16:54 +01:00
parent ab60a15d4c
commit 564e32e072
15 changed files with 175 additions and 78 deletions

View File

@@ -102,6 +102,17 @@
return new PdfVector(x, y);
}
[Pure]
public PdfRectangle Transform(PdfRectangle original)
{
return new PdfRectangle(
Transform(original.BottomLeft.ToVector()),
Transform(original.BottomLeft.ToVector()),
Transform(original.BottomLeft.ToVector()),
Transform(original.BottomLeft.ToVector())
);
}
public static TransformationMatrix FromValues(decimal a, decimal b, decimal c, decimal d, decimal e, decimal f)
=> FromArray(new[] {a, b, c, d, e, f});
public static TransformationMatrix FromArray(decimal[] values)
@@ -144,6 +155,26 @@
return new TransformationMatrix(result);
}
public TransformationMatrix Multiply(decimal scalar)
{
var result = new decimal[9];
for (int i = 0; i < Rows; i++)
{
for (int j = 0; j < Columns; j++)
{
var index = (i * Rows) + j;
for (int x = 0; x < Rows; x++)
{
result[index] += this[i, x] * scalar;
}
}
}
return new TransformationMatrix(result);
}
public decimal GetScalingFactorX()
{
var xScale = A;