Esempio n. 1
0
    public async Task RectLinearGradient()
    {
      var canvas = Platforms.Current.CreateImageCanvas(new Size(100));

      var rect = new Rect(0, 10, 100, 80);
      var brush = new LinearGradientBrush(
        Point.Zero,
        Point.OneY,
        Colors.Green,
        Colors.LightGray);

      canvas.DrawRectangle(rect, brush: brush);

      await SaveImage(canvas, "Brush.RectLinearGradient.png");
    }
Esempio n. 2
0
    public async Task RectAbsLinearGradient()
    {
      var canvas = Platforms.Current.CreateImageCanvas(new Size(100));

      var rect = new Rect(0, 10, 100, 80);
      var brush = new LinearGradientBrush(
        Point.Zero,
        new Point(0, 200),
        Colors.Yellow,
        Colors.Red);
      brush.Absolute = true;

      canvas.DrawRectangle(rect, brush: brush);

      await SaveImage(canvas, "Brush.RectAbsLinearGradient.png");
    }
Esempio n. 3
0
        private LinearGradientBrush CreateLinearGradientBrush(XElement e)
        {
            var b = new LinearGradientBrush();

            b.Start.X = _valuesParser.ReadNumber(e.Attribute("x1"));
            b.Start.Y = _valuesParser.ReadNumber(e.Attribute("y1"));
            b.End.X = _valuesParser.ReadNumber(e.Attribute("x2"));
            b.End.Y = _valuesParser.ReadNumber(e.Attribute("y2"));

            ReadStops(e, b.Stops);

            return b;
        }