public void SaveRestoreRadialGradient() { // Pattern is saved InitBlank (); var g = new RadialGradient (20, 20, 5, 30, 30, 30); g.AddColorStop (0, Colors.Red); g.AddColorStop (0.5, Colors.Green); g.AddColorStop (1, Colors.Blue); context.Save (); context.Pattern = g; context.Restore (); context.Rectangle (5, 5, 40, 40); context.Fill (); CheckImage ("SaveRestoreRadialGradient.png"); }
protected override void OnDraw (Xwt.Drawing.Context ctx, Rectangle dirtyRect) { if (Bounds.IsEmpty) return; ctx.Rectangle (0, 0, Bounds.Width, Bounds.Height); Gradient g = null; if (Linear) g = new LinearGradient (xStart, 0, xEnd, Bounds.Height); else g = new RadialGradient (Bounds.Width / 2, Bounds.Height / 2, Bounds.Width / 2, Bounds.Width / 2, Bounds.Height / 2, xStart/4 + Bounds.Width / 8); g.AddColorStop (0, stop1); g.AddColorStop (1, stop2); ctx.Pattern = g; ctx.Fill (); Rectangle r = rect.Inflate (5, 5); ctx.Rectangle (r); ctx.SetColor (new Color (0,0,1)); ctx.SetLineWidth (1); ctx.Stroke (); }
public void RadialGradientSmall() { InitBlank (); var g = new RadialGradient (5, 5, 5, 30, 30, 15); g.AddColorStop (0, Colors.Red); g.AddColorStop (0.5, Colors.Green); g.AddColorStop (1, Colors.Blue); context.Rectangle (5, 5, 40, 40); context.Pattern = g; context.Fill (); CheckImage ("RadialGradientSmall.png"); }
RadialGradient GetCornerGradient(double x, double y, double radius, double thickness) { var gradient = new RadialGradient (x, y, radius - thickness, x, y, radius + thickness); gradient.AddColorStop (0, BackgroundColor); gradient.AddColorStop (1, GetColor (BackgroundColor, 0.75)); return gradient; }