diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 06:43:59 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 06:43:59 +0200 |
| commit | 9d0137b1d39e62b09437b6a11e8dcf1318e2a7eb (patch) | |
| tree | 6f34808a56eb5562bdfd5306ec2ad74c935d964b /src/Cairo | |
| parent | 854f2f732acc4c1d9fa4126962149cae14f4d4e9 (diff) | |
* Crow.csproj, XCursor.cs, Interface.cs, ibeam:
text xcursor
* Window.template, Expandable.template, TabView.cs, 0.crow:
divers
* ExtensionsMethods.cs, CairoHelpers.cs, Border.cs:
stroke better alignment, should be reworked for different width
* Label.cs:
text xcursor, selection rectangles adjustments
* Window.cs:
Maximize
Diffstat (limited to 'src/Cairo')
| -rw-r--r-- | src/Cairo/CairoHelpers.cs | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/Cairo/CairoHelpers.cs b/src/Cairo/CairoHelpers.cs index 60852def..8f9e6325 100644 --- a/src/Cairo/CairoHelpers.cs +++ b/src/Cairo/CairoHelpers.cs @@ -31,24 +31,24 @@ namespace Crow return arr[minp]; } - public static void CairoRectangle(Cairo.Context gr, Rectangle r, double radius) + public static void CairoRectangle(Cairo.Context gr, Rectangle r, double radius, bool stroke = false) { - if (radius>0) - CairoHelpers.DrawRoundedRectangle(gr,r,radius); + if (radius > 0) + CairoHelpers.DrawRoundedRectangle (gr, r, radius, stroke); else - gr.Rectangle (r); + gr.Rectangle (r, stroke); } public static void CairoCircle(Cairo.Context gr, Rectangle r) { gr.Arc(r.X + r.Width/2, r.Y + r.Height/2, Math.Min(r.Width,r.Height)/2, 0, 2*Math.PI); } - public static void DrawRoundedRectangle(Cairo.Context gr, Rectangle r, double radius) + public static void DrawRoundedRectangle(Cairo.Context gr, Rectangle r, double radius, bool stroke = false) { - DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius); - } - public static void DrawCurvedRectangle(Cairo.Context gr, Rectangle r) - { - DrawCurvedRectangle(gr, r.X, r.Y, r.Width, r.Height); + if (stroke) { + DrawRoundedRectangle (gr, r.X + 0.5, r.Y + 0.5, r.Width - 1.0, r.Height - 1.0, radius); + gr.Stroke (); + }else + DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius); } public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y, double width, double height, double radius) { @@ -68,16 +68,6 @@ namespace Crow gr.ClosePath(); gr.Restore(); } - public static void DrawCurvedRectangle(Cairo.Context gr, double x, double y, double width, double height) - { - gr.Save(); - gr.MoveTo(x, y + height / 2); - gr.CurveTo(x, y, x, y, x + width / 2, y); - gr.CurveTo(x + width, y, x + width, y, x + width, y + height / 2); - gr.CurveTo(x + width, y + height, x + width, y + height, x + width / 2, y + height); - gr.CurveTo(x, y + height, x, y + height, x, y + height / 2); - gr.Restore(); - } public static void StrokeRaisedRectangle(Cairo.Context gr, Rectangle r, double width = 1) { gr.Save(); |