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"); }
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"); }
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; }