protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect) { base.OnDraw(ctx, dirtyRect); //ctx.SetColor(PluginType.GetColor()); ctx.SetLineDash(0, 4d, 4d); ctx.Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height); ctx.Stroke(); }
protected override void OnDraw(Xwt.Drawing.Context ctx) { base.OnDraw (ctx); ctx.SetLineDash (15, 10, 10, 5, 5); ctx.Rectangle (100, 100, 100, 100); ctx.Stroke (); ctx.SetLineDash (0); ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32); ib.Context.Arc (15, 15, 15, 0, 360); ib.Context.SetColor (new Color (1, 0, 1)); ib.Context.Rectangle (0, 0, 5, 5); ib.Context.Fill (); var img = ib.ToImage (); ctx.DrawImage (img, 90, 90); ctx.DrawImage (img, 90, 140, 50, 10); ctx.Arc (190, 190, 15, 0, 360); ctx.SetColor (new Color (1, 0, 1, 0.4)); ctx.Fill (); ctx.Save (); ctx.Translate (90, 220); ctx.Pattern = new ImagePattern (img); ctx.Rectangle (0, 0, 100, 70); ctx.Fill (); ctx.Restore (); ctx.Translate (30, 30); double end = 270; for (double n = 0; n<=end; n += 5) { ctx.Save (); ctx.Rotate (n); ctx.MoveTo (0, 0); ctx.RelLineTo (30, 0); double c = n / end; ctx.SetColor (new Color (c, c, c)); ctx.Stroke (); ctx.Restore (); } }
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect) { base.OnDraw(ctx, dirtyRect); if (HasBorder) { ctx.SetColor(PluginType.GetColor()); ctx.SetLineWidth(1); if (HasBorderLineDash) ctx.SetLineDash(0, 4d, 4d); ctx.Rectangle(0, 0, WidthRequest, HeightRequest); ctx.Stroke(); } }
private void DrawLine(Xwt.Drawing.Color c, BorderStyleEnum bs, float w, Xwt.Drawing.Context g, double x, double y, double x2, double y2) { if (bs == BorderStyleEnum.None //|| c.IsEmpty || w <= 0) // nothing to draw return; g.Save(); // Pen p = null; // p = new Pen(c, w); g.SetColor(c); g.SetLineWidth(w); switch (bs) { case BorderStyleEnum.Dashed: // p.DashStyle = DashStyle.Dash; g.SetLineDash(0.0, new double[] { 2, 1 }); break; case BorderStyleEnum.Dotted: // p.DashStyle = DashStyle.Dot; g.SetLineDash(0.0, new double[] { 1 }); break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: g.SetLineDash(0.0, new double[] { }); break; } g.MoveTo(x, y); g.LineTo(x2, y2); g.Stroke(); g.Restore(); }
protected override void OnDraw(Xwt.Drawing.Context ctx) { base.OnDraw (ctx); // Simple rectangles ctx.SetLineWidth (1); ctx.Rectangle (100, 5, 10, 10); ctx.SetColor (Color.Black); ctx.Fill (); ctx.Rectangle (115, 5, 10, 10); ctx.SetColor (Color.Black); ctx.Stroke (); // ctx.SetLineWidth (3); ctx.Rectangle (100, 20, 10, 10); ctx.SetColor (Color.Black); ctx.Fill (); ctx.Rectangle (115, 20, 10, 10); ctx.SetColor (Color.Black); ctx.Stroke (); // Rectangle with hole ctx.Rectangle (10, 100, 40, 40); ctx.MoveTo (45, 135); ctx.RelLineTo (0, -20); ctx.RelLineTo (-20, 0); ctx.RelLineTo (0, 20); ctx.ClosePath (); ctx.SetColor (Color.Black); ctx.Fill (); // Dashed lines ctx.SetLineDash (15, 10, 10, 5, 5); ctx.Rectangle (100, 100, 100, 100); ctx.Stroke (); ctx.SetLineDash (0); ImageBuilder ib = new ImageBuilder (30, 30, ImageFormat.ARGB32); ib.Context.Arc (15, 15, 15, 0, 360); ib.Context.SetColor (new Color (1, 0, 1)); ib.Context.Rectangle (0, 0, 5, 5); ib.Context.Fill (); var img = ib.ToImage (); ctx.DrawImage (img, 90, 90); ctx.DrawImage (img, 90, 140, 50, 10); ctx.Arc (190, 190, 15, 0, 360); ctx.SetColor (new Color (1, 0, 1, 0.4)); ctx.Fill (); ctx.Save (); ctx.Translate (90, 220); ctx.Pattern = new ImagePattern (img); ctx.Rectangle (0, 0, 100, 70); ctx.Fill (); ctx.Restore (); ctx.Translate (30, 30); double end = 270; for (double n = 0; n<=end; n += 5) { ctx.Save (); ctx.Rotate (n); ctx.MoveTo (0, 0); ctx.RelLineTo (30, 0); double c = n / end; ctx.SetColor (new Color (c, c, c)); ctx.Stroke (); ctx.Restore (); } ctx.ResetTransform (); }
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect) { //bg //ctx.SetColor(installed ? BgColorInstalled : BgColorUninstalled); //ctx.SetColor(Disabled ? Colors.Gray.WithAlpha(.15) : (installed ? PluginType.GetBGColor() : Colors.White)); ctx.SetColor(installed ? PluginType.GetBGColor() : Colors.White); //ctx.SetColor(Colors.White); ctx.Rectangle(dirtyRect); ctx.Fill(); //border //ctx.SetColor(installed ? BorderColorInstalled : BorderColorUninstalled); //ctx.SetColor(installed ? PluginType.GetColor() : Colors.White); // Color.FromBytes(220, 220, 220)); ctx.SetColor(SettingsActive ? Colors.Gray : PluginType.GetColor()); ctx.SetLineWidth(1); if (!installed) ctx.SetLineDash(0, 1, 3); ctx.Rectangle(0, 0, WidthRequest, HeightRequest); ctx.Stroke(); //if (Disabled) //{ // ctx.SetColor(new Color(1, .5, 0, .1)); // ctx.Rectangle(dirtyRect); // ctx.Fill(); //} }