예제 #1
0
 /// <summary>
 /// Appends the given path onto the current path.
 /// </summary>
 /// <param name='p'>
 /// The path to append.
 /// </param>
 public void AppendPath(DrawingPath p)
 {
     if (p is Context)
         throw new NotSupportedException ("Can't directly append a Context object to a path");
     if (!(handler is VectorImageRecorderContextHandler) && (p.Backend is VectorBackend)) {
         var c = (VectorBackend)p.Backend;
         ToolkitEngine.VectorImageRecorderContextHandler.Draw (handler, Backend, c.ToVectorImageData ());
     } else {
         handler.AppendPath (Backend, p.Backend);
     }
 }
예제 #2
0
 /// <summary>
 /// Appends the given path onto the current path.
 /// </summary>
 /// <param name='p'>
 /// The path to append.
 /// </param>
 public void AppendPath(DrawingPath p)
 {
     if (p is Context)
     {
         throw new NotSupportedException("Can't directly append a Context object to a path");
     }
     if (!(handler is VectorImageRecorderContextHandler) && (p.Backend is VectorBackend))
     {
         var c = (VectorBackend)p.Backend;
         ToolkitEngine.VectorImageRecorderContextHandler.Draw(handler, Backend, c.ToVectorImageData());
     }
     else
     {
         handler.AppendPath(Backend, p.Backend);
     }
 }
예제 #3
0
 void DrawGradientButton(Xwt.Drawing.Context G, GradientButton B)
 {
     DrawingPath P = new DrawingPath();
     P.Rectangle(new Xwt.Rectangle(B.Position, B.Size));
     LinearGradient gr;
     G.AppendPath(P);
     Pattern pat = gr = new LinearGradient(B.Position.X, B.Position.Y, B.Position.X + B.Size.Width, B.Position.Y + B.Size.Height);
     gr.AddColorStop(0, B.Color.BlendWith(Colors.White, 0.8));
     gr.AddColorStop(0.5, B.Color);
     gr.AddColorStop(1, B.Color.BlendWith(Colors.White, 0.8));
     G.Pattern = pat;
     G.Fill();
     G.AppendPath(P);
     G.SetColor(Xwt.Drawing.Colors.Black);
     G.SetLineWidth(1);
     G.Stroke();
     TextLayout L = new TextLayout()
     {
         Font = B.Font,
         Text = B.Text
     };
     Size TextSize = new Size(0.6 * L.Font.Size * L.Text.Count(), L.Font.Size);
     G.DrawTextLayout(L, new Xwt.Point(B.Position.X + B.Size.Width / 2 - TextSize.Width / 2, B.Position.Y + B.Size.Height / 2 - TextSize.Height / 2));
 }
예제 #4
0
		public void Path (Context ctx, double px, double py)
		{
			ctx.Save ();
			ctx.Translate (px, py);

			var path = new DrawingPath ();

			path.MoveTo (0.44, 18);
			path.LineTo (-1, 18);
			path.LineTo (-1, 26);
			path.LineTo (0.44, 26);
			path.LineTo (0, 42);
			path.LineTo (29, 21.98);
			path.LineTo (29, 21.98);
			path.LineTo (0, 2);
			path.LineTo (0.44, 18);

			ctx.AppendPath (path);
			ctx.SetColor (Colors.Black);
			ctx.SetLineWidth (2);
			ctx.Stroke ();

			var path2 = path.CopyPath ();

			path2.LineTo (15, 8);
			path2.ClosePath ();

			ctx.Rotate (180);
			ctx.AppendPath (path2);
			ctx.SetColor (Colors.Red);
			ctx.SetLineDash (0, 5);
			ctx.Stroke ();

			ctx.Restore ();
		}
예제 #5
0
 public void DrawPathTwoTimes()
 {
     InitBlank (50, 50);
     var p = new DrawingPath ();
     p.Rectangle (15, 15, 20, 20);
     p.Rectangle (20, 20, 10, 10);
     context.AppendPath (p);
     context.Stroke ();
     context.Rotate (15);
     context.AppendPath (p);
     context.Stroke ();
     CheckImage ("DrawPathTwoTimes.png");
 }
예제 #6
0
 public void DrawingPathPointInFill()
 {
     DrawingPath p = new DrawingPath ();
     p.Rectangle (10, 10, 20, 20);
     Assert.IsTrue (p.IsPointInFill (15, 15));
     Assert.IsFalse (p.IsPointInFill (9, 9));
 }
예제 #7
0
파일: DrawingPath.cs 프로젝트: garuma/xwt
 /// <summary>
 /// Appends the given path onto the current path.
 /// </summary>
 /// <param name='p'>
 /// The path to append.
 /// </param>
 public void AppendPath(DrawingPath p)
 {
     handler.AppendPath (Backend, p.Backend);
 }