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

      var rect = new Rect(0, 10, 100, 80);
      var brush = new RadialGradientBrush(
        new Point(0.5, 0.5),
        new Size(0.5, 0.125),
        Colors.Green,
        Colors.LightGray);

      canvas.DrawEllipse(rect, brush: brush);

      await SaveImage(canvas, "Brush.EllipseRadialGradient.png");
    }
Ejemplo n.º 2
0
        RadialGradientBrush CreateRadialGradientBrush(XElement e)
        {
            var b = new RadialGradientBrush();

            b.Center.X = _valuesParser.ReadNumber(e.Attribute("cx"));
            b.Center.Y = _valuesParser.ReadNumber(e.Attribute("cy"));
            b.Focus.X = _valuesParser.ReadNumber(e.Attribute("fx"));
            b.Focus.Y = _valuesParser.ReadNumber(e.Attribute("fy"));
            var r = _valuesParser.ReadNumber(e.Attribute("r"));
            b.Radius = new Size(r);

            ReadStops(e, b.Stops);

            return b;
        }