예제 #1
0
		public async Task Icon ()
		{
			var size = new Size (64);
			var canvas = Platforms.Current.CreateImageCanvas (size, scale: 2);
			canvas.SaveState ();
			canvas.Scale (size);
			canvas.Translate (1 / 8.0, 0);

			var p = new Path ();
			p.MoveTo (0, 1,false);
			p.LineTo (0, 0, false);
			p.LineTo (0.5, 1, false);
			p.LineTo (0.5, 0,false);

			var colors = new [] {
				"#DCDCDD",
				"#C5C3C6",
				"#46494C",
				"#4C5C68",
				"#68A5E2",
			};
			foreach (var c in colors) {
				p.Pen = new Pen (c, 1 / 4.0);
				p.Draw (canvas);
				canvas.Translate (1 / 16.0, 0);
			}
      await SaveImage (canvas, "Icon.png");
		}
예제 #2
0
 public void TurtleGraphics()
 {
     var p = new Path ();
     p.MoveTo (new Point (100, 200), false);
     p.LineTo (new Point (200, 250));
     p.LineTo (new Point (100, 300));
     p.Close ();
 }
예제 #3
0
        public void Contains()
        {
            var p = new Path ();
            p.MoveTo (new Point (0, 0), false);
            p.LineTo (new Point (100, 0));
            p.LineTo (new Point (100, 50));
            p.Close ();

            Assert.False (p.Contains (new Point (0, 1)));
            Assert.True (p.Contains (new Point (0, 0)));
            Assert.True (p.Contains (new Point (99, 49)));
            Assert.False (p.Contains (new Point (50, 49)));
        }
예제 #4
0
		public async Task TriWithRadGrad ()
		{
			var canvas = Platform.CreateImageCanvas (new Size (100), transparency: true);
			var size = new Size (100);
			var b = new RadialGradientBrush (
				new Point (0.5, 1), new Size(1),
				Colors.Yellow, Colors.Blue);
			var p = new Path ();
			p.MoveTo (0, 0, false);
			p.LineTo (size.Width, 0,false);
			p.LineTo (size.Width / 2, size.Height,false);
			p.Close ();
			p.Brush = b;
			p.Draw (canvas);
      await SaveImage(canvas, "ImageCanvas.TriWithRadGrad");
		}