mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
move application of transformation matrix outside path
This commit is contained in:
@@ -52,10 +52,13 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.CurrentPath.BezierCurveTo(ControlPoint1.X, ControlPoint1.Y,
|
||||
ControlPoint2.X, ControlPoint2.Y,
|
||||
End.X, End.Y);
|
||||
operationContext.CurrentPosition = End;
|
||||
var controlPoint1Transform = operationContext.CurrentTransformationMatrix.Transform(ControlPoint1);
|
||||
var controlPoint2Transform = operationContext.CurrentTransformationMatrix.Transform(ControlPoint2);
|
||||
var endTransform = operationContext.CurrentTransformationMatrix.Transform(End);
|
||||
operationContext.CurrentPath.BezierCurveTo(controlPoint1Transform.X, controlPoint1Transform.Y,
|
||||
controlPoint2Transform.X, controlPoint2Transform.Y,
|
||||
endTransform.X, endTransform.Y);
|
||||
operationContext.CurrentPosition = endTransform;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -44,12 +44,14 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.CurrentPath.BezierCurveTo(ControlPoint1.X, ControlPoint1.Y,
|
||||
End.X,
|
||||
End.Y,
|
||||
End.X,
|
||||
End.Y);
|
||||
operationContext.CurrentPosition = End;
|
||||
var controlPoint1Transform = operationContext.CurrentTransformationMatrix.Transform(ControlPoint1);
|
||||
var endTransform = operationContext.CurrentTransformationMatrix.Transform(End);
|
||||
operationContext.CurrentPath.BezierCurveTo(controlPoint1Transform.X, controlPoint1Transform.Y,
|
||||
endTransform.X,
|
||||
endTransform.Y,
|
||||
endTransform.X,
|
||||
endTransform.Y);
|
||||
operationContext.CurrentPosition = endTransform;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -51,7 +51,8 @@
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.BeginSubpath();
|
||||
operationContext.CurrentPath.Rectangle(LowerLeft.X, LowerLeft.Y, Width, Height);
|
||||
var lowerLeftTransform = operationContext.CurrentTransformationMatrix.Transform(LowerLeft);
|
||||
operationContext.CurrentPath.Rectangle(lowerLeftTransform.X, lowerLeftTransform.Y, Width, Height);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -44,13 +44,15 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
var controlPoint2Transform = operationContext.CurrentTransformationMatrix.Transform(ControlPoint2);
|
||||
var endTransform = operationContext.CurrentTransformationMatrix.Transform(End);
|
||||
operationContext.CurrentPath.BezierCurveTo(operationContext.CurrentPosition.X,
|
||||
operationContext.CurrentPosition.Y,
|
||||
ControlPoint2.X,
|
||||
ControlPoint2.Y,
|
||||
End.X,
|
||||
End.Y);
|
||||
operationContext.CurrentPosition = End;
|
||||
controlPoint2Transform.X,
|
||||
controlPoint2Transform.Y,
|
||||
endTransform.X,
|
||||
endTransform.Y);
|
||||
operationContext.CurrentPosition = endTransform;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -35,8 +35,9 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.CurrentPath.LineTo(End.X, End.Y);
|
||||
operationContext.CurrentPosition = End;
|
||||
var endPoint = operationContext.CurrentTransformationMatrix.Transform(new PdfPoint(End.X, End.Y));
|
||||
operationContext.CurrentPath.LineTo(endPoint.X, endPoint.Y);
|
||||
operationContext.CurrentPosition = endPoint;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -36,8 +36,9 @@
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.BeginSubpath();
|
||||
operationContext.CurrentPosition = Point;
|
||||
operationContext.CurrentPath.LineTo(Point.X, Point.Y);
|
||||
var pointTransform = operationContext.CurrentTransformationMatrix.Transform(Point);
|
||||
operationContext.CurrentPosition = pointTransform;
|
||||
operationContext.CurrentPath.MoveTo(pointTransform.X, pointTransform.Y);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
Reference in New Issue
Block a user