From d396c47e492aa7badcfefba41c36c516558fb1ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Tue, 23 Nov 2021 02:23:24 +0100 Subject: [PATCH] save commit, Drawing2D shared lib --- Backends/CairoBackend/CairoBackend.csproj | 15 ++ .../CairoBackend/src}/Cairo.cs | 0 .../CairoBackend/src}/CairoDebug.cs | 0 .../CairoBackend/src}/Content.cs | 1 - .../CairoBackend/src}/Context.cs | 17 +- .../CairoBackend/src}/DRMDevice.cs | 0 .../CairoBackend/src}/DRMSurface.cs | 0 .../CairoBackend/src}/Device.cs | 0 .../CairoBackend/src}/DirectFBSurface.cs | 0 .../CairoBackend/src}/Distance.cs | 0 .../CairoBackend/src}/EGLDevice.cs | 0 .../CairoBackend/src}/Extend.cs | 0 .../CairoBackend/src}/FillRule.cs | 0 .../CairoBackend/src}/Filter.cs | 0 .../CairoBackend/src}/FontExtents.cs | 14 +- .../CairoBackend/src}/FontFace.cs | 0 .../CairoBackend/src}/FontOptions.cs | 0 .../CairoBackend/src}/FontSlant.cs | 0 .../CairoBackend/src}/FontType.cs | 0 .../CairoBackend/src}/FontWeight.cs | 0 .../CairoBackend/src}/GLSurface.cs | 0 .../CairoBackend/src}/GLXDevice.cs | 0 .../CairoBackend/src}/GlitzSurface.cs | 0 .../CairoBackend/src}/Glyph.cs | 0 .../CairoBackend/src}/Gradient.cs | 0 .../CairoBackend/src}/HintMetrics.cs | 0 .../CairoBackend/src}/HintStyle.cs | 0 .../CairoBackend/src}/ImageSurface.cs | 0 .../CairoBackend/src}/LineCap.cs | 0 .../CairoBackend/src}/LineJoin.cs | 0 .../CairoBackend/src}/LinearGradient.cs | 1 + .../CairoBackend/src}/Matrix.cs | 0 .../CairoBackend/src}/MeshPattern.cs | 1 + .../src}/NativeMethods-internal.cs | 0 .../CairoBackend/src}/NativeMethods.cs | 17 +- .../CairoBackend/src}/PSSurface.cs | 0 .../CairoBackend/src}/Path.cs | 0 .../CairoBackend/src}/Pattern.cs | 0 .../CairoBackend/src}/PatternType.cs | 0 .../CairoBackend/src}/PdfSurface.cs | 0 .../CairoBackend/src}/RadialGradient.cs | 0 .../CairoBackend/src}/Region.cs | 25 +-- .../CairoBackend/src}/ScaledFont.cs | 0 .../CairoBackend/src}/SolidPattern.cs | 0 .../CairoBackend/src}/Status.cs | 0 .../CairoBackend/src}/SubpixelOrder.cs | 0 .../CairoBackend/src}/Surface.cs | 5 +- .../CairoBackend/src}/SurfacePattern.cs | 0 .../CairoBackend/src}/SurfaceType.cs | 0 .../CairoBackend/src}/SvgSurface.cs | 0 .../CairoBackend/src}/SvgVersion.cs | 0 .../CairoBackend/src}/TextExtents.cs | 0 .../CairoBackend/src}/WGLDevice.cs | 0 .../CairoBackend/src}/Win32Surface.cs | 0 .../CairoBackend/src}/XcbSurface.cs | 0 .../CairoBackend/src}/XlibSurface.cs | 0 .../CairoBackend/src}/rsvg/SvgHandle.cs | 1 + Backends/VkvgBackend/VkvgBackend.csproj | 15 ++ .../VkvgBackend/src}/Context.cs | 14 +- .../VkvgBackend/src}/Device.cs | 0 .../VkvgBackend/src}/Gradient.cs | 0 .../VkvgBackend/src}/Matrix.cs | 0 .../VkvgBackend/src}/NativeMethods.cs | 0 .../VkvgBackend/src}/Pattern.cs | 0 .../VkvgBackend/src}/Surface.cs | 0 .../VkvgBackend/src}/SvgHandle.cs | 0 .../VkvgBackend/src}/TextRun.cs | 0 .../VkvgBackend/src}/VulkanContext.cs | 12 +- .../VkvgBackend/src}/tmp/FontOptions.cs | 0 .../VkvgBackend/src}/tmp/Region.cs | 6 +- Crow.sln | 15 ++ Crow/Crow.csproj | 13 +- Crow/src/2d/RectangleD.cs | 166 ------------------ Crow/src/Cairo/CairoHelpers.cs | 18 +- Crow/src/DebugUtils/DbgEvent.cs | 1 + Crow/src/DebugUtils/DbgLayoutEvent.cs | 6 +- Crow/src/DebugUtils/DbgWidgetEvent.cs | 4 +- Crow/src/ExtensionsMethods.cs | 12 +- Crow/src/Fill/BmpPicture.cs | 27 +-- Crow/src/Fill/Fill.cs | 9 +- Crow/src/Fill/Gradient.cs | 7 +- Crow/src/Fill/Picture.cs | 15 +- Crow/src/Fill/SolidColor.cs | 7 +- Crow/src/Fill/SvgPicture.cs | 11 +- Crow/src/Font.cs | 12 +- .../GraphicBackends/Mono.Cairo/Antialias.cs | 43 ----- Crow/src/GraphicBackends/Mono.Cairo/Format.cs | 48 ----- .../GraphicBackends/Mono.Cairo/Operator.cs | 62 ------- Crow/src/GraphicBackends/vkvg/Enums.cs | 143 --------------- Crow/src/GraphicBackends/vkvg/TextExtents.cs | 72 -------- Crow/src/Input/MouseEventArgs.cs | 3 +- Crow/src/Interface.cs | 27 ++- Crow/src/Text/IEditableTextWidget.cs | 7 +- Crow/src/Widgets/Border.cs | 11 +- Crow/src/Widgets/CircleMeter.cs | 13 +- Crow/src/Widgets/ColorSelector.cs | 3 +- Crow/src/Widgets/ColorSlider.cs | 7 +- Crow/src/Widgets/ComboBox.cs | 3 +- Crow/src/Widgets/DockStack.cs | 3 +- Crow/src/Widgets/DockWindow.cs | 7 +- Crow/src/Widgets/Gauge.cs | 7 +- Crow/src/Widgets/GroupBase.cs | 8 +- Crow/src/Widgets/HueSelector.cs | 7 +- Crow/src/Widgets/ILayoutable.cs | 3 +- Crow/src/Widgets/Image.cs | 4 +- Crow/src/Widgets/Label.cs | 55 +++--- Crow/src/Widgets/MenuItem.cs | 3 +- Crow/src/Widgets/Popper.cs | 3 +- Crow/src/Widgets/PrivateContainer.cs | 12 +- Crow/src/Widgets/SaturationValueSelector.cs | 11 +- Crow/src/Widgets/ScrollBar.cs | 1 + Crow/src/Widgets/Scroller.cs | 7 +- Crow/src/Widgets/ScrollingStack.cs | 8 +- Crow/src/Widgets/Shape.cs | 15 +- Crow/src/Widgets/Slider.cs | 3 +- Crow/src/Widgets/Splitter.cs | 25 +-- Crow/src/Widgets/Table.cs | 7 +- Crow/src/Widgets/TableRow copy.cs | 83 ++++----- Crow/src/Widgets/TemplatedControl.cs | 4 +- Crow/src/Widgets/TemplatedGroup.cs | 3 +- Crow/src/Widgets/TextBox.cs | 10 +- Crow/src/Widgets/Widget.cs | 20 +-- Crow/src/Widgets/Window.cs | 3 +- Directory.Build.props | 4 +- Drawing2D/Drawing2D.csproj | 35 ++++ {Crow => Drawing2D}/src/Colors.cs | 3 +- Drawing2D/src/Device.cs | 18 ++ Drawing2D/src/Enums.cs | 149 ++++++++++++++++ .../vkvg => Drawing2D/src}/FontExtents.cs | 56 +++--- Drawing2D/src/IContext.cs | 93 ++++++++++ Drawing2D/src/Matrix.cs | 21 +++ Drawing2D/src/Pattern.cs | 13 ++ {Crow/src/2d => Drawing2D/src}/Point.cs | 9 +- {Crow/src/2d => Drawing2D/src}/PointD.cs | 34 ++-- {Crow/src/2d => Drawing2D/src}/Rectangle.cs | 55 +++--- Drawing2D/src/RectangleD.cs | 156 ++++++++++++++++ {Crow/src/2d => Drawing2D/src}/Size.cs | 9 +- {Crow/src/2d => Drawing2D/src}/SizeD.cs | 32 ++-- Drawing2D/src/Surface.cs | 23 +++ Drawing2D/src/TextExtents.cs | 60 +++++++ Samples/ShowCase/ShowCase.cs | 6 +- Samples/common/src/Editor.cs | 6 +- Samples/common/src/SampleBase.cs | 4 +- Samples/common/src/TestWidget.cs | 4 +- 144 files changed, 1049 insertions(+), 962 deletions(-) create mode 100644 Backends/CairoBackend/CairoBackend.csproj rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Cairo.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/CairoDebug.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Content.cs (99%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Context.cs (97%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/DRMDevice.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/DRMSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Device.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/DirectFBSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Distance.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/EGLDevice.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Extend.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FillRule.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Filter.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontExtents.cs (99%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontFace.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontOptions.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontSlant.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontType.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/FontWeight.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/GLSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/GLXDevice.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/GlitzSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Glyph.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Gradient.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/HintMetrics.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/HintStyle.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/ImageSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/LineCap.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/LineJoin.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/LinearGradient.cs (99%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Matrix.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/MeshPattern.cs (99%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/NativeMethods-internal.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/NativeMethods.cs (99%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/PSSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Path.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Pattern.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/PatternType.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/PdfSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/RadialGradient.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Region.cs (88%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/ScaledFont.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SolidPattern.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Status.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SubpixelOrder.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Surface.cs (97%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SurfacePattern.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SurfaceType.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SvgSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/SvgVersion.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/TextExtents.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/WGLDevice.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/Win32Surface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/XcbSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/XlibSurface.cs (100%) rename {Crow/src/GraphicBackends/Mono.Cairo => Backends/CairoBackend/src}/rsvg/SvgHandle.cs (99%) create mode 100644 Backends/VkvgBackend/VkvgBackend.csproj rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Context.cs (98%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Device.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Gradient.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Matrix.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/NativeMethods.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Pattern.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/Surface.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/SvgHandle.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/TextRun.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/VulkanContext.cs (99%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/tmp/FontOptions.cs (100%) rename {Crow/src/GraphicBackends/vkvg => Backends/VkvgBackend/src}/tmp/Region.cs (98%) delete mode 100644 Crow/src/2d/RectangleD.cs delete mode 100644 Crow/src/GraphicBackends/Mono.Cairo/Antialias.cs delete mode 100644 Crow/src/GraphicBackends/Mono.Cairo/Format.cs delete mode 100644 Crow/src/GraphicBackends/Mono.Cairo/Operator.cs delete mode 100644 Crow/src/GraphicBackends/vkvg/Enums.cs delete mode 100644 Crow/src/GraphicBackends/vkvg/TextExtents.cs create mode 100644 Drawing2D/Drawing2D.csproj rename {Crow => Drawing2D}/src/Colors.cs (99%) create mode 100644 Drawing2D/src/Device.cs create mode 100644 Drawing2D/src/Enums.cs rename {Crow/src/GraphicBackends/vkvg => Drawing2D/src}/FontExtents.cs (74%) create mode 100644 Drawing2D/src/IContext.cs create mode 100644 Drawing2D/src/Matrix.cs create mode 100644 Drawing2D/src/Pattern.cs rename {Crow/src/2d => Drawing2D/src}/Point.cs (93%) rename {Crow/src/2d => Drawing2D/src}/PointD.cs (70%) rename {Crow/src/2d => Drawing2D/src}/Rectangle.cs (75%) create mode 100644 Drawing2D/src/RectangleD.cs rename {Crow/src/2d => Drawing2D/src}/Size.cs (96%) rename {Crow/src/2d => Drawing2D/src}/SizeD.cs (71%) create mode 100644 Drawing2D/src/Surface.cs create mode 100644 Drawing2D/src/TextExtents.cs diff --git a/Backends/CairoBackend/CairoBackend.csproj b/Backends/CairoBackend/CairoBackend.csproj new file mode 100644 index 00000000..f4fe4d57 --- /dev/null +++ b/Backends/CairoBackend/CairoBackend.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.0 + + + + + + + + + + + diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Cairo.cs b/Backends/CairoBackend/src/Cairo.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Cairo.cs rename to Backends/CairoBackend/src/Cairo.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/CairoDebug.cs b/Backends/CairoBackend/src/CairoDebug.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/CairoDebug.cs rename to Backends/CairoBackend/src/CairoDebug.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Content.cs b/Backends/CairoBackend/src/Content.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/Content.cs rename to Backends/CairoBackend/src/Content.cs index 13927c1d..a908a0d8 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/Content.cs +++ b/Backends/CairoBackend/src/Content.cs @@ -33,7 +33,6 @@ using System; namespace Crow.Drawing { //[Flags] - public enum Content { Color = 0x1000, diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Context.cs b/Backends/CairoBackend/src/Context.cs similarity index 97% rename from Crow/src/GraphicBackends/Mono.Cairo/Context.cs rename to Backends/CairoBackend/src/Context.cs index f8c1c0e7..5b92166c 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/Context.cs +++ b/Backends/CairoBackend/src/Context.cs @@ -37,6 +37,7 @@ using System; using System.Runtime.InteropServices; using System.Text; +using Drawing2D; namespace Crow.Drawing { @@ -443,11 +444,11 @@ namespace Crow.Drawing { NativeMethods.cairo_arc_negative (handle, center.X, center.Y, radius, angle1, angle2); } - public void Rectangle (Crow.Rectangle rectangle) + public void Rectangle (Rectangle rectangle) { Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } - public void Rectangle (Crow.RectangleD rectangle) + public void Rectangle (RectangleD rectangle) { Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } @@ -515,11 +516,11 @@ namespace Crow.Drawing { NativeMethods.cairo_stroke_preserve (handle); } - public Crow.Rectangle StrokeExtents () + public Rectangle StrokeExtents () { double x1, y1, x2, y2; NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2); - return new Crow.Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1)); + return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1)); } public void Fill () @@ -527,11 +528,11 @@ namespace Crow.Drawing { NativeMethods.cairo_fill (handle); } - public Crow.Rectangle FillExtents () + public Rectangle FillExtents () { double x1, y1, x2, y2; NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2); - return new Crow.Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1)); + return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1)); } public void FillPreserve () @@ -875,7 +876,7 @@ namespace Crow.Drawing { public void ShowText (ReadOnlySpan s, int tabSize) { int size = s.Length * 4 + 1; Span bytes = size > 512 ? new byte[size] : stackalloc byte[size]; - int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize); + int encodedBytes = Text.Encoding.ToUtf8 (s, bytes, tabSize); bytes[encodedBytes] = 0; ShowText (bytes.Slice (0, encodedBytes + 1)); } @@ -886,7 +887,7 @@ namespace Crow.Drawing { public void TextExtents (ReadOnlySpan s, int tabSize, out TextExtents extents) { int size = s.Length * 4 + 1; Span bytes = size > 512 ? new byte[size] : stackalloc byte[size]; - int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize); + int encodedBytes = Text.Encoding.ToUtf8 (s, bytes, tabSize); bytes[encodedBytes] = 0; TextExtents (bytes.Slice (0, encodedBytes + 1), out extents); } diff --git a/Crow/src/GraphicBackends/Mono.Cairo/DRMDevice.cs b/Backends/CairoBackend/src/DRMDevice.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/DRMDevice.cs rename to Backends/CairoBackend/src/DRMDevice.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/DRMSurface.cs b/Backends/CairoBackend/src/DRMSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/DRMSurface.cs rename to Backends/CairoBackend/src/DRMSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Device.cs b/Backends/CairoBackend/src/Device.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Device.cs rename to Backends/CairoBackend/src/Device.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/DirectFBSurface.cs b/Backends/CairoBackend/src/DirectFBSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/DirectFBSurface.cs rename to Backends/CairoBackend/src/DirectFBSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Distance.cs b/Backends/CairoBackend/src/Distance.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Distance.cs rename to Backends/CairoBackend/src/Distance.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/EGLDevice.cs b/Backends/CairoBackend/src/EGLDevice.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/EGLDevice.cs rename to Backends/CairoBackend/src/EGLDevice.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Extend.cs b/Backends/CairoBackend/src/Extend.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Extend.cs rename to Backends/CairoBackend/src/Extend.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FillRule.cs b/Backends/CairoBackend/src/FillRule.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FillRule.cs rename to Backends/CairoBackend/src/FillRule.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Filter.cs b/Backends/CairoBackend/src/Filter.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Filter.cs rename to Backends/CairoBackend/src/Filter.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontExtents.cs b/Backends/CairoBackend/src/FontExtents.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/FontExtents.cs rename to Backends/CairoBackend/src/FontExtents.cs index 99a26d2c..73164b29 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/FontExtents.cs +++ b/Backends/CairoBackend/src/FontExtents.cs @@ -18,10 +18,10 @@ // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -44,27 +44,27 @@ namespace Crow.Drawing double height; double maxXAdvance; double maxYAdvance; - + public double Ascent { get { return ascent; } set { ascent = value; } } - + public double Descent { get { return descent; } set { descent = value; } } - + public double Height { get { return height; } set { height = value; } } - + public double MaxXAdvance { get { return maxXAdvance; } set { maxXAdvance = value; } } - + public double MaxYAdvance { get { return maxYAdvance; } set { maxYAdvance = value; } diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontFace.cs b/Backends/CairoBackend/src/FontFace.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FontFace.cs rename to Backends/CairoBackend/src/FontFace.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontOptions.cs b/Backends/CairoBackend/src/FontOptions.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FontOptions.cs rename to Backends/CairoBackend/src/FontOptions.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontSlant.cs b/Backends/CairoBackend/src/FontSlant.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FontSlant.cs rename to Backends/CairoBackend/src/FontSlant.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontType.cs b/Backends/CairoBackend/src/FontType.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FontType.cs rename to Backends/CairoBackend/src/FontType.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/FontWeight.cs b/Backends/CairoBackend/src/FontWeight.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/FontWeight.cs rename to Backends/CairoBackend/src/FontWeight.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/GLSurface.cs b/Backends/CairoBackend/src/GLSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/GLSurface.cs rename to Backends/CairoBackend/src/GLSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/GLXDevice.cs b/Backends/CairoBackend/src/GLXDevice.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/GLXDevice.cs rename to Backends/CairoBackend/src/GLXDevice.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/GlitzSurface.cs b/Backends/CairoBackend/src/GlitzSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/GlitzSurface.cs rename to Backends/CairoBackend/src/GlitzSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Glyph.cs b/Backends/CairoBackend/src/Glyph.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Glyph.cs rename to Backends/CairoBackend/src/Glyph.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Gradient.cs b/Backends/CairoBackend/src/Gradient.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Gradient.cs rename to Backends/CairoBackend/src/Gradient.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/HintMetrics.cs b/Backends/CairoBackend/src/HintMetrics.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/HintMetrics.cs rename to Backends/CairoBackend/src/HintMetrics.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/HintStyle.cs b/Backends/CairoBackend/src/HintStyle.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/HintStyle.cs rename to Backends/CairoBackend/src/HintStyle.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/ImageSurface.cs b/Backends/CairoBackend/src/ImageSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/ImageSurface.cs rename to Backends/CairoBackend/src/ImageSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/LineCap.cs b/Backends/CairoBackend/src/LineCap.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/LineCap.cs rename to Backends/CairoBackend/src/LineCap.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/LineJoin.cs b/Backends/CairoBackend/src/LineJoin.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/LineJoin.cs rename to Backends/CairoBackend/src/LineJoin.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/LinearGradient.cs b/Backends/CairoBackend/src/LinearGradient.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/LinearGradient.cs rename to Backends/CairoBackend/src/LinearGradient.cs index 69d9a939..3b98be03 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/LinearGradient.cs +++ b/Backends/CairoBackend/src/LinearGradient.cs @@ -28,6 +28,7 @@ // using System; +using Drawing2D; namespace Crow.Drawing { diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Matrix.cs b/Backends/CairoBackend/src/Matrix.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Matrix.cs rename to Backends/CairoBackend/src/Matrix.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/MeshPattern.cs b/Backends/CairoBackend/src/MeshPattern.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/MeshPattern.cs rename to Backends/CairoBackend/src/MeshPattern.cs index 99cd72c1..aef35481 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/MeshPattern.cs +++ b/Backends/CairoBackend/src/MeshPattern.cs @@ -28,6 +28,7 @@ // using System; +using Drawing2D; namespace Crow.Drawing { diff --git a/Crow/src/GraphicBackends/Mono.Cairo/NativeMethods-internal.cs b/Backends/CairoBackend/src/NativeMethods-internal.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/NativeMethods-internal.cs rename to Backends/CairoBackend/src/NativeMethods-internal.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/NativeMethods.cs b/Backends/CairoBackend/src/NativeMethods.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/NativeMethods.cs rename to Backends/CairoBackend/src/NativeMethods.cs index f547661e..48ee42f7 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/NativeMethods.cs +++ b/Backends/CairoBackend/src/NativeMethods.cs @@ -33,6 +33,7 @@ using System; using System.Runtime.InteropServices; +using Drawing2D; namespace Crow.Drawing { @@ -548,7 +549,7 @@ namespace Crow.Drawing internal static extern bool cairo_region_contains_point (IntPtr region, int x, int y); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle); + internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern IntPtr cairo_region_copy (IntPtr original); @@ -557,7 +558,7 @@ namespace Crow.Drawing internal static extern IntPtr cairo_region_create (); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect); + internal static extern IntPtr cairo_region_create_rectangle (ref Rectangle rect); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count); @@ -569,16 +570,16 @@ namespace Crow.Drawing internal static extern bool cairo_region_equal (IntPtr a, IntPtr b); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents); + internal static extern void cairo_region_get_extents (IntPtr region, out Rectangle extents); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle); + internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern Status cairo_region_intersect (IntPtr dst, IntPtr other); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle); + internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern bool cairo_region_is_empty (IntPtr region); @@ -596,7 +597,7 @@ namespace Crow.Drawing internal static extern Status cairo_region_subtract (IntPtr dst, IntPtr other); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle); + internal static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern void cairo_region_translate (IntPtr region, int dx, int dy); @@ -605,13 +606,13 @@ namespace Crow.Drawing internal static extern Status cairo_region_union (IntPtr dst, IntPtr other); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle); + internal static extern Status cairo_region_union_rectangle (IntPtr dst, ref Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern Status cairo_region_xor (IntPtr dst, IntPtr other); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle); + internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Rectangle rectangle); #endregion [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] diff --git a/Crow/src/GraphicBackends/Mono.Cairo/PSSurface.cs b/Backends/CairoBackend/src/PSSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/PSSurface.cs rename to Backends/CairoBackend/src/PSSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Path.cs b/Backends/CairoBackend/src/Path.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Path.cs rename to Backends/CairoBackend/src/Path.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Pattern.cs b/Backends/CairoBackend/src/Pattern.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Pattern.cs rename to Backends/CairoBackend/src/Pattern.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/PatternType.cs b/Backends/CairoBackend/src/PatternType.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/PatternType.cs rename to Backends/CairoBackend/src/PatternType.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/PdfSurface.cs b/Backends/CairoBackend/src/PdfSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/PdfSurface.cs rename to Backends/CairoBackend/src/PdfSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/RadialGradient.cs b/Backends/CairoBackend/src/RadialGradient.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/RadialGradient.cs rename to Backends/CairoBackend/src/RadialGradient.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Region.cs b/Backends/CairoBackend/src/Region.cs similarity index 88% rename from Crow/src/GraphicBackends/Mono.Cairo/Region.cs rename to Backends/CairoBackend/src/Region.cs index 9cac680b..f4fa7572 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/Region.cs +++ b/Backends/CairoBackend/src/Region.cs @@ -22,6 +22,7 @@ using System; using System.Runtime.InteropServices; +using Drawing2D; namespace Crow.Drawing { @@ -61,7 +62,7 @@ namespace Crow.Drawing { } - public Region (Crow.Rectangle rect) + public Region (Rectangle rect) { handle = NativeMethods.cairo_region_create_rectangle (ref rect); } @@ -115,9 +116,9 @@ namespace Crow.Drawing get { return NativeMethods.cairo_region_status (Handle); } } - public Crow.Rectangle Extents { + public Rectangle Extents { get { - Crow.Rectangle result; + Rectangle result; NativeMethods.cairo_region_get_extents (Handle, out result); return result; } @@ -127,9 +128,9 @@ namespace Crow.Drawing get { return NativeMethods.cairo_region_num_rectangles (Handle); } } - public Crow.Rectangle GetRectangle (int nth) + public Rectangle GetRectangle (int nth) { - Crow.Rectangle val; + Rectangle val; NativeMethods.cairo_region_get_rectangle (Handle, nth, out val); return val; } @@ -138,7 +139,7 @@ namespace Crow.Drawing get { return NativeMethods.cairo_region_is_empty (Handle); } } - public RegionOverlap Contains (Crow.Rectangle rectangle) + public RegionOverlap Contains (Rectangle rectangle) { return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle); } @@ -158,7 +159,7 @@ namespace Crow.Drawing return NativeMethods.cairo_region_subtract (Handle, other.Handle); } - public Status SubtractRectangle (Crow.Rectangle rectangle) + public Status SubtractRectangle (Rectangle rectangle) { return NativeMethods.cairo_region_subtract_rectangle (Handle, ref rectangle); } @@ -168,7 +169,7 @@ namespace Crow.Drawing return NativeMethods.cairo_region_intersect (Handle, other.Handle); } - public Status IntersectRectangle (Crow.Rectangle rectangle) + public Status IntersectRectangle (Rectangle rectangle) { return NativeMethods.cairo_region_intersect_rectangle (Handle, ref rectangle); } @@ -178,7 +179,7 @@ namespace Crow.Drawing return NativeMethods.cairo_region_union (Handle, other.Handle); } - public Status UnionRectangle (Crow.Rectangle rectangle) + public Status UnionRectangle (Rectangle rectangle) { return NativeMethods.cairo_region_union_rectangle (Handle, ref rectangle); } @@ -188,7 +189,7 @@ namespace Crow.Drawing return NativeMethods.cairo_region_xor (Handle, other.Handle); } - public Status XorRectangle (Crow.Rectangle rectangle) + public Status XorRectangle (Rectangle rectangle) { return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle); } @@ -196,8 +197,8 @@ namespace Crow.Drawing if (IsEmpty) return; NativeMethods.cairo_region_destroy (Handle); - handle = NativeMethods.cairo_region_create (); + handle = NativeMethods.cairo_region_create (); } - public bool OverlapOut (Crow.Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out; + public bool OverlapOut (Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out; } } diff --git a/Crow/src/GraphicBackends/Mono.Cairo/ScaledFont.cs b/Backends/CairoBackend/src/ScaledFont.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/ScaledFont.cs rename to Backends/CairoBackend/src/ScaledFont.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SolidPattern.cs b/Backends/CairoBackend/src/SolidPattern.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SolidPattern.cs rename to Backends/CairoBackend/src/SolidPattern.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Status.cs b/Backends/CairoBackend/src/Status.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Status.cs rename to Backends/CairoBackend/src/Status.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SubpixelOrder.cs b/Backends/CairoBackend/src/SubpixelOrder.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SubpixelOrder.cs rename to Backends/CairoBackend/src/SubpixelOrder.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Surface.cs b/Backends/CairoBackend/src/Surface.cs similarity index 97% rename from Crow/src/GraphicBackends/Mono.Cairo/Surface.cs rename to Backends/CairoBackend/src/Surface.cs index 10967a93..92256fad 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/Surface.cs +++ b/Backends/CairoBackend/src/Surface.cs @@ -35,6 +35,7 @@ using System; using System.Collections; +using Drawing2D; namespace Crow.Drawing { @@ -143,7 +144,7 @@ namespace Crow.Drawing { NativeMethods.cairo_surface_destroy (handle); handle = IntPtr.Zero; } - public virtual void SetSize (int width, int height) { + public virtual void SetSize (int width, int height) { } public Status Finish () @@ -162,7 +163,7 @@ namespace Crow.Drawing { NativeMethods.cairo_surface_mark_dirty (Handle); } - public void MarkDirty (Crow.Rectangle rectangle) + public void MarkDirty (Rectangle rectangle) { NativeMethods.cairo_surface_mark_dirty_rectangle (Handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SurfacePattern.cs b/Backends/CairoBackend/src/SurfacePattern.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SurfacePattern.cs rename to Backends/CairoBackend/src/SurfacePattern.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SurfaceType.cs b/Backends/CairoBackend/src/SurfaceType.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SurfaceType.cs rename to Backends/CairoBackend/src/SurfaceType.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SvgSurface.cs b/Backends/CairoBackend/src/SvgSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SvgSurface.cs rename to Backends/CairoBackend/src/SvgSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/SvgVersion.cs b/Backends/CairoBackend/src/SvgVersion.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/SvgVersion.cs rename to Backends/CairoBackend/src/SvgVersion.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/TextExtents.cs b/Backends/CairoBackend/src/TextExtents.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/TextExtents.cs rename to Backends/CairoBackend/src/TextExtents.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/WGLDevice.cs b/Backends/CairoBackend/src/WGLDevice.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/WGLDevice.cs rename to Backends/CairoBackend/src/WGLDevice.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/Win32Surface.cs b/Backends/CairoBackend/src/Win32Surface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/Win32Surface.cs rename to Backends/CairoBackend/src/Win32Surface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/XcbSurface.cs b/Backends/CairoBackend/src/XcbSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/XcbSurface.cs rename to Backends/CairoBackend/src/XcbSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/XlibSurface.cs b/Backends/CairoBackend/src/XlibSurface.cs similarity index 100% rename from Crow/src/GraphicBackends/Mono.Cairo/XlibSurface.cs rename to Backends/CairoBackend/src/XlibSurface.cs diff --git a/Crow/src/GraphicBackends/Mono.Cairo/rsvg/SvgHandle.cs b/Backends/CairoBackend/src/rsvg/SvgHandle.cs similarity index 99% rename from Crow/src/GraphicBackends/Mono.Cairo/rsvg/SvgHandle.cs rename to Backends/CairoBackend/src/rsvg/SvgHandle.cs index 1477b14f..fc2d8a2b 100644 --- a/Crow/src/GraphicBackends/Mono.Cairo/rsvg/SvgHandle.cs +++ b/Backends/CairoBackend/src/rsvg/SvgHandle.cs @@ -1,6 +1,7 @@ //Copyright GPL2 using System; using System.Runtime.InteropServices; +using Drawing2D; namespace Crow.Drawing { diff --git a/Backends/VkvgBackend/VkvgBackend.csproj b/Backends/VkvgBackend/VkvgBackend.csproj new file mode 100644 index 00000000..f4fe4d57 --- /dev/null +++ b/Backends/VkvgBackend/VkvgBackend.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.0 + + + + + + + + + + + diff --git a/Crow/src/GraphicBackends/vkvg/Context.cs b/Backends/VkvgBackend/src/Context.cs similarity index 98% rename from Crow/src/GraphicBackends/vkvg/Context.cs rename to Backends/VkvgBackend/src/Context.cs index d8f45611..11f63de3 100644 --- a/Crow/src/GraphicBackends/vkvg/Context.cs +++ b/Backends/VkvgBackend/src/Context.cs @@ -79,16 +79,20 @@ namespace Crow.Drawing get; } public TextExtents TextExtents (ReadOnlySpan s, int tabSize = 4) { - TextExtents (s, tabSize, out TextExtents extents); + TextExtents (s, tabSize, out TextExtents extents); return extents; } public void TextExtents (ReadOnlySpan s, int tabSize, out TextExtents extents) { + if (s.Length == 0) { + extents = default; + return; + } int size = s.Length * 4 + 1; Span bytes = size > 512 ? new byte[size] : stackalloc byte[size]; int encodedBytes = Crow.Text.Encoding.ToUtf8 (s, bytes, tabSize); bytes[encodedBytes] = 0; TextExtents (bytes.Slice (0, encodedBytes + 1), out extents); - } + } public void TextExtents (Span bytes, out TextExtents extents) { NativeMethods.vkvg_text_extents (handle, ref bytes.GetPinnableReference (), out extents); } @@ -158,7 +162,7 @@ namespace Crow.Drawing public void ArcNegative (PointD center, double radius, double angle1, double angle2) { NativeMethods.vkvg_arc_negative (handle, (float)center.X, (float)center.Y, (float)radius, (float)angle1, (float)angle2); - } + } public void ArcNegative(float xc, float yc, float radius, float a1, float a2) { NativeMethods.vkvg_arc_negative(handle, xc, yc, radius, a1, a2); @@ -365,13 +369,13 @@ namespace Crow.Drawing NativeMethods.vkvg_set_dash(handle, value, (uint)value.Length, 0); } } - + public void PushGroup () { } public void PopGroupToSource () { - + } #region IDisposable implementation diff --git a/Crow/src/GraphicBackends/vkvg/Device.cs b/Backends/VkvgBackend/src/Device.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/Device.cs rename to Backends/VkvgBackend/src/Device.cs diff --git a/Crow/src/GraphicBackends/vkvg/Gradient.cs b/Backends/VkvgBackend/src/Gradient.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/Gradient.cs rename to Backends/VkvgBackend/src/Gradient.cs diff --git a/Crow/src/GraphicBackends/vkvg/Matrix.cs b/Backends/VkvgBackend/src/Matrix.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/Matrix.cs rename to Backends/VkvgBackend/src/Matrix.cs diff --git a/Crow/src/GraphicBackends/vkvg/NativeMethods.cs b/Backends/VkvgBackend/src/NativeMethods.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/NativeMethods.cs rename to Backends/VkvgBackend/src/NativeMethods.cs diff --git a/Crow/src/GraphicBackends/vkvg/Pattern.cs b/Backends/VkvgBackend/src/Pattern.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/Pattern.cs rename to Backends/VkvgBackend/src/Pattern.cs diff --git a/Crow/src/GraphicBackends/vkvg/Surface.cs b/Backends/VkvgBackend/src/Surface.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/Surface.cs rename to Backends/VkvgBackend/src/Surface.cs diff --git a/Crow/src/GraphicBackends/vkvg/SvgHandle.cs b/Backends/VkvgBackend/src/SvgHandle.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/SvgHandle.cs rename to Backends/VkvgBackend/src/SvgHandle.cs diff --git a/Crow/src/GraphicBackends/vkvg/TextRun.cs b/Backends/VkvgBackend/src/TextRun.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/TextRun.cs rename to Backends/VkvgBackend/src/TextRun.cs diff --git a/Crow/src/GraphicBackends/vkvg/VulkanContext.cs b/Backends/VkvgBackend/src/VulkanContext.cs similarity index 99% rename from Crow/src/GraphicBackends/vkvg/VulkanContext.cs rename to Backends/VkvgBackend/src/VulkanContext.cs index 801458a2..610faa71 100644 --- a/Crow/src/GraphicBackends/vkvg/VulkanContext.cs +++ b/Backends/VkvgBackend/src/VulkanContext.cs @@ -21,9 +21,9 @@ namespace Crow.Drawing { public uint width { get; protected set; } public uint height { get; protected set; } - protected Instance instance; + protected Instance instance; protected PhysicalDevice phy; - protected vke.Device dev; + protected vke.Device dev; protected Queue graphicQueue;//for vkvg, we must have at least a graphic queue public Crow.Drawing.Device VkvgDevice { get; protected set; } @@ -31,7 +31,7 @@ namespace Crow.Drawing { public VulkanContextBase (Interface iface) { this.iface = iface; - } + } protected void createVkvgDevice () => VkvgDevice = @@ -204,11 +204,11 @@ namespace Crow.Drawing { } internal vke.Image blitSource; - + void buildBlitCommand (Crow.Drawing.Surface surf) { //Console.WriteLine ($"build blit w:{width} h:{height}"); cmdPool.Reset(); - + blitSource = new vke.Image (dev, new VkImage((ulong)surf.VkImage.ToInt64()), Vulkan.VkFormat.B8g8r8a8Unorm, Vulkan.VkImageUsageFlags.TransferSrc | Vulkan.VkImageUsageFlags.TransferDst | Vulkan.VkImageUsageFlags.ColorAttachment, width, height); @@ -217,7 +217,7 @@ namespace Crow.Drawing { vke.Image blitDest = swapChain.images[i]; vke.PrimaryCommandBuffer cmd = cmds[i]; cmd.Start(); - + blitDest.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal, VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer); diff --git a/Crow/src/GraphicBackends/vkvg/tmp/FontOptions.cs b/Backends/VkvgBackend/src/tmp/FontOptions.cs similarity index 100% rename from Crow/src/GraphicBackends/vkvg/tmp/FontOptions.cs rename to Backends/VkvgBackend/src/tmp/FontOptions.cs diff --git a/Crow/src/GraphicBackends/vkvg/tmp/Region.cs b/Backends/VkvgBackend/src/tmp/Region.cs similarity index 98% rename from Crow/src/GraphicBackends/vkvg/tmp/Region.cs rename to Backends/VkvgBackend/src/tmp/Region.cs index 83dc7f2b..1821ae2b 100644 --- a/Crow/src/GraphicBackends/vkvg/tmp/Region.cs +++ b/Backends/VkvgBackend/src/tmp/Region.cs @@ -4,14 +4,14 @@ using System.Collections.Generic; using System; -using Crow.Drawing; + namespace Crow { public enum RegionOverlap { In, Out, Part, - } + } public class Region : IDisposable { public List list = new List(); @@ -127,7 +127,7 @@ namespace Crow { public void Dispose() { - + } } } diff --git a/Crow.sln b/Crow.sln index cdd60dd3..e9e8fd86 100644 --- a/Crow.sln +++ b/Crow.sln @@ -21,6 +21,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShowCase", "Samples\ShowCas EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTests", "Samples\PerfTests\PerfTests.csproj", "{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drawing2D", "Drawing2D\Drawing2D.csproj", "{B9E665AC-92A5-4F53-A021-7B27A8014BC3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Backends", "Backends", "{451F5727-2A2E-4361-A41B-089429ADE8F9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CairoBackend", "Backends\CairoBackend\CairoBackend.csproj", "{E06441A9-0CFD-45BB-9478-99D28CEB327F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +45,14 @@ Global {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.Build.0 = Debug|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.ActiveCfg = Release|Any CPU {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E665AC-92A5-4F53-A021-7B27A8014BC3}.Release|Any CPU.Build.0 = Release|Any CPU + {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E06441A9-0CFD-45BB-9478-99D28CEB327F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -47,6 +61,7 @@ Global {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} {56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6} + {E06441A9-0CFD-45BB-9478-99D28CEB327F} = {451F5727-2A2E-4361-A41B-089429ADE8F9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {00D4E149-7131-49F4-BAAD-559AA961A78E} diff --git a/Crow/Crow.csproj b/Crow/Crow.csproj index 2771f658..5a7fdc4e 100644 --- a/Crow/Crow.csproj +++ b/Crow/Crow.csproj @@ -51,13 +51,13 @@ - + $(DefineConstants);DEBUG_LOG - + $(DefineConstants);DEBUG_STATS - + $(DefineConstants);DESIGN_MODE diff --git a/Drawing2D/Drawing2D.csproj b/Drawing2D/Drawing2D.csproj new file mode 100644 index 00000000..0bb94879 --- /dev/null +++ b/Drawing2D/Drawing2D.csproj @@ -0,0 +1,35 @@ + + + + netcoreapp3.0 + false + + 1.0.0 + $(AssemblyVersion)-beta + + Drawing 2D Library + + 2d shapes and drawing interfaces used in C.R.O.W and Vke.net. + + MIT + Jean-Philippe Bruyère + https://github.com/jpbruyere/Crow + Crow 2D GUI Widget Interface C# Net + False + + https://github.com/jpbruyere/Crow/wiki + Copyright 2022 + True + true + + + + + + + + + + + + diff --git a/Crow/src/Colors.cs b/Drawing2D/src/Colors.cs similarity index 99% rename from Crow/src/Colors.cs rename to Drawing2D/src/Colors.cs index d24f5e94..2bd58ada 100644 --- a/Crow/src/Colors.cs +++ b/Drawing2D/src/Colors.cs @@ -5,9 +5,8 @@ using System; using System.Collections.Generic; using System.Linq; -//using FastEnumUtility; -namespace Crow +namespace Drawing2D { public enum Colors : UInt32 { diff --git a/Drawing2D/src/Device.cs b/Drawing2D/src/Device.cs new file mode 100644 index 00000000..8beb1b79 --- /dev/null +++ b/Drawing2D/src/Device.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2018-2020 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Drawing2D +{ + public interface IDevice: IDisposable + { + //IntPtr Handle => handle; + + void GetDpy (out int hdpy, out int vdpy); + void SetDpy (int hdpy, int vdpy); + ISurface CreateSurface (int width, int height); + } +} + diff --git a/Drawing2D/src/Enums.cs b/Drawing2D/src/Enums.cs new file mode 100644 index 00000000..b13f29af --- /dev/null +++ b/Drawing2D/src/Enums.cs @@ -0,0 +1,149 @@ +// Copyright (c) 2018-2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Drawing2D +{ + public enum Status + { + Success = 0, + NoMemory, + InvalidRestore, + InvalidPopGroup, + NoCurrentPoint, + InvalidMatrix, + InvalidStatus, + NullPointer, + InvalidString, + InvalidPathData, + ReadError, + WriteError, + SurfaceFinished, + SurfaceTypeMismatch, + PatternTypeMismatch, + InvalidContent, + InvalidFormat, + InvalidVisual, + FileNotFound, + InvalidDash + } + + public enum Direction + { + Horizontal = 0, + Vertical = 1 + } + + public enum Format + { + ARGB32, + RGB24, + A8, + A1, + Rgb16565 = 4 + } + + public enum Extend + { + None, + Repeat, + Reflect, + Pad + } + + public enum Filter + { + Fast, + Good, + Best, + Nearest, + Bilinear, + Gaussian, + } + + public enum PatternType + { + Solid, + Surface, + Linear, + Radial, + Mesh, + RasterSource, + } + + public enum Operator + { + Clear, + Source, + Over, + In, + Out, + Atop, + + Dest, + DestOver, + DestIn, + DestOut, + DestAtop, + + Xor, + Add, + Saturate, + Multiply, + Screen, + Overlay, + Darken, + Lighten, + } + + public enum FontSlant + { + Normal, + Italic, + Oblique + } + public enum FontWeight + { + Normal, + Bold, + } + + public enum SampleCount + { + Sample_1 = 0x00000001, + Sample_2 = 0x00000002, + Sample_4 = 0x00000004, + Sample_8 = 0x00000008, + Sample_16 = 0x00000010, + Sample_32 = 0x00000020, + Sample_64 = 0x00000040 + } + + public enum LineCap + { + Butt, + Round, + Square + } + + public enum LineJoin + { + Miter, + Round, + Bevel + } + public enum FillRule + { + EvenOdd, + NonZero, + } + public enum Antialias + { + Default, + None, + Grey, + Subpixel, + } +} \ No newline at end of file diff --git a/Crow/src/GraphicBackends/vkvg/FontExtents.cs b/Drawing2D/src/FontExtents.cs similarity index 74% rename from Crow/src/GraphicBackends/vkvg/FontExtents.cs rename to Drawing2D/src/FontExtents.cs index 769b9a69..19532880 100644 --- a/Crow/src/GraphicBackends/vkvg/FontExtents.cs +++ b/Drawing2D/src/FontExtents.cs @@ -18,10 +18,10 @@ // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -30,45 +30,45 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -// Copyright (c) 2018-2020 Jean-Philippe Bruyère +// Copyright (c) 2018-2022 Jean-Philippe Bruyère // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Runtime.InteropServices; -namespace Crow.Drawing +namespace Drawing2D { [StructLayout (LayoutKind.Sequential)] - public struct FontExtents + public struct FontExtents : IEquatable { float ascent; float descent; float height; float maxXAdvance; float maxYAdvance; - + public float Ascent { - get { return ascent; } + get => ascent; set { ascent = value; } } - + public float Descent { - get { return descent; } + get => descent; set { descent = value; } } - + public float Height { - get { return height; } + get => height; set { height = value; } } - + public float MaxXAdvance { - get { return maxXAdvance; } + get => maxXAdvance; set { maxXAdvance = value; } } - + public float MaxYAdvance { - get { return maxYAdvance; } + get => maxYAdvance; set { maxYAdvance = value; } } @@ -81,26 +81,14 @@ namespace Crow.Drawing this.maxYAdvance = maxYAdvance; } - public override bool Equals (object obj) - { - if (obj is FontExtents) - return this == (FontExtents) obj; - return false; - } - - public override int GetHashCode () - { - return (int) Ascent ^ (int) Descent ^ (int) Height ^ (int) MaxXAdvance ^ (int) MaxYAdvance; - } + public override int GetHashCode () => HashCode.Combine (ascent, descent, height, maxXAdvance, maxYAdvance); + public override bool Equals (object obj) => obj is FontExtents fe ? Equals (fe) : false; - public static bool operator == (FontExtents extents, FontExtents other) - { - return extents.Ascent == other.Ascent && extents.Descent == other.Descent && extents.Height == other.Height && extents.MaxXAdvance == other.MaxXAdvance && extents.MaxYAdvance == other.MaxYAdvance; - } + public bool Equals(FontExtents other) => + ascent == other.ascent && descent == other.descent && height == other.height && + maxXAdvance == other.maxXAdvance && maxYAdvance == other.maxYAdvance; - public static bool operator != (FontExtents extents, FontExtents other) - { - return !(extents == other); - } + public static bool operator == (FontExtents extents, FontExtents other) => extents.Equals (other); + public static bool operator != (FontExtents extents, FontExtents other) => !extents.Equals (other); } } diff --git a/Drawing2D/src/IContext.cs b/Drawing2D/src/IContext.cs new file mode 100644 index 00000000..d393289b --- /dev/null +++ b/Drawing2D/src/IContext.cs @@ -0,0 +1,93 @@ +// Copyright (c) 2018-2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Drawing2D +{ + public interface IContext : IDisposable + { + + IntPtr Handle { get; } + + double LineWidth { get; set; } + LineJoin LineJoin { get; set; } + LineCap LineCap { get; set; } + uint FontSize { get; set; } + string FontFace { get; set; } + Operator Operator { get; set; } + FillRule FillRule { get; set; } + FontExtents FontExtents { get; set; } + Antialias Antialias { get; set; } + TextExtents TextExtents (ReadOnlySpan s, int tabSize = 4); + void TextExtents (ReadOnlySpan s, int tabSize, out TextExtents extents); + void TextExtents (Span bytes, out TextExtents extents); + Matrix Matrix { get; set; } + void ShowText (string text); + void ShowText (ReadOnlySpan s, int tabSize = 4); + void ShowText (Span bytes); + void Save(); + void Restore(); + void Flush(); + void Clear(); + void Paint(); + void PaintWithAlpha (double alpha); + + void Arc(float xc, float yc, float radius, float a1, float a2); + void Arc(double xc, double yc, double radius, double a1, double a2); + void Arc (PointD center, double radius, double angle1, double angle2); + void ArcNegative (PointD center, double radius, double angle1, double angle2); + void ArcNegative(float xc, float yc, float radius, float a1, float a2); + void Rectangle(float x, float y, float width, float height); + void Scale(float sx, float sy); + void Translate(float dx, float dy); + void Rotate(float alpha); + void ArcNegative(double xc, double yc, double radius, double a1, double a2); + void Rectangle(double x, double y, double width, double height); + void Scale(double sx, double sy); + void Translate(double dx, double dy); + void Translate(PointD p); + void Rotate(double alpha); + void Fill(); + void FillPreserve(); + void Stroke(); + void StrokePreserve(); + void Clip(); + void ClipPreserve(); + void ResetClip(); + void NewPath(); + void NewSubPath(); + void ClosePath(); + void MoveTo(PointD p); + void MoveTo(Point p); + void MoveTo(float x, float y); + void RelMoveTo(float x, float y); + void LineTo(float x, float y); + void LineTo(Point p); + void LineTo(PointD p); + void RelLineTo(float x, float y); + void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3); + void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3); + void MoveTo(double x, double y); + void RelMoveTo(double x, double y); + void LineTo(double x, double y); + void RelLineTo(double x, double y); + void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3); + void RelCurveTo(double x1, double y1, double x2, double y2, double x3, double y3); + void SetSource(IPattern pat); + void SetSource (Color color); + void SetSource(float r, float g, float b, float a = 1f); + void SetSource(double r, double g, double b, double a = 1.0); + void SetSource(ISurface surf, float x = 0f, float y = 0f); + void SetSourceSurface(ISurface surf, float x = 0f, float y = 0f); + void RenderSvg(IntPtr svgNativeHandle, string subId = null); + Rectangle StrokeExtents (); + void SetDash (double [] dashes, double offset = 0); + float[] Dashes { set; } + + //void PushGroup (); + //void PopGroupToSource (); + } +} + diff --git a/Drawing2D/src/Matrix.cs b/Drawing2D/src/Matrix.cs new file mode 100644 index 00000000..4e6918ba --- /dev/null +++ b/Drawing2D/src/Matrix.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Drawing2D { + public struct Matrix { + float xx; float yx; + float xy; float yy; + float x0; float y0; + + public float XX, YX; + public float XY, YY; + public float X0, Y0; + + public override string ToString () { + return string.Format ($"({xx};{yx};{xy};{yy};{x0};{y0})"); + } + } +} diff --git a/Drawing2D/src/Pattern.cs b/Drawing2D/src/Pattern.cs new file mode 100644 index 00000000..f8c31438 --- /dev/null +++ b/Drawing2D/src/Pattern.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; +namespace Drawing2D +{ + public interface IPattern : IDisposable + { + Extend Extend { get; set; } + Filter Filter { get; set; } + } +} \ No newline at end of file diff --git a/Crow/src/2d/Point.cs b/Drawing2D/src/Point.cs similarity index 93% rename from Crow/src/2d/Point.cs rename to Drawing2D/src/Point.cs index c2f982bd..72bb2232 100644 --- a/Crow/src/2d/Point.cs +++ b/Drawing2D/src/Point.cs @@ -1,15 +1,12 @@ -// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// Copyright (c) 2013-2022 Bruyère Jean-Philippe 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.Linq; -using System.Text; -namespace Crow +namespace Drawing2D { - public struct Point : IEquatable, IEquatable + public struct Point : IEquatable, IEquatable { public int X, Y; diff --git a/Crow/src/2d/PointD.cs b/Drawing2D/src/PointD.cs similarity index 70% rename from Crow/src/2d/PointD.cs rename to Drawing2D/src/PointD.cs index d70e5b82..e873c72f 100644 --- a/Crow/src/2d/PointD.cs +++ b/Drawing2D/src/PointD.cs @@ -1,11 +1,11 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; -namespace Crow { - public struct PointD { +namespace Drawing2D { + public struct PointD : IEquatable, IEquatable { public double X; public double Y; public PointD (double x, double y) @@ -33,10 +33,10 @@ namespace Crow { public static PointD operator / (PointD p1, PointD p2) => new PointD (p1.X / p2.X, p1.Y / p2.Y); public static PointD operator / (PointD p, double d) => new PointD (p.X / d, p.Y / d); - public static bool operator == (PointD s1, PointD s2) => s1.X == s2.X && s1.Y == s2.Y; - public static bool operator == (PointD s, double i) => s.X == i && s.Y == i; - public static bool operator != (PointD s1, PointD s2) => !(s1.X == s2.X && s1.Y == s2.Y); - public static bool operator != (PointD s, double i) => !(s.X == i && s.Y == i); + public static bool operator == (PointD s1, PointD s2) => s1.Equals (s2); + public static bool operator == (PointD s, double i) => s.Equals (i); + public static bool operator != (PointD s1, PointD s2) => !s1.Equals (s2); + public static bool operator != (PointD s, double i) => !s.Equals (i); public static bool operator > (PointD p1, PointD p2) => p1.X > p2.X && p1.Y > p2.Y; public static bool operator > (PointD s, double i) => s.X > i && s.Y > i; public static bool operator < (PointD p1, PointD p2) => p1.X < p2.X && p1.Y < p2.Y; @@ -46,9 +46,13 @@ namespace Crow { public static bool operator <= (PointD p1, PointD p2) => p1.X <= p2.X && p1.Y <= p2.Y; public static bool operator <= (PointD s, double i) => s.X <= i && s.Y <= i; + public override int GetHashCode () => HashCode.Combine (X, Y); + public override bool Equals (object obj) => + obj is PointD p ? Equals (p) : obj is double d ? Equals (d) : false; + public bool Equals(PointD other) => X == other.X && Y == other.Y; + public bool Equals(double i) => X == i && Y == i; + public override string ToString () => string.Format ("{0},{1}", X, Y); - public override bool Equals (object obj) => obj is PointD ? this == (PointD)obj : - obj is Point && (Point)this == (Point)obj; public static PointD Parse (string s) { if (string.IsNullOrEmpty (s)) @@ -63,17 +67,5 @@ namespace Crow { throw new Exception ("Crow.PointD Parsing Error: " + s); } - public override int GetHashCode () - { -#pragma warning disable RECS0025 // Champ autre qu’en lecture seule référencé dans « GetHashCode() » - unchecked { - var hashCode = 1861411795; - hashCode = hashCode * -1521134295 + X.GetHashCode (); - - hashCode = hashCode * -1521134295 + Y.GetHashCode (); - return hashCode; - } -#pragma warning restore RECS0025 // Champ autre qu’en lecture seule référencé dans « GetHashCode() » } - } } } \ No newline at end of file diff --git a/Crow/src/2d/Rectangle.cs b/Drawing2D/src/Rectangle.cs similarity index 75% rename from Crow/src/2d/Rectangle.cs rename to Drawing2D/src/Rectangle.cs index 278decb5..ac0d83c7 100644 --- a/Crow/src/2d/Rectangle.cs +++ b/Drawing2D/src/Rectangle.cs @@ -1,12 +1,12 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Runtime.InteropServices; -namespace Crow { +namespace Drawing2D { [StructLayout(LayoutKind.Sequential)] - public struct Rectangle + public struct Rectangle : IEquatable { public static readonly Rectangle Zero = new Rectangle (0, 0, 0, 0); @@ -24,44 +24,43 @@ namespace Crow { #endregion #region PROPERTIES - [XmlIgnore]public int Left{ + public int Left{ get => X; set { X = value; } } - [XmlIgnore]public int Top{ + public int Top{ get => Y; set { Y = value; } } - [XmlIgnore] public int Right => X + Width; - [XmlIgnore]public int Bottom => Y + Height; - [XmlIgnore]public Size Size{ + public int Right => X + Width; + public int Bottom => Y + Height; + public Size Size{ get => new Size (Width, Height); set { Width = value.Width; Height = value.Height; } } - [XmlIgnore] public SizeD SizeD => new SizeD (Width, Height); - [XmlIgnore]public Point Position{ + public Point Position{ get => new Point (X, Y); set { X = value.X; Y = value.Y; } } - [XmlIgnore]public Point TopLeft{ + public Point TopLeft{ get => new Point (X, Y); set { X = value.X; Y = value.Y; } } - [XmlIgnore] public Point TopRight => new Point (Right, Y); - [XmlIgnore] public Point BottomLeft => new Point (X, Bottom); - [XmlIgnore] public Point BottomRight => new Point (Right, Bottom); - [XmlIgnore] public Point Center => new Point (Left + Width / 2, Top + Height / 2); - [XmlIgnore] public Point CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0); + public Point TopRight => new Point (Right, Y); + public Point BottomLeft => new Point (X, Bottom); + public Point BottomRight => new Point (Right, Bottom); + public Point Center => new Point (Left + Width / 2, Top + Height / 2); + public Point CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0); #endregion @@ -153,13 +152,18 @@ namespace Crow { } public static Rectangle operator + (Rectangle r, Point p) => new Rectangle (r.X + p.X, r.Y + p.Y, r.Width, r.Height); public static Rectangle operator - (Rectangle r, Point p) => new Rectangle (r.X - p.X, r.Y - p.Y, r.Width, r.Height); - public static bool operator == (Rectangle r1, Rectangle r2) => r1.TopLeft == r2.TopLeft && r1.Size == r2.Size; - public static bool operator != (Rectangle r1, Rectangle r2) => !(r1.TopLeft == r2.TopLeft && r1.Size == r2.Size); + public static bool operator == (Rectangle r1, Rectangle r2) => r1.Equals (r2); + public static bool operator != (Rectangle r1, Rectangle r2) => !r1.Equals (r2); public static implicit operator Rectangle (RectangleD r) => new Rectangle ((int)Math.Round(r.X), (int)Math.Round (r.Y), (int)Math.Round (r.Width), (int)Math.Round (r.Height)); #endregion + public override int GetHashCode () => HashCode.Combine (X, Y, Width, Height); + public override bool Equals (object obj) => obj is Rectangle r ? Equals (r) : false; + public bool Equals(Rectangle other) => + X == other.X && Y == other.Y && Width == other.Width && Height == other.Height; + public override string ToString () => $"{X},{Y},{Width},{Height}"; public static Rectangle Parse(string s) { @@ -170,20 +174,5 @@ namespace Crow { int.Parse(d[2]), int.Parse(d[3])); } - public override int GetHashCode () - { - unchecked // Overflow is fine, just wrap - { - int hash = 17; - // Suitable nullity checks etc, of course :) - hash = hash * 23 + X.GetHashCode(); - hash = hash * 23 + Y.GetHashCode(); - hash = hash * 23 + Width.GetHashCode(); - hash = hash * 23 + Height.GetHashCode(); - return hash; - } - } - public override bool Equals (object obj) => (obj == null || obj.GetType () != typeof (Rectangle)) ? - false : this == (Rectangle)obj; } } diff --git a/Drawing2D/src/RectangleD.cs b/Drawing2D/src/RectangleD.cs new file mode 100644 index 00000000..2d3f3931 --- /dev/null +++ b/Drawing2D/src/RectangleD.cs @@ -0,0 +1,156 @@ +// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +using System; +using System.Runtime.InteropServices; + +namespace Drawing2D { + [StructLayout(LayoutKind.Sequential)] + public struct RectangleD + { + public static readonly RectangleD Zero = new RectangleD (0, 0, 0, 0); + + public double X, Y, Width, Height; + + #region ctor + public RectangleD(PointD p, Size s): this (p.X, p.Y, s.Width, s.Height) { } + public RectangleD(SizeD s) : this (0, 0, s.Width, s.Height) { } + public RectangleD(double x, double y, double width, double height) { + X = x; + Y = y; + Width = width; + Height = height; + } + #endregion + + #region PROPERTIES + public double Left{ + get => X; + set { X = value; } + } + public double Top{ + get => Y; + set { Y = value; } + } + public double Right => X + Width; + public double Bottom => Y + Height; + public SizeD Size{ + get => new SizeD (Width, Height); + set { + Width = value.Width; + Height = value.Height; + } + } + public PointD Position{ + get => new PointD (X, Y); + set { + X = value.X; + Y = value.Y; + } + } + public PointD TopLeft{ + get => new PointD (X, Y); + set { + X = value.X; + Y = value.Y; + } + } + public PointD TopRight => new PointD (Right, Y); + public PointD BottomLeft => new PointD (X, Bottom); + public PointD BottomRight => new PointD (Right, Bottom); + public PointD Center => new PointD (Left + Width / 2, Top + Height / 2); + public PointD CenterD => new PointD (Left + Width / 2.0, Top + Height / 2.0); + + #endregion + + #region FUNCTIONS + public void Inflate(double xDelta, double yDelta) + { + this.X -= xDelta; + this.Width += 2 * xDelta; + this.Y -= yDelta; + this.Height += 2 * yDelta; + } + public void Inflate(double delta) + { + Inflate (delta, delta); + } + public RectangleD Inflated (double delta) => Inflated (delta, delta); + public RectangleD Inflated (double deltaX, double deltaY) { + RectangleD r = this; + r.Inflate (deltaX, deltaY); + return r; + } + public bool ContainsOrIsEqual (PointD p) => (p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height); + public bool ContainsOrIsEqual (RectangleD r) => r.TopLeft >= this.TopLeft && r.BottomRight <= this.BottomRight; + public bool Intersect(RectangleD r) + { + double maxLeft = Math.Max(this.Left, r.Left); + double minRight = Math.Min(this.Right, r.Right); + double maxTop = Math.Max(this.Top, r.Top); + double minBottom = Math.Min(this.Bottom, r.Bottom); + + return (maxLeft < minRight) && (maxTop < minBottom); + } + public RectangleD Intersection(RectangleD r) + { + RectangleD result = new RectangleD(); + + if (r.Left >= Left) + result.Left = r.Left; + else + result.TopLeft = TopLeft; + + if (r.Right >= Right) + result.Width = Right - result.Left; + else + result.Width = r.Right - result.Left; + + if (r.Top >= Top) + result.Top = r.Top; + else + result.Top = Top; + + if (r.Bottom >= Bottom) + result.Height = Bottom - result.Top; + else + result.Height = r.Bottom - result.Top; + + return result; + } + #endregion + + #region operators + public static RectangleD operator +(RectangleD r1, RectangleD r2) + { + double x = Math.Min(r1.X, r2.X); + double y = Math.Min(r1.Y, r2.Y); + double x2 = Math.Max(r1.Right, r2.Right); + double y2 = Math.Max(r1.Bottom, r2.Bottom); + return new RectangleD(x, y, x2 - x, y2 - y); + } + public static RectangleD operator + (RectangleD r, PointD p) => new RectangleD (r.X + p.X, r.Y + p.Y, r.Width, r.Height); + public static RectangleD operator - (RectangleD r, PointD p) => new RectangleD (r.X - p.X, r.Y - p.Y, r.Width, r.Height); + public static bool operator == (RectangleD r1, RectangleD r2) => r1.Equals (r2); + public static bool operator != (RectangleD r1, RectangleD r2) => !r1.Equals (r2); + + public static implicit operator RectangleD(Rectangle r) => new RectangleD(r.X,r.Y,r.Width,r.Height); + #endregion + + public override int GetHashCode () => HashCode.Combine (X, Y, Width, Height); + public override bool Equals (object obj) => obj is RectangleD r ? Equals (r) : false; + public bool Equals (RectangleD other) => + X == other.X && Y == other.Y && Width == other.Width && Height == other.Height; + + public override string ToString () => $"{X},{Y},{Width},{Height}"; + public static RectangleD Parse(string s) + { + string[] d = s.Split(new char[] { ',' }); + return new RectangleD( + double.Parse(d[0]), + double.Parse(d[1]), + double.Parse(d[2]), + double.Parse(d[3])); + } + } +} diff --git a/Crow/src/2d/Size.cs b/Drawing2D/src/Size.cs similarity index 96% rename from Crow/src/2d/Size.cs rename to Drawing2D/src/Size.cs index ee023285..acd5c06c 100644 --- a/Crow/src/2d/Size.cs +++ b/Drawing2D/src/Size.cs @@ -1,13 +1,13 @@ -// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; -namespace Crow +namespace Drawing2D { public struct Size : IEquatable, IEquatable - { + { public int Width, Height; #region CTOR @@ -56,9 +56,10 @@ namespace Crow public override int GetHashCode () => HashCode.Combine (Width, Height); public override bool Equals (object obj) => obj is Size s ? Equals(s) : false; + public override string ToString () => $"{Width},{Height}"; public static Size Parse(string s) - { + { ReadOnlySpan tmp = s.AsSpan (); if (tmp.Length == 0) return default (Size); diff --git a/Crow/src/2d/SizeD.cs b/Drawing2D/src/SizeD.cs similarity index 71% rename from Crow/src/2d/SizeD.cs rename to Drawing2D/src/SizeD.cs index 2dbdb02b..dd466491 100644 --- a/Crow/src/2d/SizeD.cs +++ b/Drawing2D/src/SizeD.cs @@ -1,10 +1,11 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com +// Copyright (c) 2013-2022 Bruyère Jean-Philippe jp_bruyere@hotmail.com // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +using System; -namespace Crow +namespace Drawing2D { - public struct SizeD { + public struct SizeD : IEquatable, IEquatable { public static SizeD Zero => new SizeD (0, 0); public double Width, Height; @@ -28,8 +29,8 @@ namespace Crow public static implicit operator string (SizeD s) => s.ToString (); public static implicit operator SizeD (string s) => string.IsNullOrEmpty (s) ? Zero : Parse (s); - public static bool operator == (SizeD s1, SizeD s2) => (s1.Width == s2.Width && s1.Height == s2.Height); - public static bool operator != (SizeD s1, SizeD s2) => (s1.Width == s2.Width && s1.Height == s2.Height); + public static bool operator == (SizeD s1, SizeD s2) => s1.Equals (s2); + public static bool operator != (SizeD s1, SizeD s2) => !s1.Equals (s2); public static bool operator > (SizeD s1, SizeD s2) => (s1.Width > s2.Width && s1.Height > s2.Height); public static bool operator >= (SizeD s1, SizeD s2) => (s1.Width >= s2.Width && s1.Height >= s2.Height); public static bool operator < (SizeD s1, SizeD s2) => (s1.Width < s2.Width) ? s1.Height <= s2.Height : @@ -39,26 +40,19 @@ namespace Crow public static bool operator > (SizeD s, double i) => s.Width > i && s.Height > i; public static bool operator >= (SizeD s, double i) => s.Width >= i && s.Height >= i; public static bool operator <= (SizeD s1, SizeD s2) => (s1.Width <= s2.Width && s1.Height <= s2.Height); - public static bool operator == (SizeD s, double i) => (s.Width == i && s.Height == i); - public static bool operator != (SizeD s, double i) => (s.Width == i && s.Height == i); + public static bool operator == (SizeD s, double i) => s.Equals (i); + public static bool operator != (SizeD s, double i) => !s.Equals (i); public static SizeD operator + (SizeD s1, SizeD s2) => new SizeD (s1.Width + s2.Width, s1.Height + s2.Height); public static SizeD operator + (SizeD s, double i) => new SizeD (s.Width + i, s.Height + i); public static SizeD operator * (SizeD s, double i) => new SizeD (s.Width * i, s.Height * i); public static SizeD operator / (SizeD s, double i) => new SizeD (s.Width / i, s.Height / i); #endregion - public override int GetHashCode () - { - unchecked // Overflow is fine, just wrap - { - int hash = 17; - // Suitable nullity checks etc, of course :) - hash = hash * 23 + Width.GetHashCode (); - hash = hash * 23 + Height.GetHashCode (); - return hash; - } - } - public override bool Equals (object obj) => (obj == null || obj.GetType () != typeof (SizeD)) ? false : this == (SizeD)obj; + public override int GetHashCode () => HashCode.Combine (Width, Height); + public override bool Equals (object obj) => obj is SizeD s ? Equals (s) : false; + public bool Equals(SizeD other) => Width == other.Width && Height == other.Height; + public bool Equals(double other) => Width == other && Height == other; + public override string ToString () => $"{Width},{Height}"; public static SizeD Parse (string s) { diff --git a/Drawing2D/src/Surface.cs b/Drawing2D/src/Surface.cs new file mode 100644 index 00000000..696f1ae2 --- /dev/null +++ b/Drawing2D/src/Surface.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Drawing2D +{ + public interface ISurface: IDisposable + { + //IntPtr Handle { get; } + int Width { get; } + int Height { get; } + + void Flush (); + + void WriteToPng (string path); + void WriteTo (IntPtr bitmap); + void Clear (); + ISurface CreateSimilar (int width, int height); + } +} + diff --git a/Drawing2D/src/TextExtents.cs b/Drawing2D/src/TextExtents.cs new file mode 100644 index 00000000..7d1939b7 --- /dev/null +++ b/Drawing2D/src/TextExtents.cs @@ -0,0 +1,60 @@ +// Copyright (c) 2018-2022 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; +using System.Runtime.InteropServices; + +namespace Drawing2D +{ + [StructLayout (LayoutKind.Sequential)] + public struct TextExtents : IEquatable + { + float xBearing; + float yBearing; + float width; + float height; + float xAdvance; + float yAdvance; + + public float XBearing { + get => xBearing; + set { xBearing = value; } + } + + public float YBearing { + get => yBearing; + set { yBearing = value; } + } + + public float Width { + get => width; + set { width = value; } + } + + public float Height { + get => height; + set { height = value; } + } + + public float XAdvance { + get => xAdvance; + set { xAdvance = value; } + } + + public float YAdvance { + get => yAdvance; + set { yAdvance = value; } + } + + public override int GetHashCode () => + HashCode.Combine (xBearing, yBearing, width, height, xAdvance, yAdvance); + public override bool Equals (object obj) => obj is TextExtents te ? Equals (te) : false; + + public bool Equals(TextExtents other) => + xBearing == other.xBearing && yBearing == other.yBearing && width == other.width && height == other.height && + xAdvance == other.xAdvance && yAdvance == other.yAdvance; + public static bool operator == (TextExtents extents, TextExtents other) => extents.Equals (other); + public static bool operator != (TextExtents extents, TextExtents other )=> !extents.Equals (other); + } +} diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs index 49663438..4f3d79f8 100644 --- a/Samples/ShowCase/ShowCase.cs +++ b/Samples/ShowCase/ShowCase.cs @@ -20,11 +20,13 @@ namespace ShowCase class Showcase : SampleBaseForEditor { DbgEvtType[] logEvts = { - DbgEvtType.MouseEnter, + DbgEvtType.IFace, + DbgEvtType.Widget + /*DbgEvtType.MouseEnter, DbgEvtType.MouseLeave, DbgEvtType.WidgetMouseDown, DbgEvtType.WidgetMouseUp, - DbgEvtType.WidgetMouseClick, + DbgEvtType.WidgetMouseClick,*/ }; static void Main () { diff --git a/Samples/common/src/Editor.cs b/Samples/common/src/Editor.cs index 90335d83..0de7af55 100644 --- a/Samples/common/src/Editor.cs +++ b/Samples/common/src/Editor.cs @@ -6,13 +6,15 @@ using System; using Glfw; using Crow.Text; using System.Collections.Generic; -using Crow.Drawing; + using System.Threading.Tasks; using System.Linq; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Collections; +using Drawing2D; + namespace Crow { public class Editor : TextBox { @@ -293,7 +295,7 @@ namespace Crow base.onKeyDown(sender, e); } - protected override void drawContent (Context gr) { + protected override void drawContent (IContext gr) { try { lock(TokenMutex) { if (source == null || source.Tokens.Length == 0) { diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 91b787fb..6d06dba4 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -10,7 +10,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; -using Crow.Drawing; + using System.Diagnostics; namespace Samples @@ -390,7 +390,7 @@ namespace Samples initCommands(); base.OnInitialized(); } - protected override void processDrawing(Context ctx) + protected override void processDrawing(IContext ctx) { base.processDrawing(ctx); } diff --git a/Samples/common/src/TestWidget.cs b/Samples/common/src/TestWidget.cs index bf2f6bd0..40970d80 100644 --- a/Samples/common/src/TestWidget.cs +++ b/Samples/common/src/TestWidget.cs @@ -1,11 +1,11 @@ //Tutorial using Crow; -using Crow.Drawing; + using Glfw; namespace TestWidget { public class TestWidget : Widget { - protected override void onDraw (Context gr) { + protected override void onDraw (IContext gr) { base.onDraw (gr); gr.SetSource (myColor); gr.Rectangle (ClientRectangle); -- 2.47.3