diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 15:07:08 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 15:07:08 +0200 |
| commit | 721fa8de23a9c56396c1df9f012682b7f65775fb (patch) | |
| tree | 52f87a88f9728306fa76806b8d5212b6b44379d4 /src/ExtensionsMethods.cs | |
| parent | 9d0137b1d39e62b09437b6a11e8dcf1318e2a7eb (diff) | |
adjusting stroke position to have sharper lines, ClipToClientRect property
Diffstat (limited to 'src/ExtensionsMethods.cs')
| -rw-r--r-- | src/ExtensionsMethods.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ExtensionsMethods.cs b/src/ExtensionsMethods.cs index 07c37174..d1b951b9 100644 --- a/src/ExtensionsMethods.cs +++ b/src/ExtensionsMethods.cs @@ -26,10 +26,12 @@ namespace Crow public static class ExtensionsMethods { #region Cairo extensions - public static void Rectangle(this Cairo.Context ctx, Rectangle r, bool stroke = false) + public static void Rectangle(this Cairo.Context ctx, Rectangle r, double stroke = 0.0) { - if (stroke) { - ctx.Rectangle (r.X + 0.5, r.Y + 0.5, r.Width - 1.0, r.Height - 1.0); + if (stroke > 0.0) { + ctx.LineWidth = stroke; + double shw = stroke / 2.0; + ctx.Rectangle (r.X + shw, r.Y + shw, r.Width - stroke, r.Height - stroke); ctx.Stroke (); }else ctx.Rectangle (r.X, r.Y, r.Width, r.Height); |