public static PushedState PushSetTransform(this AP.IDrawingContextImpl context, A.Matrix matrix)
    {
        var oldMatrix = context.Transform;

        context.Transform = matrix;
        return(new PushedState(context, oldMatrix));
    }
示例#2
0
 public PushedState(AP.IDrawingContextImpl context, A.Matrix matrix = default)
 {
     _context = context;
     _matrix  = matrix;
 }
示例#3
0
 public SetTransformDrawCommand(A.Matrix matrix)
 {
     Matrix = matrix;
 }
示例#4
0
 public static PushedState PushPostTransform(this AP.IDrawingContextImpl context, A.Matrix matrix)
 => PushSetTransform(context, context.Transform * matrix);
 /// <summary>
 /// Prepends a scale around the center of provided matrix.
 /// </summary>
 /// <param name="matrix">The matrix to prepend scale.</param>
 /// <param name="scaleX">Scaling factor that is applied along the x-axis.</param>
 /// <param name="scaleY">Scaling factor that is applied along the y-axis.</param>
 /// <param name="centerX">The center X-coordinate of the scaling.</param>
 /// <param name="centerY">The center Y-coordinate of the scaling.</param>
 /// <returns>The created scaling matrix.</returns>
 public static Matrix ScaleAtPrepend(Matrix matrix, double scaleX, double scaleY, double centerX, double centerY)
 {
     return ScaleAt(scaleX, scaleY, centerX, centerY) * matrix;
 }
 /// <summary>
 /// Prepends a translation around the center of provided matrix.
 /// </summary>
 /// <param name="matrix">The matrix to prepend translation.</param>
 /// <param name="offsetX">X-coordinate offset.</param>
 /// <param name="offsetY">Y-coordinate offset.</param>
 /// <returns>The created translation matrix.</returns>
 public static Matrix TranslatePrepend(Matrix matrix, double offsetX, double offsetY)
 {
     return Translate(offsetX, offsetY) * matrix;
 }
 /// <summary>
 /// Transforms a point by this matrix.
 /// </summary>
 /// <param name="matrix">The matrix to use as a transformation matrix.</param>
 /// <param name="point">>The original point to apply the transformation.</param>
 /// <returns>The result of the transformation for the input point.</returns>
 public static Point TransformPoint(Matrix matrix, Point point)
 {
     return new Point(
         (point.X * matrix.M11) + (point.Y * matrix.M21) + matrix.M31,
         (point.X * matrix.M12) + (point.Y * matrix.M22) + matrix.M32);
 }