]> O.S.I.I.S - jp/crow.git/commitdiff
merge step 2
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 2 Aug 2021 12:36:36 +0000 (14:36 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 2 Aug 2021 12:36:36 +0000 (14:36 +0200)
21 files changed:
Crow/src/GraphicBackends/Mono.Cairo/Cairo.cs
Crow/src/GraphicBackends/Mono.Cairo/Context.cs
Crow/src/GraphicBackends/Mono.Cairo/GLSurface.cs
Crow/src/GraphicBackends/Mono.Cairo/ImageSurface.cs
Crow/src/GraphicBackends/Mono.Cairo/Matrix.cs
Crow/src/GraphicBackends/Mono.Cairo/NativeMethods.cs
Crow/src/GraphicBackends/Mono.Cairo/Region.cs
Crow/src/GraphicBackends/Mono.Cairo/Surface.cs
Crow/src/GraphicBackends/vkvg/Context.cs
Crow/src/GraphicBackends/vkvg/Surface.cs
Crow/src/Interface.cs
Crow/src/Widgets/Widget.cs
Directory.Build.props
Samples/DebugLogAnalyzer/src/DbgLogViewer.cs
Samples/DebugLogAnalyzer/src/DebugInterface.cs
Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs
Samples/PathPainter/Painter.cs
Samples/PerfTests/Program.cs
Samples/common/src/SampleBase.cs
Samples/dragNdrop/dragNdrop.cs
unitTests/TestBackend.cs

index 6428304fba1a9e8dc9955bda93c4e42d094c7d6d..309c7f4a51ca85c5ce033c82168a6a865399a6ea 100644 (file)
@@ -39,13 +39,13 @@ namespace Crow.Drawing
        public static class CairoAPI {
                static public int Version {
                        get {
-                               return Cairo.NativeMethods.cairo_version ();
+                               return NativeMethods.cairo_version ();
                        }
                }
 
                static public string VersionString {
                        get {
-                               IntPtr x = Cairo.NativeMethods.cairo_version_string ();
+                               IntPtr x = NativeMethods.cairo_version_string ();
                                return Marshal.PtrToStringAnsi (x);
                        }
                }
index c69a42315a9709f331b6b40eb55fb4d20024d67a..84c5fd403e204c1d740c6a239c06f3b4d8601c72 100644 (file)
@@ -138,7 +138,7 @@ namespace Crow.Drawing {
                        set { NativeMethods.cairo_set_antialias (handle, value); }
                }
 
-               public Cairo.Status Status {
+               public Status Status {
                        get {
                                return NativeMethods.cairo_status (handle);
                        }
@@ -170,7 +170,7 @@ namespace Crow.Drawing {
                        }
                }
 
-               public Cairo.FillRule FillRule {
+               public FillRule FillRule {
                        set {
                                NativeMethods.cairo_set_fill_rule (handle, value);
                        }
@@ -190,7 +190,7 @@ namespace Crow.Drawing {
                        }
                }
 
-               public Cairo.LineCap LineCap {
+               public LineCap LineCap {
                        set {
                                NativeMethods.cairo_set_line_cap (handle, value);
                        }
@@ -200,7 +200,7 @@ namespace Crow.Drawing {
                        }
                }
 
-               public Cairo.LineJoin LineJoin {
+               public LineJoin LineJoin {
                        set {
                                NativeMethods.cairo_set_line_join (handle, value);
                        }
@@ -244,7 +244,7 @@ namespace Crow.Drawing {
                public Pattern GetSource ()
                {
                        var ptr = NativeMethods.cairo_get_source (handle);
-                       return Cairo.Pattern.Lookup (ptr, false);
+                       return Pattern.Lookup (ptr, false);
                }
 
                public double MiterLimit {
@@ -272,7 +272,7 @@ namespace Crow.Drawing {
                }
 
                [Obsolete ("Use GetTarget/SetTarget")]
-               public Cairo.Surface Target {
+               public Surface Target {
                        set {
                                if (handle != IntPtr.Zero)
                                        NativeMethods.cairo_destroy (handle);
@@ -816,21 +816,6 @@ namespace Crow.Drawing {
                        SelectFontFace (family, slant, weight);
                }
 
-               [Obsolete("Use GetFontFace/SetFontFace")]
-               public FontFace ContextFontFace {
-                       get {
-                               return GetContextFontFace ();
-                       }
-                       set {
-                               SetContextFontFace (value);
-                       }
-               }
-
-               public FontFace GetContextFontFace ()
-               {
-                       return Cairo.FontFace.Lookup (NativeMethods.cairo_get_font_face (handle), false);
-               }
-
                public void SetContextFontFace (FontFace value)
                {
                        NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
index 54522f5c39ec7d9fc8f4699865b9a8702b9958fa..33042658a78212b5c325d8d2211465cd48833f88 100644 (file)
@@ -38,7 +38,7 @@ namespace Crow.Drawing {
                public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
                {}
 
-               public GLSurface (Device device, Cairo.Content content, uint tex, int width, int height)
+               public GLSurface (Device device, Content content, uint tex, int width, int height)
                        : base (NativeMethods.cairo_gl_surface_create_for_texture (device.Handle, (uint)content, tex, width, height), true)
                {}
 
index a1a182cae570bef1a5e0226600687bd8afd74c11..283301059dbd5212e783d4647444086b4eb82995 100644 (file)
@@ -49,7 +49,7 @@ namespace Crow.Drawing {
                }
 
                [Obsolete ("Use ImageSurface (byte[] data, Cairo.Format format, int width, int height, int stride)")]
-               public ImageSurface (ref byte[] data, Cairo.Format format, int width, int height, int stride)
+               public ImageSurface (ref byte[] data, Format format, int width, int height, int stride)
                        : this (data, format, width, height, stride)
                {
                }
index fc9f393ffbe9c9cd02f37e964b3049359a7f9309..0224fd5f2d5a3f87964b80035c3dd25bc2245bde 100644 (file)
@@ -114,7 +114,7 @@ namespace Crow.Drawing {
                        NativeMethods.cairo_matrix_rotate (this, radians);
                }
 
-               public Cairo.Status Invert ()
+               public Status Invert ()
                {
                        return NativeMethods.cairo_matrix_invert (this);
                }
index 6bce9f19cca2873d4ec2de60213cf2610d9f4250..f547661eca11500d09f34af71bb3b2746f4033b1 100644 (file)
@@ -270,13 +270,13 @@ namespace Crow.Drawing
 
                #region Image Surface
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height);
+               internal static extern IntPtr cairo_image_surface_create (Format format, int width, int height);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
+               internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Format format, int width, int height, int stride);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
+               internal static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Format format, int width, int height, int stride);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
                internal static extern IntPtr cairo_image_surface_create_from_png  (string filename);
@@ -698,7 +698,7 @@ namespace Crow.Drawing
                internal static extern int cairo_get_dash_count (IntPtr cr);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule);
+               internal static extern void cairo_set_fill_rule (IntPtr cr, FillRule fill_rule);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
                internal static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
@@ -728,7 +728,7 @@ namespace Crow.Drawing
                internal static extern void cairo_set_miter_limit (IntPtr cr, double limit);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op);
+               internal static extern void cairo_set_operator (IntPtr cr, Operator op);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
                internal static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
@@ -774,7 +774,7 @@ namespace Crow.Drawing
 
                #region Surface
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_surface_create_similar (IntPtr surface, Cairo.Content content, int width, int height);
+               internal static extern IntPtr cairo_surface_create_similar (IntPtr surface, Content content, int width, int height);
 
                [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
                internal static extern void cairo_surface_destroy (IntPtr surface);
index efb8e8f058b0c4fe02ab393ebc6d2d86d9477bd1..9cac680bf445a0fab66b0cd80ae37519fc49aeb1 100644 (file)
@@ -198,6 +198,6 @@ namespace Crow.Drawing
                        NativeMethods.cairo_region_destroy (Handle);
                        handle = NativeMethods.cairo_region_create ();                  
                }
-               public bool OverlapOut (Crow.Rectangle rectangle) => Contains (p.Slot) == RegionOverlap.Out;
+               public bool OverlapOut (Crow.Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out;
        }
 }
index 4b31990c8b5e4292e121707d1a33354dac5bb807..10967a93b6f32432fbcf52060224ea444afc8604 100644 (file)
@@ -91,28 +91,28 @@ namespace Crow.Drawing {
                }
 
                [Obsolete ("Use an ImageSurface constructor instead.")]
-               public static Cairo.Surface CreateForImage (
-                       ref byte[] data, Cairo.Format format, int width, int height, int stride)
+               public static Surface CreateForImage (
+                       ref byte[] data, Format format, int width, int height, int stride)
                {
                        IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
                                data, format, width, height, stride);
 
-                       return new Cairo.Surface (p, true);
+                       return new Surface (p, true);
                }
 
                [Obsolete ("Use an ImageSurface constructor instead.")]
-               public static Cairo.Surface CreateForImage (
-                       Cairo.Format format, int width, int height)
+               public static Surface CreateForImage (
+                       Format format, int width, int height)
                {
                        IntPtr p = NativeMethods.cairo_image_surface_create (
                                format, width, height);
 
-                       return new Cairo.Surface (p, true);
+                       return new Surface (p, true);
                }
 
 
-               public Cairo.Surface CreateSimilar (
-                       Cairo.Content content, int width, int height)
+               public Surface CreateSimilar (
+                       Content content, int width, int height)
                {
                        IntPtr p = NativeMethods.cairo_surface_create_similar (
                                this.Handle, content, width, height);
index bf638de3ceb73c45e5635dbff70a18068b08ca93..d8f45611be11e18164ced9bbf3bd9c3e4ab312c0 100644 (file)
@@ -4,6 +4,7 @@
 
 using System;
 using System.Text;
+using System.Linq;
 using Crow;
 
 namespace Crow.Drawing
@@ -104,7 +105,8 @@ namespace Crow.Drawing
                                NativeMethods.vkvg_set_matrix(handle, ref value);
                        }
                }
-               public void ShowText (ReadOnlySpan<char> s, int tabSize) {
+               public void ShowText (string text) => ShowText (text.AsSpan());
+               public void ShowText (ReadOnlySpan<char> s, int tabSize = 4) {
                        int size = s.Length * 4 + 1;
                        Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
                        int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize);
@@ -345,7 +347,14 @@ namespace Crow.Drawing
                        Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
                        return bytes;
                }
-
+               public void SetDash (double [] dashes, double offset = 0) {
+                       if (dashes == null)
+                               NativeMethods.vkvg_set_dash(handle, null, 0, 0);
+                       else {
+                               float[] floats = dashes.Cast<float> ().ToArray ();
+                               NativeMethods.vkvg_set_dash(handle, floats, (uint)dashes.Length, (float)offset);
+                       }
+               }
                public float[] Dashes
                {
                        set
index 654238dbcd19609ca98e77c8634a5b43c210e5fd..6d7321a509fa75c9a2d7ffe6b1f922c5edd01929 100644 (file)
@@ -28,7 +28,11 @@ namespace Crow.Drawing
                        vkvgDev = device;
                        handle = NativeMethods.vkvg_surface_create_from_image (device.Handle, imgPath);
                }
-
+               public Surface (Device device, IntPtr surfHandle) {
+                       vkvgDev = device;
+                       handle = surfHandle;
+                       AddReference ();
+               }
 
                Surface (IntPtr devHandle, int width, int heigth)
                {
index a152e472e1b7b0c50bf5a84311b24b9e833093c4..99187ba73af34aa7aabc45d3faf1947b04c2fdfd 100644 (file)
@@ -326,7 +326,27 @@ namespace Crow
                };
 
                #endregion
-
+               public Surface CreateSurface (ref Rectangle r) {
+#if (VKVG)
+                       return new Surface (vkvgDevice, r.Width, r.Height);
+#else
+                       return surf.CreateSimilar (Content.ColorAlpha, r.Width, r.Height);
+#endif                  
+               }
+               public Surface CreateSurface (int width, int height) {
+#if (VKVG)
+                       return new Surface (vkvgDevice, width, height);
+#else
+                       return surf.CreateSimilar (Content.ColorAlpha, width, height);
+#endif                  
+               }
+               public Surface CreateSurface (IntPtr existingSurfaceHandle) {
+#if (VKVG)
+                       return new Surface (vkvgDevice, existingSurfaceHandle);
+#else
+                       return Surface.Lookup (existingSurfaceHandle, false);                        
+#endif                  
+                               }
                public string WindowTitle {                     
                        set => Glfw3.SetWindowTitle (hWin, value);
                }
@@ -750,7 +770,7 @@ namespace Crow
                                using (ZipArchive archive = ZipFile.Open (Theme, ZipArchiveMode.Read)) {
                                        foreach (ZipArchiveEntry entry in archive.Entries.Where (e => e.FullName.StartsWith ("Images"))) {
                                                Console.WriteLine (entry.FullName);
-                    }
+                                       }
                                        foreach (ZipArchiveEntry entry in archive.Entries.Where (e => e.FullName.StartsWith ("IML"))) {
                                                Console.WriteLine (entry.FullName);
                                        }
@@ -762,7 +782,7 @@ namespace Crow
                void loadThemeStyle () {
                        if (string.IsNullOrEmpty (Theme))
                                return;
-            try {
+                       try {
                                if (Directory.Exists (theme)) {
                                        string stylePath = Directory.GetFiles (theme, "*.style").FirstOrDefault ();
                                        using (Stream s = new FileStream (stylePath, FileMode.Open, FileAccess.Read)) {
@@ -782,7 +802,7 @@ namespace Crow
                                }
                        } catch (Exception e) {
                                throw new Exception ($"[Theme] Error reading theme style ({Theme})", e);
-            }
+                       }
                }
                #endregion
 
@@ -1075,6 +1095,7 @@ namespace Crow
 
                        PerformanceMeasure.Notify ();
                }
+#if VKVG
                void resizeVulkanContext () {
                        vkCtx.WaitIdle();
                        vkCtx.blitSource?.Dispose ();
@@ -1086,8 +1107,8 @@ namespace Crow
                                g.RegisterForLayouting (LayoutingType.All);
 
                        registerRefreshClientRectangle ();
-
                }
+#endif
                /// <summary>Layouting loop, this is the first step of the udpate and process registered
                /// Layouting queue items. Failing LQI's are requeued in this cycle until MaxTry is reached which
                /// trigger an enqueue for the next Update Cycle</summary>
@@ -1096,7 +1117,7 @@ namespace Crow
                                if (LayoutingQueue.Count == 0) {
                                        Monitor.Exit (LayoutMutex);
                                        return;
-                }
+                               }
 
                                DbgLogger.StartEvent (DbgEvtType.ProcessLayouting);
                                PerformanceMeasure.Begin (PerformanceMeasure.Kind.Layouting);
@@ -1147,7 +1168,7 @@ namespace Crow
                        ctx.Fill ();                    
                        ctx.Operator = Operator.Over;                   
                }
-        bool solidBackground = false;
+               bool solidBackground = false;
                public bool SolidBackground {
                        get => solidBackground;
                        set {
@@ -1177,7 +1198,6 @@ namespace Crow
 
                                if (SolidBackground)
                                        clear (ctx);
-                               ctx.Flush();
 #endif
                                
                                for (int i = GraphicTree.Count -1; i >= 0 ; i--){
@@ -1268,7 +1288,7 @@ namespace Crow
                        }
                        /*if (DragAndDropInProgress) {
 
-            }*/
+                       }*/
                        surf.Flush ();
                }
 
@@ -1421,7 +1441,6 @@ namespace Crow
                                clientRectangle = bounds;
 
 #if VKVG
-
 #else
                                switch (Environment.OSVersion.Platform) {
                                case PlatformID.MacOSX:
@@ -1545,23 +1564,23 @@ namespace Crow
 
                                currentCursor?.Dispose ();
                                switch (cursor) {
-                case MouseCursor.arrow:
+                               case MouseCursor.arrow:
                                case MouseCursor.top_left_arrow:
                                        currentCursor = new Cursor (CursorShape.Arrow);
                                        break;
-                case MouseCursor.crosshair:
+                               case MouseCursor.crosshair:
                                        currentCursor = new Cursor (CursorShape.Crosshair);
                                        break;
-                case MouseCursor.hand:
+                               case MouseCursor.hand:
                                        currentCursor = new Cursor (CursorShape.Hand);
                                        break;
-                case MouseCursor.ibeam:
+                               case MouseCursor.ibeam:
                                        currentCursor = new Cursor (CursorShape.IBeam);
                                        break;
-                default:
+                               default:
                                        currentCursor = XCursor.Create (this, cursor);
                                        break;
-                }                                
+                               }                                
                                
                                currentCursor.Set (hWin);
                                //MouseCursorChanged.Raise (this,new MouseCursorChangedEventArgs(cursor));
@@ -1578,8 +1597,8 @@ namespace Crow
                                        dragndropHover = value;
                                } else
                                        HoverWidget = value;
-            }
-        }
+                       }
+               }
                /// <summary>
                /// Ask OS to force the mouse position to the actual coordinate of Interface.MousePosition
                /// </summary>
@@ -1634,7 +1653,7 @@ namespace Crow
                                        
                                        int indexOfTopContainer = GraphicTree.IndexOf (topContainer);
                                        if (indexOfTopContainer != 0) {
-                           for (int i = 0; i < indexOfTopContainer; i++) {//check all top containers that are at a higher level
+                                               for (int i = 0; i < indexOfTopContainer; i++) {//check all top containers that are at a higher level
                                                        //if logical parent of top container is the Interface, that's not a popup.
                                                        if (GraphicTree [i].LogicalParent is Interface) {
                                                                if (GraphicTree [i].MouseIsIn (e.Position)) {
@@ -1762,7 +1781,7 @@ namespace Crow
                                                ActiveWidget = null;
                                        }
                                        return true;
-                   }
+                               }
 
                                if (_activeWidget == null)
                                        return false;
@@ -2067,7 +2086,7 @@ namespace Crow
                public Rectangle ClientRectangle => clientRectangle; 
                public Interface HostContainer => this;
 
-        public Rectangle getSlot () => ClientRectangle;
+               public Rectangle getSlot () => ClientRectangle;
                public void ChildrenLayoutingConstraints(ILayoutable layoutable, ref LayoutingType layoutType){ }
                #endregion
        }
index 245dddf3892d7b94e35f493bf900c787fce8f581..24aaa695567f1ae8b43d2e490414980521163a8d 100644 (file)
@@ -1962,7 +1962,9 @@ namespace Crow
 
                        ctx.SetSource (bmp, rb.X, rb.Y);                        
                        ctx.Paint ();
+#if VKVG
                        ctx.Flush ();
+#endif
                        DbgLogger.EndEvent(DbgEvtType.GOPaintCache);    
                }
                protected virtual void UpdateCache(Context ctx){
index 917e7dfc53c095f66dceb2d91bb99650def8513a..58a32622f04d2912c452c49847d751b5d4c31d04 100644 (file)
@@ -8,11 +8,24 @@
                
                <CrowVersion>0.9.7</CrowVersion>
                <CrowPackageVersion>$(CrowVersion)-beta</CrowPackageVersion>
+
+               <!-- If you dont have a native libstb on your system, enable the managed version of stb here
+                               TODO: this could be detected on startup or install automatically-->
                <CrowStbSharp>true</CrowStbSharp>
+
+               <!-- Compile with logging enabled, this will slow down apps, use this only
+                        for debugging purpose-->
                <CrowDebugLogEnabled>false</CrowDebugLogEnabled>
+
+               <!-- Collect several statistics on widgets-->
                <CrowDebugStatsEnabled>true</CrowDebugStatsEnabled>
+
+               <!-- Used only by CrowIDE and CrowEdit-->
                <CrowDesignModeEnabled>false</CrowDesignModeEnabled>
-               <CrowVkvgBackend>true</CrowVkvgBackend>
+
+               <!-- Experimental vkvg backend, testing only-->
+               <CrowVkvgBackend>false</CrowVkvgBackend>
+
                <GlfwSharpVersion>0.2.12-beta</GlfwSharpVersion>
        </PropertyGroup>
 </Project>
index 086e71520611d40c135b4bda48b8ac2f78aae868..7b91f9f09427c981d56145296f0bc6259eb46eac 100644 (file)
@@ -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)";
 
index d37b07524504a325aba0852df6d022829d360c1d..08927566e092c77afb1d1ce6f68355008b169759 100644 (file)
@@ -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);
index 70c4f9b1db92f582533aadbbb08695ce58ed16a7..8da93de040028c723b1c60db28dfee085f1213b0 100644 (file)
@@ -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;                        
                }
index 7e3c97bbd13b21003adb38b4c9f3ae156fdd20a3..3077aa09a77d7513fedc814b1f631b6f0c4a79e9 100644 (file)
@@ -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 () { }
index 14da072aeff85bb989ade364e0b2b61ae88affe1..dddf30ba3c12d44663153327c90ac5ffb1d3af53 100644 (file)
@@ -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 ();                 
index 9784304a2388c98f27b872071ef852adbd46803c..5b33444ad24fea241bbc294c60e3e8bd94ca0f64 100644 (file)
@@ -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,";
index 9af1c3d3995df5ba27f361e9105a6ee3e4a0562c..4b06326344e9f280a9edcb7c47a9de1fc655bee5 100644 (file)
@@ -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 ();
             }
index 4ad680e8d4b54710a8af77add93b7c5bb2ad3351..44a60cad06516f67bd36b37a4039ffd8300477db 100644 (file)
@@ -12,7 +12,7 @@ namespace unitTests
        {
                public TestInterface (int width = 800, int height = 600)
                        : base (width, height, false, false) {
-                       surf = new Crow.Cairo.ImageSurface (Crow.Cairo.Format.Argb32, ClientRectangle.Width, ClientRectangle.Height);
+                       surf = CreateSurface (ClientRectangle.Width, ClientRectangle.Height);
                }
                bool isRunning;
                public bool IsRunning {