public static System.Windows.Media.Transform GetTransform(Transform trans)
 {
     return(new MatrixTransform()
     {
         Matrix = new Matrix(trans.A, trans.B, trans.C, trans.D, trans.E, trans.F)
     });
 }
Beispiel #2
0
		public Graphic TransformGeometry (Transform transform)
		{
			var clone = Clone ();
			clone.Children.Clear ();
			clone.Children.AddRange (Children.Select (x => x.TransformGeometry (transform)));
			return clone;
		}
Beispiel #3
0
		public override Element TransformGeometry (Transform transform)
		{
			var clone = (Group)Clone ();
			clone.Transform = Transform.Identity;
			var tt = transform * Transform;
			clone.Children.Clear ();
			clone.Children.AddRange (Children.Select (x => x.TransformGeometry (tt)));
			return clone;
		}
Beispiel #4
0
		public override Element TransformGeometry (Transform transform)
		{
			var p = new Path ();
			base.SetCloneData (p);
			p.Transform = Transform.Identity;
			p.MoveTo (frame.TopLeft);
			p.LineTo (frame.BottomLeft);
			p.LineTo (frame.BottomRight);
			p.LineTo (frame.TopRight);
			p.Close ();
			var tp = p.TransformGeometry (transform * Transform);
			return tp;
		}
        /// <summary>
        /// Transforms
        /// </summary>
        /// <param name="transform"></param>
        public void Transform(NGraphics.Transform transform)
        {
            //var t = transform;
            //var stack = new Stack<NGraphics.Transform>();
            //while (t != null)
            //{
            //    stack.Push(t);
            //    t = t.Previous;
            //}

            //var transforms = new TransformGroup();

            //while (stack.Count > 0)
            //{
            //    t = stack.Pop();

            //    var rt = t as Rotate;
            //    if (rt != null)
            //    {
            //        var rotate = new RotateTransform();
            //        rotate.Angle = rt.Angle;
            //        transforms.Children.Add(rotate);
            //        continue;
            //    }
            //    var st = t as Scale;
            //    if (st != null)
            //    {
            //        var scale = new ScaleTransform();
            //        scale.ScaleX = st.Size.Width;
            //        scale.ScaleY = st.Size.Height;
            //        transforms.Children.Add(scale);
            //        continue;
            //    }
            //    var tt = t as Translate;
            //    if (tt != null)
            //    {
            //        var translate = new TranslateTransform();
            //        translate.X = tt.Size.Width;
            //        translate.Y = tt.Size.Height;
            //        transforms.Children.Add(translate);
            //        continue;
            //    }

            //    throw new NotSupportedException("Transform " + t);
            //}

            //Canvas.RenderTransform = transforms;
        }
Beispiel #6
0
 public void Transform(Transform transform)
 {
     throw new NotImplementedException ();
 }
Beispiel #7
0
		Transform ReadTransform (string raw)
		{
			if (string.IsNullOrWhiteSpace (raw))
				return Transform.Identity;

			var s = raw.Trim ();

			var calls = s.Split (new[]{ ')' }, StringSplitOptions.RemoveEmptyEntries);

			var t = Transform.Identity;

			foreach (var c in calls) {
				var args = c.Split (new[]{ '(', ',', ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
				var nt = Transform.Identity;
				switch (args [0]) {
				case "matrix":
					if (args.Length == 7) {
						nt = new Transform (
							ReadNumber(args[1]), 
							ReadNumber(args[2]),
							ReadNumber(args[3]),
							ReadNumber(args[4]),
							ReadNumber(args[5]),
							ReadNumber(args[6]));
					} else {
						throw new NotSupportedException ("Matrices are expected to have 6 elements, this one has " + (args.Length - 1));
					}
					break;
				case "translate":
					if (args.Length >= 3) {
						nt = Transform.Translate (new Size (ReadNumber (args [1]), ReadNumber (args [2])));
					} else if (args.Length >= 2) {
						nt = Transform.Translate (new Size (ReadNumber (args[1]), 0));
					}
					break;
				case "scale":
					if (args.Length >= 3) {
						nt = Transform.Scale (new Size (ReadNumber (args[1]), ReadNumber (args[2])));
					} else if (args.Length >= 2) {
						var sx = ReadNumber (args [1]);
						nt = Transform.Scale (new Size (sx, sx));
					}
					break;
				case "rotate":
					var a = ReadNumber (args [1]);
					if (args.Length >= 4) {
						var x = ReadNumber (args [2]);
						var y = ReadNumber (args [3]);
						var t1 = Transform.Translate (new Size (x, y));
						var t2 = Transform.Rotate (a);
						var t3 = Transform.Translate (new Size (-x, -y));
						nt = t1 * t2 * t3;
					} else {
						nt = Transform.Rotate (a);
					}
					break;
				default:
					throw new NotSupportedException ("Can't transform " + args[0]);
				}
				t = t * nt;
			}

			return t;
		}
Beispiel #8
0
		public override Element TransformGeometry (Transform transform)
		{
			var e = (Ellipse)Clone ();
			e.frame = transform.TransformRect (frame);
			return e;
		}
Beispiel #9
0
		public abstract Element TransformGeometry (Transform transform);
Beispiel #10
0
		public void Transform (Transform transform)
		{
			var state = stateStack.Peek ();
			state.Transform = state.Transform * transform;
		}
		public override Element TransformGeometry (Transform transform)
		{
			var frame = new Rect (pos, size);
			var tframe = transform.TransformRect (frame);
			return new ForeignObject (tframe.TopLeft, tframe.Size);
		}
Beispiel #12
0
		public override void TransformGeometry (Point prevPoint, Transform transform)
		{
		}
Beispiel #13
0
 public void Transform(Transform transform)
 {
     var t = new Matrix ();
     t.SetValues (new[] {
         (float)transform.A, (float)transform.C, (float)transform.E,
         (float)transform.B, (float)transform.D, (float)transform.F,
         0, 0, 1,
     });
     graphics.Concat(t);
 }
Beispiel #14
0
		public override void TransformGeometry (Point prevPoint, Transform transform)
		{
			throw new NotSupportedException ();
		}
		public void Transform (Transform transform)
		{
			var t = states.Pop ();
			var nt = t * transform;
			states.Push (nt);
		}
Beispiel #16
0
		public override void TransformGeometry (Point prevPoint, Transform transform)
		{
			Point = transform.TransformPoint (Point);
		}
Beispiel #17
0
		public override Element TransformGeometry (Transform transform)
		{
			var clone = (Path)Clone ();

			var tt = transform * Transform;

			clone.Transform = Transform.Identity;

			var startPoint = Point.Zero;
			var prevPoint = startPoint;

			foreach (var op in clone.Operations) {
				if (op is MoveTo) {
					startPoint = transform.TransformPoint (op.EndPoint);
				}
				op.TransformGeometry (prevPoint, tt);
				prevPoint = op.GetEndPoint (startPoint);
			}

			return clone;
		}
Beispiel #18
0
 public void Transform(Transform transform)
 {
     var currentTx = renderTarget.Transform;
     var tx = new Matrix3x2 (
         (float)transform.A, (float)transform.B,
         (float)transform.C, (float)transform.D,
         (float)transform.E, (float)transform.F);
     renderTarget.Transform = tx * currentTx;
 }
Beispiel #19
0
		public abstract void TransformGeometry (Point prevPoint, Transform transform);
Beispiel #20
0
 public void Transform(Transform transform)
 {
     context.ConcatCTM (new CGAffineTransform (
         (nfloat)transform.A, (nfloat)transform.B,
         (nfloat)transform.C, (nfloat)transform.D,
         (nfloat)transform.E, (nfloat)transform.F));
 }
Beispiel #21
0
		public override void TransformGeometry (Point prevPoint, Transform transform)
		{
			Point = transform.TransformPoint (Point);
			Control1 = transform.TransformPoint (Control1);
			Control2 = transform.TransformPoint (Control2);
		}
 public static System.Windows.Media.Transform GetTransform(Transform trans)
 {
     return new MatrixTransform()
     {
         Matrix = new Matrix(trans.A, trans.B, trans.C, trans.D, trans.E, trans.F)
     };
 }
		public void Transform (Transform transform)
		{
			var currentTx = renderTarget.Transform;
            var tx = new Matrix3x2 ();
            tx.M11 = (float)transform.A;
            tx.M12 = (float)transform.B;
            tx.M21 = (float)transform.C;
            tx.M22 = (float)transform.D;
            tx.M31 = (float)transform.E;
            tx.M32 = (float)transform.F;
			renderTarget.Transform = tx * currentTx;
		}
 public void Transform(Transform transform)
 {
 }
Beispiel #25
0
 public virtual void Transform(Transform transform)
 {
     NextCanvas.Transform (transform);
 }
 public void Transform(Transform transform)
 {
     try {
         graphics.MultiplyTransform (new Matrix (
             (float)transform.A, (float)transform.B,
             (float)transform.C, (float)transform.D,
             (float)transform.E, (float)transform.F), MatrixOrder.Prepend);
     }
     catch (Exception ex) {
         Console.WriteLine (ex);
     }
 }
Beispiel #27
0
		public override Element TransformGeometry (Transform transform)
		{
			throw new NotImplementedException ();
		}