diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-08-02 14:36:36 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-08-02 14:36:36 +0200 |
| commit | d65351d324043f7c9d74f6dcf966ea40792017a5 (patch) | |
| tree | 31915006ecee0c90c6deb3fa898d7e2b81b5ec3f /Samples | |
| parent | 85190e474cae0a87e29755c156140cd29c85cbb5 (diff) | |
merge step 2
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/DbgLogViewer.cs | 21 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/DebugInterface.cs | 6 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 4 | ||||
| -rw-r--r-- | Samples/PathPainter/Painter.cs | 14 | ||||
| -rw-r--r-- | Samples/PerfTests/Program.cs | 2 | ||||
| -rw-r--r-- | Samples/common/src/SampleBase.cs | 2 | ||||
| -rw-r--r-- | Samples/dragNdrop/dragNdrop.cs | 6 |
7 files changed, 25 insertions, 30 deletions
diff --git a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs index 086e7152..7b91f9f0 100644 --- a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs +++ b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs @@ -1,18 +1,15 @@ -using System.Diagnostics; -using System.Runtime.InteropServices.ComTypes; -// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> +// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; using System.ComponentModel; -using System.IO; using System.Linq; using System.Threading.Tasks; using Crow.Drawing; using Crow.DebugLogger; -using DebugLogAnalyzer; +using System.Diagnostics; namespace Crow { @@ -194,9 +191,7 @@ namespace Crow set { base.Font = value; using (Context gr = new Context (IFace.surf)) { - gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); - gr.SetFontSize (Font.Size); - + setFontForContext (gr); fe = gr.FontExtents; } updateMargins (); @@ -262,7 +257,7 @@ namespace Crow } DbgEvtType currentFilter; - protected override void onDraw (Cairo.Context gr) + protected override void onDraw (Context gr) { base.onDraw (gr); @@ -346,7 +341,7 @@ namespace Crow } string ticksToMS(long ticks) => Math.Round ((double)ticks / Stopwatch.Frequency * 1000.0, 2).ToString(); - public override void Paint (Cairo.Context ctx) + public override void Paint (Context ctx) { base.Paint (ctx); @@ -386,7 +381,7 @@ namespace Crow ctx.MoveTo (ctxR.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); ctx.ShowText (str); - ctx.Operator = Cairo.Operator.Add; + ctx.Operator = Operator.Add; if (hoverLine >= 0) { double y = fe.Height * (hoverLine - ScrollY) + topMargin + cb.Top; @@ -413,7 +408,7 @@ namespace Crow } if (selStart < 0 || selEnd < 0) { - ctx.Operator = Cairo.Operator.Over; + ctx.Operator = Operator.Over; return; } double selStartX = (double)(selStart - ScrollX - minTicks) * xScale + leftMargin + cb.Left; @@ -432,7 +427,7 @@ namespace Crow ctx.SetSource (0.0,0.2,0.8,0.15); //ctx.SetSource (Colors.Jet); ctx.Fill(); - ctx.Operator = Cairo.Operator.Over; + ctx.Operator = Operator.Over; str = $"{ticksToMS(Math.Abs (selEnd - selStart))} (ms)"; diff --git a/Samples/DebugLogAnalyzer/src/DebugInterface.cs b/Samples/DebugLogAnalyzer/src/DebugInterface.cs index d37b0752..08927566 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterface.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterface.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> +// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) @@ -18,7 +18,7 @@ namespace Crow public DebugInterface (IntPtr hWin) : base (hWin) { SolidBackground = false; - surf = new ImageSurface (Format.Argb32, 100, 100); + surf = CreateSurface (100, 100); } public override void Run() @@ -125,7 +125,7 @@ namespace Crow lock (UpdateMutex) { clientRectangle = new Rectangle (0, 0, width, height); surf?.Dispose(); - surf = new ImageSurface (Format.Argb32, width, height); + surf = CreateSurface (width, height); foreach (Widget g in GraphicTree) g.RegisterForLayouting (LayoutingType.All); RegisterClip (clientRectangle); diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index 70c4f9b1..8da93de0 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -377,9 +377,9 @@ namespace Crow if (initialized) { delResize (Slot.Width, Slot.Height); - bmp = Crow.Cairo.Surface.Lookup (delGetSurfacePointer(), false); + bmp = IFace.CreateSurface (delGetSurfacePointer()); } else - bmp = IFace.surf.CreateSimilar (Content.ColorAlpha, Slot.Width, Slot.Height); + bmp = IFace.CreateSurface (Slot.Width, Slot.Height); IsDirty = false; } diff --git a/Samples/PathPainter/Painter.cs b/Samples/PathPainter/Painter.cs index 7e3c97bb..3077aa09 100644 --- a/Samples/PathPainter/Painter.cs +++ b/Samples/PathPainter/Painter.cs @@ -1,13 +1,13 @@ -using Crow.Cairo; -using System; -using System.Collections; -using System.Collections.Generic; +// Copyright (c) 2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com> +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using Crow.Drawing; using System.ComponentModel; -using System.Text; namespace Crow -{ - public class Painter : ScrollingObject +{ + public class Painter : ScrollingObject { #region CTOR protected Painter () { } diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs index 14da072a..dddf30ba 100644 --- a/Samples/PerfTests/Program.cs +++ b/Samples/PerfTests/Program.cs @@ -164,7 +164,7 @@ namespace PerfTests if (screenOutput) initSurface (); else - surf = new Crow.Cairo.ImageSurface (Crow.Cairo.Format.Argb32, ClientRectangle.Width, ClientRectangle.Height); + surf = CreateSurface (ClientRectangle.Width, ClientRectangle.Height); initDictionaries (); loadStyling (); diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 9784304a..5b33444a 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -87,7 +87,7 @@ namespace Samples public int intValue = 500; VerticalAlignment currentVAlign; - DirectoryInfo curDir = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); + DirectoryInfo curDir = new DirectoryInfo(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); public FileSystemInfo[] CurDirectory => curDir.GetFileSystemInfos(); public string MultilineText = $"Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit. Sed non risus.\n\nSuspendisse lectus tortor,\nLorem ipsum dolor sit amet,\nconsectetur adipiscing elit. Sed non risus.\n\nSuspendisse lectus tortor,"; diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs index 9af1c3d3..4b063263 100644 --- a/Samples/dragNdrop/dragNdrop.cs +++ b/Samples/dragNdrop/dragNdrop.cs @@ -1,5 +1,6 @@ using Crow; using Samples; +using Crow.Drawing; namespace tests { @@ -29,9 +30,8 @@ namespace tests Rectangle r = e.DragSource.LastPaintedSlot; startGroup = e.DragSource.Parent as Group; - Crow.Cairo.Surface dragImg = surf.CreateSimilar (Crow.Cairo.Content.ColorAlpha, - r.Width, r.Height); - using (Crow.Cairo.Context gr = new Crow.Cairo.Context(dragImg)) { + Surface dragImg = CreateSurface (ref r); + using (Context gr = new Context(dragImg)) { gr.SetSource (e.DragSource.bmp, 0, 0); gr.Paint (); } |