From f00eb5efa23b63dac45a221710cb61051addbff0 Mon Sep 17 00:00:00 2001 From: vadik299 Date: Tue, 7 Jan 2020 00:23:10 -0500 Subject: [PATCH] Update AppendRectangle.cs (fix) Rectangle width and height should be also transformed by CurrentTransformationMatrix --- .../Operations/PathConstruction/AppendRectangle.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs b/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs index 6276a8d5..5a88bcd9 100644 --- a/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs +++ b/src/UglyToad.PdfPig/Graphics/Operations/PathConstruction/AppendRectangle.cs @@ -57,9 +57,13 @@ public void Run(IOperationContext operationContext) { var lowerLeft = new PdfPoint(LowerLeftX, LowerLeftY); + var upperRight = new PdfPoint(LowerLeftX + Width, LowerLeftY + Height); + operationContext.BeginSubpath(); var lowerLeftTransform = operationContext.CurrentTransformationMatrix.Transform(lowerLeft); - operationContext.CurrentPath.Rectangle(lowerLeftTransform.X, lowerLeftTransform.Y, (double)Width, (double)Height); + var upperRightTransform = operationContext.CurrentTransformationMatrix.Transform(upperRight); + + operationContext.CurrentPath.Rectangle(lowerLeftTransform.X, lowerLeftTransform.Y, upperRightTransform.X - lowerLeftTransform.X, upperRightTransform.Y - lowerLeftTransform.Y); } /// @@ -83,4 +87,4 @@ return $"{LowerLeftX} {LowerLeftY} {Width} {Height} {Symbol}"; } } -} \ No newline at end of file +}