public override void AddColorStop(object backend, double position, Xwt.Drawing.Color color) { GradientInfo gr = (GradientInfo)backend; gr.Colors.Add(color.ToCGColor()); gr.Stops.Add((float)position); }
internal static void Draw (CGContext ctx, GradientInfo gradient) { ctx.SaveState (); ctx.Clip (); using (var cg = new CGGradient (Util.DeviceRGBColorSpace, gradient.Colors.ToArray (), gradient.Stops.ToArray ())) { if (gradient.Linear) ctx.DrawLinearGradient (cg, gradient.Start, gradient.End, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation); else ctx.DrawRadialGradient (cg, gradient.Start, gradient.StartRadius, gradient.End, gradient.EndRadius, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation); } ctx.RestoreState (); }
internal static void Draw(CGContext ctx, GradientInfo gradient) { ctx.SaveState(); ctx.Clip(); using (var cg = new CGGradient(Util.DeviceRGBColorSpace, gradient.Colors.ToArray(), gradient.Stops.ToArray())) { if (gradient.Linear) { ctx.DrawLinearGradient(cg, gradient.Start, gradient.End, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation); } else { ctx.DrawRadialGradient(cg, gradient.Start, gradient.StartRadius, gradient.End, gradient.EndRadius, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation); } } ctx.RestoreState(); }
public void Fill(object backend) { ContextInfo ctx = (ContextInfo)backend; if (ctx.Pattern is Gradient) { GradientInfo gr = (GradientInfo)WidgetRegistry.GetBackend(ctx.Pattern); NSGradient g = new NSGradient(gr.Colors.ToArray(), gr.Stops.ToArray()); g.DrawInBezierPath(ctx.Path, 0f); } else { ctx.Path.Fill(); } ctx.Pattern = null; ctx.Path.Dispose(); ctx.Path = new NSBezierPath(); }
public void Fill(object backend) { var ctx = GetContext(backend); if (ctx.Pattern is GradientInfo) { GradientInfo gr = (GradientInfo)ctx.Pattern; NSGradient g = new NSGradient(gr.Colors.ToArray(), gr.Stops.ToArray()); g.DrawInBezierPath(ctx.Path, 0f); } else if (ctx.Pattern is NSColor) { NSColor col = (NSColor)ctx.Pattern; col.Set(); col.SetFill(); } else { ctx.Path.Fill(); } ctx.Pattern = null; ctx.Path.Dispose(); ctx.Path = new NSBezierPath(); }