public void FillRectangle(Brush brush, float x, float y, float width, float height) { StartDrawing(); brush.Apply(this); Control.FillRect(TranslateView(new CGRect(x, y, width, height), width > 1 || height > 1, true)); EndDrawing(); }
public void FillRectangle(Brush brush, float x, float y, float width, float height) { Control.Rectangle(x + inverseoffset, y + inverseoffset, width, height); Control.Save(); brush.Apply(this); Control.Restore(); }
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { SetOffset(true); Control.Save(); Control.Translate(x + width / 2, y + height / 2); double radius = Math.Max(width / 2.0, height / 2.0); if (width > height) { Control.Scale(1.0, height / width); } else { Control.Scale(width / height, 1.0); } if (sweepAngle < 0) { Control.ArcNegative(0, 0, radius, Conversions.DegreesToRadians(startAngle), Conversions.DegreesToRadians(startAngle + sweepAngle)); } else { Control.Arc(0, 0, radius, Conversions.DegreesToRadians(startAngle), Conversions.DegreesToRadians(startAngle + sweepAngle)); } Control.LineTo(0, 0); Control.Restore(); Control.Save(); brush.Apply(this); Control.Fill(); Control.Restore(); }
public void FillRectangle(Brush brush, float x, float y, float width, float height) { SetOffset(true); Control.Rectangle(x, y, width, height); Control.Save(); brush.Apply(this); Control.Restore(); }
public void FillPath(Brush brush, IGraphicsPath path) { SetOffset(true); Control.Save(); path.Apply(Control); Control.FillRule = path.FillMode.ToCairo(); brush.Apply(this); Control.Restore(); }
public void FillPath(Brush brush, IGraphicsPath path) { Control.Save(); Control.Translate(inverseoffset, inverseoffset); path.Apply(Control); Control.Restore(); Control.Save(); Control.FillRule = path.FillMode.ToCairo(); brush.Apply(this); Control.Restore(); }
public void Apply(Cairo.Context context) { context.LineWidth = Thickness; context.LineCap = LineCap; context.LineJoin = LineJoin; if (cairodashes != null) { context.SetDash(cairodashes, cairooffset); } context.MiterLimit = MiterLimit; Brush.Apply(context); }
public void Apply(GraphicsHandler graphics) { graphics.Control.LineWidth = Thickness; graphics.Control.LineCap = LineCap; graphics.Control.LineJoin = LineJoin; if (cairodashes != null) { graphics.Control.SetDash(cairodashes, cairooffset); } graphics.Control.MiterLimit = MiterLimit; Brush.Apply(graphics); }
public void FillEllipse(Brush brush, float x, float y, float width, float height) { StartDrawing(); /* if (width == 1 || height == 1) * { * DrawLine(color, x, y, x+width-1, y+height-1); * return; * }*/ brush.Apply(this); Control.FillEllipseInRect(TranslateView(new CGRect(x, y, width, height), true, true)); EndDrawing(); }
public void DrawText(Font font, Brush brush, float x, float y, string text) { var oldAA = AntiAlias; AntiAlias = true; SetOffset(false); using (var layout = CreateLayout()) { font.Apply(layout); layout.SetText(text); Control.Save(); brush.Apply(this); Control.MoveTo(x, y); Pango.CairoHelper.LayoutPath(Control, layout); Control.Fill(); Control.Restore(); } AntiAlias = oldAA; }
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { StartDrawing(); var rect = TranslateView(new CGRect(x, y, width, height), true, true); brush.Apply(this); var yscale = rect.Height / rect.Width; var centerY = rect.GetMidY(); var centerX = rect.GetMidX(); Control.ConcatCTM(new CGAffineTransform(1.0f, 0, 0, yscale, 0, centerY - centerY * yscale)); Control.MoveTo(centerX, centerY); Control.AddArc(centerX, centerY, rect.Width / 2, Conversions.DegreesToRadians(startAngle), Conversions.DegreesToRadians(startAngle + sweepAngle), sweepAngle < 0); Control.AddLineToPoint(centerX, centerY); Control.ClosePath(); Control.FillPath(); EndDrawing(); }
public void FillEllipse(Brush brush, float x, float y, float width, float height) { Control.Save(); Control.Translate(x + width / 2 + inverseoffset, y + height / 2 + inverseoffset); double radius = Math.Max(width / 2.0, height / 2.0); if (width > height) { Control.Scale(1.0, height / width); } else { Control.Scale(width / height, 1.0); } Control.Arc(0, 0, radius, 0, 2 * Math.PI); Control.Restore(); Control.Save(); brush.Apply(this); Control.Restore(); }
public void FillPath(Brush brush, IGraphicsPath path) { StartDrawing(); Control.TranslateCTM(inverseoffset, inverseoffset); Control.BeginPath(); Control.AddPath(path.ToCG()); Control.ClosePath(); brush.Apply(this); switch (path.FillMode) { case FillMode.Alternate: Control.EOFillPath(); break; case FillMode.Winding: Control.FillPath(); break; default: throw new NotSupportedException(); } EndDrawing(); }
public void FillEllipse(Brush brush, float x, float y, float width, float height) { StartDrawing(); /* if (width == 1 || height == 1) { DrawLine(color, x, y, x+width-1, y+height-1); return; }*/ brush.Apply(this); Control.FillEllipseInRect(TranslateView(new CGRect(x, y, width, height), true, true)); EndDrawing(); }
public static void Apply(this Brush brush, GraphicsHandler graphics) => brush.Apply(graphics.Control);