Esempio n. 1
0
		public BrushSection()
		{
			var layout = new DynamicLayout();
			brush = solidBrush = Brushes.LightSkyBlue;
			gradientBrush = new LinearGradientBrush(Colors.AliceBlue, Colors.Black, new PointF(0, 0), new PointF(100f, 100f));
			//gradientBrush = new LinearGradientBrush (new RectangleF (0, 0, 50, 50), Colors.AliceBlue, Colors.Black, 10);
			gradientBrush.Wrap = GradientWrapMode.Repeat;
			textureBrush = new TextureBrush(image, 0.5f);
			brush = textureBrush;

			ScaleX = 100f;
			ScaleY = 100f;

			drawable = new Drawable { Size = new Size(300, 200) };

			drawable.Paint += (sender, pe) => Draw(pe.Graphics);

			layout.AddSeparateRow(null, BrushControl(), UseBackgroundColorControl(), null);
			if (Platform.Supports<NumericUpDown>())
			{
				matrixRow = layout.AddSeparateRow(null, new Label { Text = "Rot" }, RotationControl(), new Label { Text = "Sx" }, ScaleXControl(), new Label { Text = "Sy" }, ScaleYControl(), new Label { Text = "Ox" }, OffsetXControl(), new Label { Text = "Oy" }, OffsetYControl(), null);
				matrixRow.Table.Visible = false;
			}
			gradientRow = layout.AddSeparateRow(null, GradientWrapControl(), null);
			gradientRow.Table.Visible = false;
			layout.AddSeparateRow(null, drawable, null);
			layout.Add(null);

			this.Content = layout;
		}
		public GradientWrapMode GetGradientWrap (LinearGradientBrush widget)
		{
			var gradient = ((Cairo.LinearGradient)widget.ControlObject);
			// return gradient.Extend.ToEto ();
			return cairo_pattern_get_extend (gradient.Pointer).ToEto ();
		}
		public void SetTransform (LinearGradientBrush widget, IMatrix transform)
		{
			((EtoGradient)widget.ControlObject).Transform = transform.ToCairo ();
		}
		public IMatrix GetTransform (LinearGradientBrush widget)
		{
			return ((EtoGradient)widget.ControlObject).Transform.ToEto ();
		}
Esempio n. 5
0
		public void SetGradientWrap(LinearGradientBrush widget, GradientWrapMode gradientWrap)
		{
			throw new NotImplementedException();
		}
Esempio n. 6
0
		public GradientWrapMode GetGradientWrap(LinearGradientBrush widget)
		{
			throw new NotImplementedException();
		}
Esempio n. 7
0
		public void SetTransform(LinearGradientBrush widget, IMatrix transform)
		{
			throw new NotImplementedException();
		}
Esempio n. 8
0
		public GradientWrapMode GetGradientWrap (LinearGradientBrush widget)
		{
			return ((Cairo.LinearGradient)widget.ControlObject).Extend.ToEto();
		}
Esempio n. 9
0
		public void SetGradientWrap(LinearGradientBrush widget, GradientWrapMode gradientWrap)
		{
			((BrushObject)widget.ControlObject).Wrap = gradientWrap;
		}
Esempio n. 10
0
		public GradientWrapMode GetGradientWrap(LinearGradientBrush widget)
		{
			return ((BrushObject)widget.ControlObject).Wrap;
		}
Esempio n. 11
0
		public void SetTransform(LinearGradientBrush widget, IMatrix transform)
		{
			((BrushObject)widget.ControlObject).Transform = transform;
		}
Esempio n. 12
0
		public IMatrix GetTransform(LinearGradientBrush widget)
		{
			return ((BrushObject)widget.ControlObject).Transform;
		}
Esempio n. 13
0
		public void SetGradientWrap (LinearGradientBrush widget, GradientWrapMode gradientWrap)
		{
			var gradient = ((Cairo.LinearGradient)widget.ControlObject);
			gradient.Extend = gradientWrap.ToCairo ();
		}
		public void SetGradientWrap (LinearGradientBrush widget, GradientWrapMode gradientWrap)
		{
			var gradient = ((Cairo.LinearGradient)widget.ControlObject);
			// gradient.Extend = gradientWrap.ToCairo ();
			cairo_pattern_set_extend (gradient.Pointer, gradientWrap.ToCairo ());
		}
Esempio n. 15
0
		public IMatrix GetTransform(LinearGradientBrush widget)
		{
			throw new NotImplementedException();
		}
Esempio n. 16
0
		public TextureBrushesSection2()
		{
			image = TestIcons.Textures;
			var drawable = new BufferedDrawable();
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };
			layout.AddSeparateRow(null, drawable.Checkbox(), null);
			layout.Add(drawable);
			this.Content = layout;

			var w = image.Size.Width / 3; // same as height
			var img = image.Clone(new Rectangle(w, w, w, w));
			var textureBrush = new TextureBrush(img);
			var solidBrush = new SolidBrush(Colors.Blue);
			var linearGradientBrush = new LinearGradientBrush(Colors.White, Colors.Black, PointF.Empty, new PointF(0, 100));
			var font = SystemFonts.Default();
			drawable.BackgroundColor = Colors.Green;
			drawable.MouseMove += HandleMouseMove;
			drawable.MouseDown += HandleMouseMove;

			drawable.Paint += (s, e) =>
			{
				var graphics = e.Graphics;
				graphics.DrawText(font, Colors.White, 3, 3, "Move the mouse in this area to move the shapes.");
				// texture brushes
				var temp = location;
				DrawShapes(textureBrush, temp, img.Size, graphics);
				// solid brushes
				temp = temp + new PointF(200, 0);
				DrawShapes(solidBrush, temp, img.Size, graphics);
				// linear gradient brushes
				temp = temp + new PointF(200, 0);
				DrawShapes(linearGradientBrush, temp, img.Size, graphics);
			};
		}
Esempio n. 17
0
		Control Tools(int n)
		{
			var stack = new StackLayout
			{
				BackgroundColor = Colors.Transparent,
				Orientation = Orientation.Horizontal,
				VerticalContentAlignment = VerticalAlignment.Center,
				Padding = 4,
				Spacing = 4,
			};
			if (n > 0)
			{
				stack.Items.Add("Label:");
				for (int i = 0; i < n; i++)
				{
					stack.Items.Add(new TextBox
					{
						Text = "Box" + ( i + 1 )
					});
				}
			}
			var control = new Drawable
			{
				Content = stack
			};
			control.Paint += (s, pe) =>
			{
				int w = control.Width;
				int h = control.Height;
				var c1 = Color.FromGrayscale(0.8f);
				var c2 = Color.FromGrayscale(0.6f);
				using (var b = new LinearGradientBrush(
					c1, c2, new PointF(1, 0), new PointF(1, h)))
					pe.Graphics.FillRectangle(b, 1, 0, w-2, h);
				pe.Graphics.DrawLine(c1, 0, 0, 0, h);
				pe.Graphics.DrawLine(c2, w-1, 0, w-1, h);
			};
			return control;
		}