/// <summary> /// Draws a rectangle. /// </summary> /// <param name="rect">The rectangle to draw.</param> /// <param name="fill">The fill color. If set to <c>OxyColors.Undefined</c>, the rectangle will not be filled.</param> /// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the rectangle will not be stroked.</param> /// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param> public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness) { if (fill.IsVisible()) { Context.Save(); Context.Rectangle(rect.ToXwtRect(false)); Context.SetColor(fill.ToXwtColor()); Context.Fill(); Context.Restore(); } if (stroke.IsVisible() && thickness > 0) { Context.Save(); Context.SetColor(stroke.ToXwtColor()); Context.SetLineWidth(thickness); Context.Rectangle(rect.ToXwtRect(false)); Context.Stroke(); Context.Restore(); } }
/// <summary> /// Draws a rectangle. /// </summary> /// <param name="rect">The rectangle to draw.</param> /// <param name="fill">The fill color. If set to <c>OxyColors.Undefined</c>, the rectangle will not be filled.</param> /// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the rectangle will not be stroked.</param> /// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param> public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness) { if (fill.IsVisible ()) { Context.Save (); Context.Rectangle (rect.ToXwtRect (false)); Context.SetColor (fill.ToXwtColor ()); Context.Fill (); Context.Restore (); } if (stroke.IsVisible () && thickness > 0) { Context.Save (); Context.SetColor (stroke.ToXwtColor ()); Context.SetLineWidth (thickness); Context.Rectangle (rect.ToXwtRect (false)); Context.Stroke (); Context.Restore (); } }