]> O.S.I.I.S - jp/crow.git/commitdiff
update Drawing2d package version, crow version v1.0.1 v1.0.1-beta
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 23 Dec 2021 05:22:00 +0000 (06:22 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 23 Dec 2021 05:22:00 +0000 (06:22 +0100)
105 files changed:
Backends/CairoBackend/Crow.CairoBackend.csproj [new file with mode: 0644]
Backends/CairoBackend/src/Cairo.cs [new file with mode: 0644]
Backends/CairoBackend/src/CairoBackendBase.cs [new file with mode: 0644]
Backends/CairoBackend/src/CairoDebug.cs [new file with mode: 0644]
Backends/CairoBackend/src/Content.cs [new file with mode: 0644]
Backends/CairoBackend/src/Context.cs [new file with mode: 0644]
Backends/CairoBackend/src/DRMDevice.cs [new file with mode: 0644]
Backends/CairoBackend/src/DRMSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/Device.cs [new file with mode: 0644]
Backends/CairoBackend/src/DirectFBSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/Distance.cs [new file with mode: 0644]
Backends/CairoBackend/src/EGLDevice.cs [new file with mode: 0644]
Backends/CairoBackend/src/EglBackend.cs [new file with mode: 0644]
Backends/CairoBackend/src/FontFace.cs [new file with mode: 0644]
Backends/CairoBackend/src/FontOptions.cs [new file with mode: 0644]
Backends/CairoBackend/src/FontType.cs [new file with mode: 0644]
Backends/CairoBackend/src/GLDevice.cs [new file with mode: 0644]
Backends/CairoBackend/src/GLSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/GLXDevice.cs [new file with mode: 0644]
Backends/CairoBackend/src/GlitzSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/Glyph.cs [new file with mode: 0644]
Backends/CairoBackend/src/Gradient.cs [new file with mode: 0644]
Backends/CairoBackend/src/HintMetrics.cs [new file with mode: 0644]
Backends/CairoBackend/src/HintStyle.cs [new file with mode: 0644]
Backends/CairoBackend/src/ImageBackend.cs [new file with mode: 0644]
Backends/CairoBackend/src/ImageSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/LinearGradient.cs [new file with mode: 0644]
Backends/CairoBackend/src/Matrix.cs [new file with mode: 0644]
Backends/CairoBackend/src/MeshPattern.cs [new file with mode: 0644]
Backends/CairoBackend/src/NativeMethods-internal.cs [new file with mode: 0644]
Backends/CairoBackend/src/NativeMethods.cs [new file with mode: 0644]
Backends/CairoBackend/src/PSSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/Path.cs [new file with mode: 0644]
Backends/CairoBackend/src/Pattern.cs [new file with mode: 0644]
Backends/CairoBackend/src/PdfSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/RadialGradient.cs [new file with mode: 0644]
Backends/CairoBackend/src/Region.cs [new file with mode: 0644]
Backends/CairoBackend/src/ScaledFont.cs [new file with mode: 0644]
Backends/CairoBackend/src/SolidPattern.cs [new file with mode: 0644]
Backends/CairoBackend/src/Status.cs [new file with mode: 0644]
Backends/CairoBackend/src/SubpixelOrder.cs [new file with mode: 0644]
Backends/CairoBackend/src/Surface.cs [new file with mode: 0644]
Backends/CairoBackend/src/SurfacePattern.cs [new file with mode: 0644]
Backends/CairoBackend/src/SurfaceType.cs [new file with mode: 0644]
Backends/CairoBackend/src/SvgSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/SvgVersion.cs [new file with mode: 0644]
Backends/CairoBackend/src/WGLDevice.cs [new file with mode: 0644]
Backends/CairoBackend/src/Win32Surface.cs [new file with mode: 0644]
Backends/CairoBackend/src/XcbSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/XlibSurface.cs [new file with mode: 0644]
Backends/CairoBackend/src/rsvg/SvgHandle.cs [new file with mode: 0644]
Backends/Crow.CairoBackend/Crow.CairoBackend.csproj [deleted file]
Backends/Crow.CairoBackend/src/Cairo.cs [deleted file]
Backends/Crow.CairoBackend/src/CairoBackendBase.cs [deleted file]
Backends/Crow.CairoBackend/src/CairoDebug.cs [deleted file]
Backends/Crow.CairoBackend/src/Content.cs [deleted file]
Backends/Crow.CairoBackend/src/Context.cs [deleted file]
Backends/Crow.CairoBackend/src/DRMDevice.cs [deleted file]
Backends/Crow.CairoBackend/src/DRMSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/Device.cs [deleted file]
Backends/Crow.CairoBackend/src/DirectFBSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/Distance.cs [deleted file]
Backends/Crow.CairoBackend/src/EGLDevice.cs [deleted file]
Backends/Crow.CairoBackend/src/EglBackend.cs [deleted file]
Backends/Crow.CairoBackend/src/FontFace.cs [deleted file]
Backends/Crow.CairoBackend/src/FontOptions.cs [deleted file]
Backends/Crow.CairoBackend/src/FontType.cs [deleted file]
Backends/Crow.CairoBackend/src/GLDevice.cs [deleted file]
Backends/Crow.CairoBackend/src/GLSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/GLXDevice.cs [deleted file]
Backends/Crow.CairoBackend/src/GlitzSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/Glyph.cs [deleted file]
Backends/Crow.CairoBackend/src/Gradient.cs [deleted file]
Backends/Crow.CairoBackend/src/HintMetrics.cs [deleted file]
Backends/Crow.CairoBackend/src/HintStyle.cs [deleted file]
Backends/Crow.CairoBackend/src/ImageBackend.cs [deleted file]
Backends/Crow.CairoBackend/src/ImageSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/LinearGradient.cs [deleted file]
Backends/Crow.CairoBackend/src/Matrix.cs [deleted file]
Backends/Crow.CairoBackend/src/MeshPattern.cs [deleted file]
Backends/Crow.CairoBackend/src/NativeMethods-internal.cs [deleted file]
Backends/Crow.CairoBackend/src/NativeMethods.cs [deleted file]
Backends/Crow.CairoBackend/src/PSSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/Path.cs [deleted file]
Backends/Crow.CairoBackend/src/Pattern.cs [deleted file]
Backends/Crow.CairoBackend/src/PdfSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/RadialGradient.cs [deleted file]
Backends/Crow.CairoBackend/src/Region.cs [deleted file]
Backends/Crow.CairoBackend/src/ScaledFont.cs [deleted file]
Backends/Crow.CairoBackend/src/SolidPattern.cs [deleted file]
Backends/Crow.CairoBackend/src/Status.cs [deleted file]
Backends/Crow.CairoBackend/src/SubpixelOrder.cs [deleted file]
Backends/Crow.CairoBackend/src/Surface.cs [deleted file]
Backends/Crow.CairoBackend/src/SurfacePattern.cs [deleted file]
Backends/Crow.CairoBackend/src/SurfaceType.cs [deleted file]
Backends/Crow.CairoBackend/src/SvgSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/SvgVersion.cs [deleted file]
Backends/Crow.CairoBackend/src/WGLDevice.cs [deleted file]
Backends/Crow.CairoBackend/src/Win32Surface.cs [deleted file]
Backends/Crow.CairoBackend/src/XcbSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/XlibSurface.cs [deleted file]
Backends/Crow.CairoBackend/src/rsvg/SvgHandle.cs [deleted file]
Backends/Directory.Build.props
Drawing2D/Drawing2D.csproj
Samples/Directory.Build.props

diff --git a/Backends/CairoBackend/Crow.CairoBackend.csproj b/Backends/CairoBackend/Crow.CairoBackend.csproj
new file mode 100644 (file)
index 0000000..fc2f06b
--- /dev/null
@@ -0,0 +1,31 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+         <TargetFramework>netcoreapp3.1</TargetFramework>
+
+               <AssemblyVersion>1.0.1</AssemblyVersion>
+               <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
+
+               <Title>C.R.O.W Cairo Backend</Title>
+               <Description>C.R.O.W. is a widget toolkit and rendering engine developed in C# with templates, styles, compositing, and bindings.</Description>
+               <PackageTags>Crow GUI Backend cairo</PackageTags>
+               <PackageReleaseNotes>
+               </PackageReleaseNotes>
+         <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
+  </PropertyGroup>
+
+  <ItemGroup>
+       <Compile Include="src\**\*.cs" Exclude="src\NativeMethods-internal.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="glfw-sharp" Version="$(GlfwSharpVersion)" />
+    <PackageReference Include="OpenGL.Net" Version="0.8.4" />
+    <ProjectReference Include="..\..\Drawing2D\Drawing2D.csproj" />
+  </ItemGroup>
+
+       <PropertyGroup Condition=" '$(CrowStbSharp)' == 'true'">
+               <DefineConstants>$(DefineConstants);STB_SHARP</DefineConstants>
+       </PropertyGroup>
+
+</Project>
diff --git a/Backends/CairoBackend/src/Cairo.cs b/Backends/CairoBackend/src/Cairo.cs
new file mode 100644 (file)
index 0000000..55f1335
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//          John Luke (john.luke@gmail.com)
+//          Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.CairoBackend
+{
+       public static class CairoAPI {
+               static public int Version {
+                       get {
+                               return NativeMethods.cairo_version ();
+                       }
+               }
+
+               static public string VersionString {
+                       get {
+                               IntPtr x = NativeMethods.cairo_version_string ();
+                               return Marshal.PtrToStringAnsi (x);
+                       }
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/CairoBackendBase.cs b/Backends/CairoBackend/src/CairoBackendBase.cs
new file mode 100644 (file)
index 0000000..c7821ee
--- /dev/null
@@ -0,0 +1,142 @@
+using System;
+using System.IO;
+using Drawing2D;
+using Glfw;
+
+namespace Crow.CairoBackend
+{
+       public abstract class CairoBackendBase : CrowBackend {
+               /// <summary>
+               /// Main rendering surface, usualy an accelerated window surface
+               /// </summary>
+               protected Surface surf;
+               protected IRegion clipping;
+               /// <summary> Global font rendering settings for Cairo </summary>
+               FontOptions FontRenderingOptions;
+               /// <summary> Global font rendering settings for Cairo </summary>
+               Antialias Antialias = Antialias.Subpixel;
+               bool disposeContextOnFlush;
+               protected CairoBackendBase (int width, int height, IntPtr nativeWindow)
+               : base (width, height, nativeWindow)
+               {
+                       FontRenderingOptions = new FontOptions ();
+                       FontRenderingOptions.Antialias = Antialias.Subpixel;
+                       FontRenderingOptions.HintMetrics = HintMetrics.On;
+                       FontRenderingOptions.HintStyle = HintStyle.Full;
+                       FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default;
+               }
+               ~CairoBackendBase ()
+               {
+                       Dispose (false);
+               }
+               public override abstract ISurface CreateSurface(int width, int height);
+               public override abstract ISurface CreateSurface(byte[] data, int width, int height);
+               public override ISurface MainSurface => surf;
+               public override IRegion CreateRegion () => new Region ();
+               public override IContext CreateContext (ISurface surf)
+               {
+                       Context gr = new Context (surf as Surface);
+                       gr.FontOptions = FontRenderingOptions;
+                       gr.Antialias = Antialias;
+                       return gr;
+               }
+               //IPattern CreatePattern (PatternType patternType);
+               public override IGradient CreateGradient (GradientType gradientType, Rectangle bounds)
+               {
+                       switch (gradientType) {
+                       case GradientType.Vertical:
+                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Left, bounds.Bottom);
+                       case GradientType.Horizontal:
+                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Right, bounds.Top);
+                       case GradientType.Oblic:
+                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Right, bounds.Bottom);
+                       case GradientType.Radial:
+                               throw new NotImplementedException ();
+                       }
+                       return null;
+               }
+               public override byte[] LoadBitmap (Stream stream, out Size dimensions)
+               {
+                       byte[] image;
+#if STB_SHARP
+                       StbImageSharp.ImageResult stbi = StbImageSharp.ImageResult.FromStream (stream, StbImageSharp.ColorComponents.RedGreenBlueAlpha);
+                       image = new byte[stbi.Data.Length];
+                       //rgba to argb for cairo.
+                       for (int i = 0; i < stbi.Data.Length; i += 4) {
+                               image[i] = stbi.Data[i + 2];
+                               image[i + 1] = stbi.Data[i + 1];
+                               image[i + 2] = stbi.Data[i];
+                               image[i + 3] = stbi.Data[i + 3];
+                       }
+                       dimensions = new Size (stbi.Width, stbi.Height);
+#else
+                       using (StbImage stbi = new StbImage (stream)) {
+                               image = new byte [stbi.Size];
+                               for (int i = 0; i < stbi.Size; i+=4) {
+                                       //rgba to argb for cairo. ???? looks like bgra to me.
+                                       image [i] = Marshal.ReadByte (stbi.Handle, i + 2);
+                                       image [i + 1] = Marshal.ReadByte (stbi.Handle, i + 1);
+                                       image [i + 2] = Marshal.ReadByte (stbi.Handle, i);
+                                       image [i + 3] = Marshal.ReadByte (stbi.Handle, i + 3);
+                               }
+                               dimensions = new Size (stbi.Width, stbi.Height);
+                       }
+#endif
+                       return image;
+               }
+               public override ISvgHandle LoadSvg(Stream stream)
+               {
+                       using (BinaryReader sr = new BinaryReader (stream))
+                               return new SvgHandle (sr.ReadBytes ((int)stream.Length));
+               }
+               public override ISvgHandle LoadSvg(string svgFragment) =>
+                       new SvgHandle (System.Text.Encoding.Unicode.GetBytes (svgFragment));
+               protected void clear(IContext ctx) {
+                       for (int i = 0; i < clipping.NumRectangles; i++)
+                               ctx.Rectangle (clipping.GetRectangle (i));
+
+                       ctx.ClipPreserve ();
+                       ctx.Operator = Operator.Clear;
+                       ctx.Fill ();
+                       ctx.Operator = Operator.Over;
+               }
+               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
+               {
+                       this.clipping = clipping;
+                       IContext ctx = existingContext;
+                       if (ctx == null) {
+                               disposeContextOnFlush = true;
+                               ctx = new Context (surf);
+                       } else
+                               disposeContextOnFlush = false;
+                       return ctx;
+               }
+               public override void FlushUIFrame(IContext ctx)
+               {
+                       if (disposeContextOnFlush)
+                               ctx.Dispose ();
+                       clipping = null;
+               }
+               public override void ResizeMainSurface (int width, int height)
+               {
+                       surf.Resize (width, height);
+               }
+
+               #region IDispose implementation
+               public override void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!isDisposed && disposing) {
+                               surf.Dispose ();
+                               FontRenderingOptions.Dispose ();
+                       }
+                       isDisposed = true;
+               }
+               #endregion
+       }
+}
+
diff --git a/Backends/CairoBackend/src/CairoDebug.cs b/Backends/CairoBackend/src/CairoDebug.cs
new file mode 100644 (file)
index 0000000..c3e92be
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// CairoDebug.cs
+//
+// Author:
+//   Michael Hutchinson (mhutch@xamarin.com)
+//
+// Copyright (C) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       static class CairoDebug
+       {
+               static System.Collections.Generic.Dictionary<IntPtr,string> traces;
+
+               public static readonly bool Enabled;
+
+               static CairoDebug ()
+               {
+                       var dbg = Environment.GetEnvironmentVariable ("MONO_CAIRO_DEBUG_DISPOSE");
+                       if (dbg == null)
+                               return;
+                       Enabled = true;
+                       traces = new System.Collections.Generic.Dictionary<IntPtr,string> ();
+               }
+
+               public static void OnAllocated (IntPtr obj)
+               {
+                       if (!Enabled)
+                               throw new InvalidOperationException ();
+
+                       traces[obj] = Environment.StackTrace;
+               }
+
+               public static void OnDisposed<T> (IntPtr obj, bool disposing)
+               {
+                       if (disposing && !Enabled)
+                               throw new InvalidOperationException ();
+
+                       if (Environment.HasShutdownStarted)
+                               return;
+
+                       if (!disposing) {
+                               System.Diagnostics.Debug.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
+                               if (Enabled) {
+                                       string val;
+                                       if (traces.TryGetValue (obj, out val)) {
+                                               System.Diagnostics.Debug.WriteLine ("Allocated from:");
+                                               System.Diagnostics.Debug.WriteLine (val);
+                                       }
+                               } else {
+                                       System.Diagnostics.Debug.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
+                               }
+                       }
+
+                       if (Enabled)
+                               traces.Remove (obj);
+               }
+       }
+
+}
diff --git a/Backends/CairoBackend/src/Content.cs b/Backends/CairoBackend/src/Content.cs
new file mode 100644 (file)
index 0000000..9096bf0
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Mono.Cairo.Content.cs
+//
+// Authors:
+//   Duncan Mak (duncan@ximian.com)
+//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       //[Flags]
+       public enum Content
+       {
+               Color = 0x1000,
+               Alpha = 0x2000,
+               ColorAlpha = 0x3000,
+       }
+}
diff --git a/Backends/CairoBackend/src/Context.cs b/Backends/CairoBackend/src/Context.cs
new file mode 100644 (file)
index 0000000..c15ecaa
--- /dev/null
@@ -0,0 +1,667 @@
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+//   Duncan Mak (duncan@ximian.com)
+//   Miguel de Icaza (miguel@novell.com)
+//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//   Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       public class Context : IContext
+       {
+               internal IntPtr handle = IntPtr.Zero;
+
+               static int native_glyph_size, c_compiler_long_size;
+
+               static Context ()
+               {
+                       //
+                       // This is used to determine what kind of structure
+                       // we should use to marshal Glyphs, as the public
+                       // definition in Cairo uses `long', which can be
+                       // 32 bits or 64 bits depending on the platform.
+                       //
+                       // We assume that sizeof(long) == sizeof(void*)
+                       // except in the case of Win64 where sizeof(long)
+                       // is 32 bits
+                       //
+                       int ptr_size = Marshal.SizeOf (typeof (IntPtr));
+
+                       PlatformID platform = Environment.OSVersion.Platform;
+                       if (platform == PlatformID.Win32NT ||
+                           platform == PlatformID.Win32S ||
+                           platform == PlatformID.Win32Windows ||
+                           platform == PlatformID.WinCE ||
+                           ptr_size == 4){
+                               c_compiler_long_size = 4;
+                               native_glyph_size = Marshal.SizeOf (typeof (NativeGlyph_4byte_longs));
+                       } else {
+                               c_compiler_long_size = 8;
+                               native_glyph_size = Marshal.SizeOf (typeof (Glyph));
+                       }
+               }
+
+               internal Context (Surface surface) : this (NativeMethods.cairo_create (surface.handle), true)
+               {
+               }
+
+
+               internal Context (IntPtr handle, bool owner)
+               {
+                       this.handle = handle;
+                       if (!owner)
+                               NativeMethods.cairo_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               [Obsolete]
+               internal Context (IntPtr state) : this (state, true)
+               {
+               }
+
+               ~Context ()
+               {
+                       Dispose (false);
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Context> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_destroy (handle);
+                       handle = IntPtr.Zero;
+
+               }
+
+               public void Save ()
+               {
+                       NativeMethods.cairo_save (handle);
+               }
+
+               public void Restore ()
+               {
+                       NativeMethods.cairo_restore (handle);
+               }
+
+               public Antialias Antialias {
+                       get { return NativeMethods.cairo_get_antialias (handle); }
+                       set { NativeMethods.cairo_set_antialias (handle, value); }
+               }
+
+               public Status Status {
+                       get {
+                               return NativeMethods.cairo_status (handle);
+                       }
+               }
+               public string StatusString {
+                       get {
+                               return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (Status));
+                       }
+               }
+
+               public Operator Operator {
+                       set => NativeMethods.cairo_set_operator (handle, value);
+                       get => NativeMethods.cairo_get_operator (handle);
+               }
+               public double Tolerance {
+                       get => NativeMethods.cairo_get_tolerance (handle);
+                       set => NativeMethods.cairo_set_tolerance (handle, value);
+               }
+               public FillRule FillRule {
+                       set => NativeMethods.cairo_set_fill_rule (handle, value);
+                       get => NativeMethods.cairo_get_fill_rule (handle);
+               }
+               public double LineWidth {
+                       set => NativeMethods.cairo_set_line_width (handle, value);
+                       get => NativeMethods.cairo_get_line_width (handle);
+               }
+               public LineCap LineCap {
+                       set => NativeMethods.cairo_set_line_cap (handle, value);
+                       get => NativeMethods.cairo_get_line_cap (handle);
+               }
+               public LineJoin LineJoin {
+                       set => NativeMethods.cairo_set_line_join (handle, value);
+                       get => NativeMethods.cairo_get_line_join (handle);
+               }
+               public double MiterLimit {
+                       set => NativeMethods.cairo_set_miter_limit (handle, value);
+                       get => NativeMethods.cairo_get_miter_limit (handle);
+               }
+
+               public void SetDash (double [] dashes, double offset = 0)
+                       => NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset);
+
+               public void SetSource (Pattern source)
+                       => NativeMethods.cairo_set_source (handle, source.handle);
+               public Pattern GetSource ()
+               {
+                       var ptr = NativeMethods.cairo_get_source (handle);
+                       return Pattern.Lookup (ptr, false);
+               }
+
+
+               public PointD CurrentPoint {
+                       get {
+                               double x, y;
+                               NativeMethods.cairo_get_current_point (handle, out x, out y);
+                               return new PointD (x, y);
+                       }
+               }
+
+               public bool HasCurrentPoint => NativeMethods.cairo_has_current_point (handle);
+               public Surface GetTarget () =>  Surface.Lookup (NativeMethods.cairo_get_target (handle), false);
+               public void SetTarget (Surface target)
+               {
+                       if (handle != IntPtr.Zero)
+                               NativeMethods.cairo_destroy (handle);
+                       handle = NativeMethods.cairo_create (target.handle);
+               }
+               public ScaledFont GetScaledFont ()
+                       => new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false);
+               public void SetScaledFont (ScaledFont font)
+                       => NativeMethods.cairo_set_scaled_font (handle, font.Handle);
+               public uint ReferenceCount => NativeMethods.cairo_get_reference_count (handle);
+               public void SetSource (Color color)
+                       => NativeMethods.cairo_set_source_rgba (handle, color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
+               public void SetSource (double r, double g, double b)
+               {
+                       NativeMethods.cairo_set_source_rgb (handle, r, g, b);
+               }
+
+               public void SetSource (double r, double g, double b, double a)
+               {
+                       NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
+               }
+
+               //[Obsolete ("Use SetSource method (with double parameters)")]
+               public void SetSource (Surface source, int x = 0, int y = 0)
+               {
+                       NativeMethods.cairo_set_source_surface (handle, source.handle, x, y);
+               }
+
+               public void SetSource (Surface source, double x, double y)
+               {
+                       NativeMethods.cairo_set_source_surface (handle, source.handle, x, y);
+               }
+
+               public void SetSource (Surface source)
+               {
+                       NativeMethods.cairo_set_source_surface (handle, source.handle, 0, 0);
+               }
+
+               #region Path methods
+               public void NewPath () => NativeMethods.cairo_new_path (handle);
+               public void NewSubPath () => NativeMethods.cairo_new_sub_path (handle);
+               public void MoveTo (PointD p) => MoveTo (p.X, p.Y);
+               public void MoveTo (double x, double y) => NativeMethods.cairo_move_to (handle, x, y);
+               public void LineTo (PointD p) => LineTo (p.X, p.Y);
+               public void LineTo (double x, double y) => NativeMethods.cairo_line_to (handle, x, y);
+               public void CurveTo (PointD p1, PointD p2, PointD p3) => CurveTo (p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
+               public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
+                       => NativeMethods.cairo_curve_to (handle, x1, y1, x2, y2, x3, y3);
+               public void RelMoveTo (Distance d) => RelMoveTo (d.Dx, d.Dy);
+               public void RelMoveTo (double dx, double dy) => NativeMethods.cairo_rel_move_to (handle, dx, dy);
+               public void RelLineTo (Distance d) => RelLineTo (d.Dx, d.Dy);
+               public void RelLineTo (double dx, double dy) => NativeMethods.cairo_rel_line_to (handle, dx, dy);
+               public void RelCurveTo (Distance d1, Distance d2, Distance d3)
+                       => RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
+               public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+                       => NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
+               public void Arc (double xc, double yc, double radius, double angle1, double angle2)
+                       => NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
+               public void Arc (PointD center, double radius, double angle1, double angle2)
+                       => NativeMethods.cairo_arc (handle, center.X, center.Y, radius, angle1, angle2);
+               public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
+                       => NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
+               public void ArcNegative (PointD center, double radius, double angle1, double angle2)
+                       => NativeMethods.cairo_arc_negative (handle, center.X, center.Y, radius, angle1, angle2);
+               public void Rectangle (Rectangle rectangle)
+                       => Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+               public void Rectangle (RectangleD rectangle)
+                       => Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+               public void Rectangle (PointD p, double width, double height)
+                       => Rectangle (p.X, p.Y, width, height);
+               public void Rectangle (double x, double y, double width, double height)
+                       => NativeMethods.cairo_rectangle (handle, x, y, width, height);
+               public void ClosePath () => NativeMethods.cairo_close_path (handle);
+               public Path CopyPath () => new Path (NativeMethods.cairo_copy_path (handle));
+               public Path CopyPathFlat () => new Path (NativeMethods.cairo_copy_path_flat (handle));
+               public void AppendPath (Path path) => NativeMethods.cairo_append_path (handle, path.Handle);
+               #endregion
+
+               #region Painting Methods
+               public void Paint () => NativeMethods.cairo_paint (handle);
+               public void PaintWithAlpha (double alpha) => NativeMethods.cairo_paint_with_alpha (handle, alpha);
+               public void Mask (Pattern pattern) => NativeMethods.cairo_mask (handle, pattern.handle);
+               public void MaskSurface (Surface surface, double surface_x, double surface_y)
+                       => NativeMethods.cairo_mask_surface (handle, surface.handle, surface_x, surface_y);
+               public void Stroke () => NativeMethods.cairo_stroke (handle);
+               public void StrokePreserve () => NativeMethods.cairo_stroke_preserve (handle);
+               public Rectangle StrokeExtents ()
+               {
+                       double x1, y1, x2, y2;
+                       NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2);
+                       return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
+               }
+
+               public void Fill () => NativeMethods.cairo_fill (handle);
+               public void FillPreserve () => NativeMethods.cairo_fill_preserve (handle);
+               public Rectangle FillExtents ()
+               {
+                       double x1, y1, x2, y2;
+                       NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2);
+                       return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
+               }
+
+               #endregion
+
+               public void Clip () => NativeMethods.cairo_clip (handle);
+               public void ClipPreserve () => NativeMethods.cairo_clip_preserve (handle);
+               public void ResetClip () => NativeMethods.cairo_reset_clip (handle);
+               public bool InClip (double x, double y) => NativeMethods.cairo_in_clip (handle, x, y);
+               /*public RectangleList GetClipRectangles (){
+                       return (RectangleList)Marshal.PtrToStructure (NativeMethods.cairo_copy_clip_rectangle_list (handle), typeof(RectangleList));
+               }*/
+               public void ClipExtendRectangle (){
+                       double x1, y1, x2, y2;
+                       NativeMethods.cairo_clip_extents (handle, out x1, out y1, out x2, out y2);
+                       NativeMethods.cairo_rectangle (handle, x1, y1, x2 - x1, y2 - y1);
+               }
+               public bool InStroke (double x, double y) => NativeMethods.cairo_in_stroke (handle, x, y);
+               public bool InFill (double x, double y) => NativeMethods.cairo_in_fill (handle, x, y);
+               public Pattern PopGroup () => Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
+               public void PopGroupToSource () => NativeMethods.cairo_pop_group_to_source (handle);
+               public void PushGroup () => NativeMethods.cairo_push_group (handle);
+               public void PushGroup (Content content) => NativeMethods.cairo_push_group_with_content (handle, content);
+               public Surface GetGroupTarget ()
+               {
+                       IntPtr surface = NativeMethods.cairo_get_group_target (handle);
+                       return Surface.Lookup (surface, false);
+               }
+
+               public void Rotate (double angle) => NativeMethods.cairo_rotate (handle, angle);
+               public void Scale (double sx, double sy) => NativeMethods.cairo_scale (handle, sx, sy);
+               public void Translate (double tx, double ty) => NativeMethods.cairo_translate (handle, tx, ty);
+               public void Transform (Matrix m) => NativeMethods.cairo_transform (handle, m);
+
+               [Obsolete("Use UserToDevice instead")]
+               public void TransformPoint (ref double x, ref double y)
+               {
+                       NativeMethods.cairo_user_to_device (handle, ref x, ref y);
+               }
+
+               [Obsolete("Use UserToDeviceDistance instead")]
+               public void TransformDistance (ref double dx, ref double dy)
+               {
+                       NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
+               }
+
+               [Obsolete("Use InverseTransformPoint instead")]
+               public void InverseTransformPoint (ref double x, ref double y)
+               {
+                       NativeMethods.cairo_device_to_user (handle, ref x, ref y);
+               }
+
+               [Obsolete("Use DeviceToUserDistance instead")]
+               public void InverseTransformDistance (ref double dx, ref double dy)
+               {
+                       NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
+               }
+
+               public void UserToDevice (ref double x, ref double y)
+               {
+                       NativeMethods.cairo_user_to_device (handle, ref x, ref y);
+               }
+
+               public void UserToDeviceDistance (ref double dx, ref double dy)
+               {
+                       NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
+               }
+
+               public void DeviceToUser (ref double x, ref double y)
+               {
+                       NativeMethods.cairo_device_to_user (handle, ref x, ref y);
+               }
+
+               public void DeviceToUserDistance (ref double dx, ref double dy)
+               {
+                       NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
+               }
+
+               public void SetFontSize (double scale)
+               {
+                       NativeMethods.cairo_set_font_size (handle, scale);
+               }
+
+               public void IdentityMatrix () => NativeMethods.cairo_identity_matrix (handle);
+               public Matrix FontMatrix {
+                       get {
+                               Matrix m;
+                               NativeMethods.cairo_get_font_matrix (handle, out m);
+                               return m;
+                       }
+                       set { NativeMethods.cairo_set_font_matrix (handle, value); }
+               }
+
+               public FontOptions FontOptions {
+                       get {
+                               FontOptions options = new FontOptions ();
+                               NativeMethods.cairo_get_font_options (handle, options.Handle);
+                               return options;
+                       }
+                       set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
+               }
+
+               [StructLayout(LayoutKind.Sequential)]
+               internal struct NativeGlyph_4byte_longs {
+                       public int index;
+                       public double x;
+                       public double y;
+
+                       public NativeGlyph_4byte_longs (Glyph source)
+                       {
+                               index = (int) source.index;
+                               x = source.x;
+                               y = source.y;
+                       }
+               }
+
+               static internal IntPtr FromGlyphToUnManagedMemory(Glyph [] glyphs)
+               {
+                       IntPtr dest = Marshal.AllocHGlobal (native_glyph_size * glyphs.Length);
+                       long pos = dest.ToInt64();
+
+                       if (c_compiler_long_size == 8){
+                               foreach (Glyph g in glyphs){
+                                       Marshal.StructureToPtr (g, (IntPtr)pos, false);
+                                       pos += native_glyph_size;
+                               }
+                       } else {
+                               foreach (Glyph g in glyphs){
+                                       NativeGlyph_4byte_longs n = new NativeGlyph_4byte_longs (g);
+
+                                       Marshal.StructureToPtr (n, (IntPtr)pos, false);
+                                       pos += native_glyph_size;
+                               }
+                       }
+
+                       return dest;
+               }
+
+               public void ShowGlyphs (Glyph[] glyphs)
+               {
+                       IntPtr ptr;
+
+                       ptr = FromGlyphToUnManagedMemory (glyphs);
+
+                       NativeMethods.cairo_show_glyphs (handle, ptr, glyphs.Length);
+
+                       Marshal.FreeHGlobal (ptr);
+               }
+
+               [Obsolete("The matrix argument was never used, use ShowGlyphs(Glyphs []) instead")]
+               public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
+               {
+                       ShowGlyphs (glyphs);
+               }
+
+               [Obsolete("The matrix argument was never used, use GlyphPath(Glyphs []) instead")]
+               public void GlyphPath (Matrix matrix, Glyph[] glyphs)
+               {
+                       GlyphPath (glyphs);
+               }
+
+               public void GlyphPath (Glyph[] glyphs)
+               {
+                       IntPtr ptr;
+
+                       ptr = FromGlyphToUnManagedMemory (glyphs);
+
+                       NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
+
+                       Marshal.FreeHGlobal (ptr);
+
+               }
+
+               public FontExtents FontExtents {
+                       get {
+                               FontExtents f_extents;
+                               NativeMethods.cairo_font_extents (handle, out f_extents);
+                               return f_extents;
+                       }
+               }
+
+               public void CopyPage ()
+               {
+                       NativeMethods.cairo_copy_page (handle);
+               }
+
+               public void SetContextFontFace (FontFace value)
+               {
+                       NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
+               }
+
+               public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
+               {
+                       NativeMethods.cairo_select_font_face (handle, family, slant, weight);
+               }
+
+               public void ShowPage ()
+               {
+                       NativeMethods.cairo_show_page (handle);
+               }
+
+               private static byte[] TerminateUtf8(byte[] utf8)
+               {
+                       if (utf8.Length > 0 && utf8[utf8.Length - 1] == 0)
+                               return utf8;
+                       var termedArray = new byte[utf8.Length + 1];
+                       Array.Copy(utf8, termedArray, utf8.Length);
+                       termedArray[utf8.Length] = 0;
+                       return termedArray;
+               }
+
+               private static byte[] TerminateUtf8(string s)
+               {
+                       // compute the byte count including the trailing \0
+                       var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
+                       var bytes = new byte[byteCount];
+                       Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
+                       return bytes;
+               }
+
+               public void ShowText(string str)
+                       => NativeMethods.cairo_show_text (handle, TerminateUtf8 (str));
+               public void TextPath(string str)
+                       => NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
+               public void TextPath(byte[] utf8)
+                       => NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
+               public TextExtents TextExtents(string s)
+               {
+                       TextExtents extents;
+                       NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
+                       return extents;
+               }
+               public void ShowText (ReadOnlySpan<char> s, int tabSize) {
+                       int size = s.Length * 4 + 1;
+                       Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+                       int encodedBytes = s.ToUtf8 (bytes, tabSize);
+                       bytes[encodedBytes] = 0;
+                       ShowText (bytes.Slice (0, encodedBytes + 1));
+               }
+               public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize) {
+                       TextExtents (s, tabSize, out TextExtents extents);
+                       return extents;
+               }
+               public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
+                       int size = s.Length * 4 + 1;
+                       Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
+                       int encodedBytes = s.ToUtf8 (bytes, tabSize);
+                       bytes[encodedBytes] = 0;
+                       TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
+               }
+               public void ShowText (Span<byte> bytes) {
+                       NativeMethods.cairo_show_text (handle, ref bytes.GetPinnableReference());
+               }
+               public void TextExtents (Span<byte> bytes, out TextExtents extents) {
+                       NativeMethods.cairo_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
+               }
+
+               public TextExtents GlyphExtents (Glyph[] glyphs)
+               {
+                       IntPtr ptr = FromGlyphToUnManagedMemory (glyphs);
+
+                       TextExtents extents;
+
+                       NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
+
+                       Marshal.FreeHGlobal (ptr);
+
+                       return extents;
+               }
+
+               public void Flush()
+               {
+                       //throw new NotImplementedException();
+               }
+
+               public void Clear()
+               {
+                       throw new NotImplementedException();
+               }
+               public void MoveTo(Point p)
+               {
+                       throw new NotImplementedException();
+               }
+               public void LineTo(Point p)
+               {
+                       throw new NotImplementedException();
+               }
+
+/*             public void Arc(float xc, float yc, float radius, float a1, float a2)
+               {
+                       throw new NotImplementedException();
+               }
+               public void ArcNegative(float xc, float yc, float radius, float a1, float a2)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void MoveTo(float x, float y)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void RelMoveTo(float x, float y)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void LineTo(float x, float y)
+               {
+                       throw new NotImplementedException();
+               }
+               public void RelLineTo(float x, float y)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void Scale(float sx, float sy)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void Translate(float dx, float dy)
+               {
+                       throw new NotImplementedException();
+               }
+               public void Rotate(float alpha)
+               {
+                       throw new NotImplementedException();
+               }
+               public void SetSource(float r, float g, float b, float a = 1)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void SetSource(ISurface surf, float x = 0, float y = 0)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void SetSourceSurface(ISurface surf, float x = 0, float y = 0)
+               {
+                       throw new NotImplementedException();
+               }
+*/
+               public void Translate(PointD p)
+               {
+                       throw new NotImplementedException();
+               }
+               public void RenderSvg(ISvgHandle svg, string subId = null)
+                       => svg.Render (this, subId);
+               Matrix savedMat;
+               public void SaveTransformations()
+                       => NativeMethods.cairo_get_matrix (handle, out savedMat);
+               public void RestoreTransformations()
+                       => NativeMethods.cairo_set_matrix (handle, ref savedMat);
+               public void SetSource(IPattern pat) => NativeMethods.cairo_set_source (handle, (pat as Pattern).handle);
+               public void SetSource(ISurface surf, double x = 0, double y = 0)
+                       => NativeMethods.cairo_set_source_surface (handle, (surf as Surface).handle, x, y);
+       }
+}
diff --git a/Backends/CairoBackend/src/DRMDevice.cs b/Backends/CairoBackend/src/DRMDevice.cs
new file mode 100644 (file)
index 0000000..69009fc
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.CairoBackend
+{
+       public class DRMDevice : CairoDevice
+       {
+               public DRMDevice () : base (NativeMethods.cairo_drm_device_default (), true)
+               {
+               }
+               public DRMDevice (int fd) : base (NativeMethods.cairo_drm_device_get_for_fd (fd), true)
+               {
+               }
+               public DRMDevice (IntPtr udev_device) : base (NativeMethods.cairo_drm_device_get (udev_device), true)
+               {
+               }
+
+               public int FileDescriptor {
+                       get { return NativeMethods.cairo_drm_device_get_fd (handle); }
+               }
+
+               public void DeviceThrottle () { NativeMethods.cairo_drm_device_throttle (handle);}
+       }
+}
+
diff --git a/Backends/CairoBackend/src/DRMSurface.cs b/Backends/CairoBackend/src/DRMSurface.cs
new file mode 100644 (file)
index 0000000..cf57d17
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// Mono.Cairo.GLSurface.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class DRMSurface : Surface
+       {
+
+               public DRMSurface (IntPtr ptr, bool own) : base (ptr, own)
+               {}
+
+               public DRMSurface (DRMDevice device, Format format, int width, int height)
+                       : base (NativeMethods.cairo_drm_surface_create (device.Handle, format, width, height), true)
+               {}
+
+               public DRMSurface (DRMDevice device, uint name, Format format, int width, int height, int stride)
+                       : base (NativeMethods.cairo_drm_surface_create_for_name (device.Handle, name, format, width, height, stride), true)
+               {}
+
+               public DRMSurface (DRMDevice device, IntPtr imageSurface)
+                       : base (NativeMethods.cairo_drm_surface_create_from_cacheable_image (device.Handle, imageSurface), true)
+               {}
+       }
+}
diff --git a/Backends/CairoBackend/src/Device.cs b/Backends/CairoBackend/src/Device.cs
new file mode 100644 (file)
index 0000000..2efe76e
--- /dev/null
@@ -0,0 +1,125 @@
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using Drawing2D;
+using Glfw;
+
+namespace Crow.CairoBackend
+{
+       public abstract class CairoDevice : Device {
+               protected IntPtr handle = IntPtr.Zero;
+               public IntPtr Handle => handle;
+               protected CairoDevice (IntPtr handle, bool owner = true)
+               {
+                       this.handle = handle;
+                       if (!owner)
+                               NativeMethods.cairo_device_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+               public string Status {
+                       get {
+                return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
+                       }
+               }
+               public Status Acquire()
+               {
+                       return NativeMethods.cairo_device_acquire (handle);
+               }
+               public void Release()
+               {
+                       NativeMethods.cairo_device_release (handle);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       base.Dispose (disposing);
+
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Device> (handle, disposing);
+
+                       if (!disposing || handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_device_destroy (handle);
+
+                       handle = IntPtr.Zero;
+               }
+       }
+       public class Device : IDevice
+       {
+
+               public Device()
+               {
+               }
+
+               ~Device ()
+               {
+                       Dispose (false);
+               }
+
+               #region IDevice implementation
+               public void GetDpy(out int hdpy, out int vdpy)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void SetDpy(int hdpy, int vdpy)
+               {
+                       throw new NotImplementedException();
+               }
+
+
+
+
+
+
+               #endregion
+
+               #region IDispose implementation
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (disposing){
+                               
+                       }
+                               
+               }
+               #endregion
+       }
+}
+
diff --git a/Backends/CairoBackend/src/DirectFBSurface.cs b/Backends/CairoBackend/src/DirectFBSurface.cs
new file mode 100644 (file)
index 0000000..ca7cd71
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// Mono.Cairo.DirectFBSurface.cs
+//
+// Authors:
+//    Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+       public class DirectFBSurface : Surface
+       {
+               internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
+                       : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
+               {
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/Distance.cs b/Backends/CairoBackend/src/Distance.cs
new file mode 100644 (file)
index 0000000..160fa1e
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+//   Duncan Mak (duncan@ximian.com)
+//   Miguel de Icaza (miguel@novell.com)
+//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//   Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Crow.CairoBackend {
+
+       public struct Distance
+       {
+               public Distance (double dx, double dy)
+               {
+                       this.dx = dx;
+                       this.dy = dy;
+               }
+
+               double dx, dy;
+               public double Dx {
+                       get { return dx; }
+                       set { dx = value; }
+               }
+
+               public double Dy {
+                       get { return dy; }
+                       set { dy = value; }
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/EGLDevice.cs b/Backends/CairoBackend/src/EGLDevice.cs
new file mode 100644 (file)
index 0000000..ef3d554
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.CairoBackend
+{
+       public class EGLDevice : GLDevice
+       {
+               public EGLDevice (IntPtr dpy, IntPtr gl_ctx, bool threadAwayre = false)
+                       : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
+               {
+                       SetThreadAware(threadAwayre);
+               }
+               /*public override ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
+                       return new GLSurface (this, Glfw.Glfw3.GetEGLSurface (nativeWindoPointer), width, height);
+               }*/
+
+       }
+}
+
diff --git a/Backends/CairoBackend/src/EglBackend.cs b/Backends/CairoBackend/src/EglBackend.cs
new file mode 100644 (file)
index 0000000..909c3cd
--- /dev/null
@@ -0,0 +1,70 @@
+using System;
+using System.IO;
+using Drawing2D;
+using Glfw;
+
+namespace Crow.CairoBackend
+{
+       public class EglBackend : CairoBackendBase {
+               EGLDevice device;
+               /// <summary>
+               /// Create a new generic backend bound to the application surface
+               /// </summary>
+               /// <param name="width">backend surface width</param>
+               /// <param name="height">backend surface height</param>
+               public EglBackend (int width, int height, IntPtr nativeWindoPointer)
+               : base (width, height, nativeWindoPointer) {
+                       if (nativeWindoPointer == IntPtr.Zero) {
+                               Glfw3.Init ();
+                               Glfw3.WindowHint (WindowAttribute.ClientApi, Constants.OpenglEsApi);
+                               Glfw3.WindowHint (WindowAttribute.ContextVersionMajor, 3);
+                               Glfw3.WindowHint (WindowAttribute.ContextVersionMinor, 2);
+                               Glfw3.WindowHint (WindowAttribute.ContextCreationApi, Constants.EglContextApi);
+                               Glfw3.WindowHint (WindowAttribute.Resizable, 1);
+                               Glfw3.WindowHint (WindowAttribute.Decorated, 1);
+
+                               hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero);
+                               if (hWin == IntPtr.Zero)
+                                       throw new Exception ("[GLFW3] Unable to create Window");
+                       }
+
+                       Glfw3.MakeContextCurrent (hWin);
+                       Glfw3.SwapInterval (0);
+
+                       device = new EGLDevice (Glfw3.GetEGLDisplay (), Glfw3.GetEGLContext (hWin));
+                       surf = new GLSurface (device, Glfw3.GetEGLSurface (hWin), width, height);
+               }
+               /// <summary>
+               /// Create a new offscreen backend, used in perfTests
+               /// </summary>
+               /// <param name="width">backend surface width</param>
+               /// <param name="height">backend surface height</param>
+               public EglBackend (int width, int height)
+               : base (width, height, IntPtr.Zero) {
+                       device = new EGLDevice (Glfw3.GetEGLDisplay (), IntPtr.Zero);
+                       surf = new GLTextureSurface (device, width, height);
+               }
+               public override ISurface CreateSurface(int width, int height)
+                       //=> new GLTextureSurface (device, width, height);
+                       => new ImageSurface (Format.ARGB32, width, height);
+               public override ISurface CreateSurface(byte[] data, int width, int height)
+                       => new ImageSurface (data, Format.ARGB32, width, height, 4 * width);
+               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
+               {
+                       Glfw3.MakeContextCurrent (hWin);
+
+                       IContext ctx = base.PrepareUIFrame (existingContext, clipping);
+
+                       clear (ctx);
+
+                       return ctx;
+               }
+               public override void FlushUIFrame(IContext ctx)
+               {
+                       base.FlushUIFrame (ctx);
+
+                       (surf as GLSurface).SwapBuffers ();
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/FontFace.cs b/Backends/CairoBackend/src/FontFace.cs
new file mode 100644 (file)
index 0000000..5b97dc2
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// Mono.Cairo.FontFace.cs
+//
+// Author:
+//   Alp Toker (alp@atoker.com)
+//   Miguel de Icaza (miguel@novell.com)
+//
+// (C) Ximian Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.CairoBackend
+{
+       public class FontFace : IDisposable
+       {
+               IntPtr handle;
+
+               internal static FontFace Lookup (IntPtr handle, bool owner)
+               {
+                       if (handle == IntPtr.Zero)
+                               return null;
+                       return new FontFace (handle, owner);
+               }
+
+               ~FontFace ()
+               {
+                       Dispose (false);
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<FontFace> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_font_face_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+
+               [Obsolete]
+               public FontFace (IntPtr handle) : this (handle, true)
+               {
+               }
+
+               public FontFace (IntPtr handle, bool owned)
+               {
+                       this.handle = handle;
+                       if (!owned)
+                               NativeMethods.cairo_font_face_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public Status Status {
+                       get {
+                               return NativeMethods.cairo_font_face_status (handle);
+                       }
+               }
+               
+               public FontType FontType {
+                       get {
+                               return NativeMethods.cairo_font_face_get_type (handle);
+                       }
+               }
+
+               public uint ReferenceCount {
+                       get { return NativeMethods.cairo_font_face_get_reference_count (handle); }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/FontOptions.cs b/Backends/CairoBackend/src/FontOptions.cs
new file mode 100644 (file)
index 0000000..ee952bb
--- /dev/null
@@ -0,0 +1,144 @@
+//
+// Mono.Cairo.FontOptions.cs
+//
+// Author:
+//   John Luke (john.luke@gmail.com)
+//
+// (C) John Luke 2005.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       public class FontOptions : IDisposable
+       {
+               IntPtr handle;
+
+               public FontOptions () : this (NativeMethods.cairo_font_options_create ())
+               {
+               }
+
+               ~FontOptions ()
+               {
+                       Dispose (false);
+               }
+
+               internal FontOptions (IntPtr handle)
+               {
+                       this.handle = handle;
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               public FontOptions Copy ()
+               {
+                       return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
+               }
+
+               [Obsolete ("Use Dispose()")]
+               public void Destroy ()
+               {
+                       Dispose ();
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<FontOptions> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_font_options_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+
+               public static bool operator == (FontOptions options, FontOptions other)
+               {
+                       return Equals (options, other);
+               }
+
+               public static bool operator != (FontOptions options, FontOptions other)
+               {
+                       return !(options == other);
+               }
+
+               public override bool Equals (object other)
+               {
+                       return Equals (other as FontOptions);
+               }
+
+               bool Equals (FontOptions options)
+               {
+                       return options != null && NativeMethods.cairo_font_options_equal (Handle, options.Handle);
+               }
+
+               public IntPtr Handle {
+                       get { return handle; }
+               }
+
+               public override int GetHashCode ()
+               {
+                       return (int) NativeMethods.cairo_font_options_hash (handle);
+               }
+
+               public void Merge (FontOptions other)
+               {
+                       if (other == null)
+                               throw new ArgumentNullException ("other");
+                       NativeMethods.cairo_font_options_merge (handle, other.Handle);
+               }
+
+               public Antialias Antialias {
+                       get { return NativeMethods.cairo_font_options_get_antialias (handle); }
+                       set { NativeMethods.cairo_font_options_set_antialias (handle, value); }
+               }
+
+               public HintMetrics HintMetrics {
+                       get { return NativeMethods.cairo_font_options_get_hint_metrics (handle);}
+                       set { NativeMethods.cairo_font_options_set_hint_metrics (handle, value); }
+               }
+
+               public HintStyle HintStyle {
+                       get { return NativeMethods.cairo_font_options_get_hint_style (handle);}
+                       set { NativeMethods.cairo_font_options_set_hint_style (handle, value); }
+               }
+
+               public Status Status {
+                       get { return NativeMethods.cairo_font_options_status (handle); }
+               }
+
+               public SubpixelOrder SubpixelOrder {
+                       get { return NativeMethods.cairo_font_options_get_subpixel_order (handle);}
+                       set { NativeMethods.cairo_font_options_set_subpixel_order (handle, value); }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/FontType.cs b/Backends/CairoBackend/src/FontType.cs
new file mode 100644 (file)
index 0000000..664c2f5
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Mono.Cairo.FontType.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public enum FontType
+       {
+               Toy,
+               FreeType,
+               Win32,
+               Atsui,
+       }
+}
diff --git a/Backends/CairoBackend/src/GLDevice.cs b/Backends/CairoBackend/src/GLDevice.cs
new file mode 100644 (file)
index 0000000..3c90592
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright (c) 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 Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       public abstract class GLDevice : CairoDevice
+       {
+               protected GLDevice (IntPtr handle, bool owner = true) : base (handle, owner) {}
+               public void SetThreadAware (bool value) {
+                       NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
+               }
+
+       }
+}
+
diff --git a/Backends/CairoBackend/src/GLSurface.cs b/Backends/CairoBackend/src/GLSurface.cs
new file mode 100644 (file)
index 0000000..4fa262c
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// Mono.Cairo.GLSurface.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using OpenGL;
+using static OpenGL.Gl;
+
+namespace Crow.CairoBackend {
+
+       public class GLTextureSurface : Surface
+       {
+               uint texId;
+               internal GLTextureSurface (CairoDevice device, int width, int height)
+                       : base ()
+               {
+                       texId = GenTexture ();
+                       BindTexture (TextureTarget.Texture2d, texId);
+                       TexImage2D (TextureTarget.Texture2d, 0, InternalFormat.Rgb, width, height,
+                               0, PixelFormat.Rgb, PixelType.UnsignedByte, 0);
+                       TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, NEAREST);
+                       TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, NEAREST);
+
+                       handle = NativeMethods.cairo_gl_surface_create_for_texture (device.Handle,
+                               (uint)Content.ColorAlpha, texId, width, height);
+               }
+               protected override void Dispose (bool disposing)
+               {
+                       if (disposing && handle != IntPtr.Zero)
+                               OpenGL.Gl.DeleteTextures (texId);
+                       base.Dispose (disposing);
+               }
+
+       }
+       public class GLSurface : Surface
+       {
+               public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
+               {}
+
+               public GLSurface (CairoDevice 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)
+               {}
+
+               public GLSurface (EGLDevice device, IntPtr eglSurf, int width, int height)
+                       : base (NativeMethods.cairo_gl_surface_create_for_egl (device.Handle, eglSurf, width, height), true)
+               {}
+
+               public GLSurface (GLXDevice device, IntPtr window, int width, int height)
+                       : base (NativeMethods.cairo_gl_surface_create_for_window (device.Handle, window, width, height),true)
+               {}
+
+               public GLSurface (WGLDevice device, IntPtr hdc, int width, int height)
+                       : base (NativeMethods.cairo_gl_surface_create_for_dc (device.Handle, hdc, width, height), true)
+               {}
+               public override void Flush ()
+               {
+                       //base.Flush ();
+                       SwapBuffers ();
+               }
+               public override int Width => NativeMethods.cairo_gl_surface_get_width (handle);
+               public override int Height => NativeMethods.cairo_gl_surface_get_height (handle);
+               public override void Resize(int width, int height)
+                       => NativeMethods.cairo_gl_surface_set_size(handle, width, height);
+
+               public void SwapBuffers(){
+                       NativeMethods.cairo_gl_surface_swapbuffers (this.handle);
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/GLXDevice.cs b/Backends/CairoBackend/src/GLXDevice.cs
new file mode 100644 (file)
index 0000000..4a788c9
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.CairoBackend
+{
+       public class GLXDevice : CairoDevice
+       {
+               public GLXDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_glx_device_create (dpy, gl_ctx), true)
+               {
+               }
+
+               public IntPtr Display {
+                       get { return NativeMethods.cairo_glx_device_get_display (handle); }
+               }
+
+               public IntPtr Context {
+                       get { return NativeMethods.cairo_glx_device_get_context (handle); }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/GlitzSurface.cs b/Backends/CairoBackend/src/GlitzSurface.cs
new file mode 100644 (file)
index 0000000..4497877
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// Mono.Cairo.GlitzSurface.cs
+//
+// Authors:
+//    Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+       public class GlitzSurface : Surface
+       {
+               internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public GlitzSurface (IntPtr glitz_surface)
+                       : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
+               {
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/Glyph.cs b/Backends/CairoBackend/src/Glyph.cs
new file mode 100644 (file)
index 0000000..fdd8436
--- /dev/null
@@ -0,0 +1,96 @@
+//
+// Mono.Cairo.Glyph.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.CairoBackend
+{
+       [StructLayout(LayoutKind.Sequential)]
+       public struct Glyph
+       {
+               internal long index;
+               internal double x;
+               internal double y;
+               
+               public Glyph (long index, double x, double y)
+               {
+                       this.index = index;
+                       this.x = x;
+                       this.y = y;
+               }
+               
+               public long Index {
+                       get { return index; }
+                       set { index = value; }
+               }
+               
+               public double X {
+                       get { return x; }
+                       set { x = value; }
+               }
+               
+               public double Y {
+                       get { return y; }
+                       set { y = value; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj is Glyph)
+                               return this == (Glyph)obj;
+                       return false;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return (int) Index ^ (int) X ^ (int) Y;
+               }
+
+               internal static IntPtr GlyphsToIntPtr (Glyph[] glyphs)
+               {
+                       int size = Marshal.SizeOf (glyphs[0]);
+                       IntPtr dest = Marshal.AllocHGlobal (size * glyphs.Length);
+                       long pos = dest.ToInt64 ();
+                       for (int i = 0; i < glyphs.Length; i++, pos += size)
+                               Marshal.StructureToPtr (glyphs[i], (IntPtr) pos, false);
+                       return dest;
+               }
+
+               public static bool operator == (Glyph glyph, Glyph other)
+               {
+                       return glyph.Index == other.Index && glyph.X == other.X && glyph.Y == other.Y;
+               }
+
+               public static bool operator != (Glyph glyph, Glyph other)
+               {
+                       return !(glyph == other);
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/Gradient.cs b/Backends/CairoBackend/src/Gradient.cs
new file mode 100644 (file)
index 0000000..74ac7d4
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// Mono.Cairo.Gradient.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class Gradient : Pattern, IGradient
+       {
+               protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public int ColorStopCount {
+                       get {
+                               int cnt;
+                               NativeMethods.cairo_pattern_get_color_stop_count (handle, out cnt);
+                               return cnt;
+                       }
+               }
+               #region IGradient implementation
+               public void AddColorStop (double offset, Color c)
+                       => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0);
+               public void AddColorStop(float offset, float r, float g, float b, float a = 1)
+                       => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, r, g, b, a);
+               #endregion
+
+               public Status AddColorStopRgb (double offset, Color c)
+               {
+                       NativeMethods.cairo_pattern_add_color_stop_rgb (handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0);
+                       return Status;
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/HintMetrics.cs b/Backends/CairoBackend/src/HintMetrics.cs
new file mode 100644 (file)
index 0000000..8f4f95c
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Mono.Cairo.HintMetrics.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       
+       public enum HintMetrics
+       {
+               Default,
+               Off,
+               On,
+       }
+}
diff --git a/Backends/CairoBackend/src/HintStyle.cs b/Backends/CairoBackend/src/HintStyle.cs
new file mode 100644 (file)
index 0000000..6616174
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// Mono.Cairo.HintStyle.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       
+       public enum HintStyle
+       {
+               Default,
+               None,
+               Slight,
+               Medium,
+               Full,
+       }
+}
diff --git a/Backends/CairoBackend/src/ImageBackend.cs b/Backends/CairoBackend/src/ImageBackend.cs
new file mode 100644 (file)
index 0000000..96899db
--- /dev/null
@@ -0,0 +1,84 @@
+using System;
+using System.IO;
+using Drawing2D;
+using Glfw;
+
+namespace Crow.CairoBackend
+{
+       public class DefaultBackend : CairoBackendBase {
+               /// <summary>
+               /// Create a new generic backend bound to the application surface
+               /// </summary>
+               /// <param name="width">backend surface width</param>
+               /// <param name="height">backend surface height</param>
+               /// <param name="nativeWindoPointer"></param>
+               public DefaultBackend (int width, int height, IntPtr nativeWindoPointer)
+               : base (width, height, nativeWindoPointer) {
+                       if (nativeWindoPointer == IntPtr.Zero) {
+                               Glfw3.Init ();
+                               Glfw3.WindowHint (WindowAttribute.ClientApi, 0);
+                               Glfw3.WindowHint (WindowAttribute.Resizable, 1);
+                               Glfw3.WindowHint (WindowAttribute.Decorated, 1);
+
+                               hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero);
+                               if (hWin == IntPtr.Zero)
+                                       throw new Exception ("[GLFW3] Unable to create Window");
+                       }
+                       switch (Environment.OSVersion.Platform) {
+                       case PlatformID.Unix:
+                               IntPtr disp = Glfw3.GetX11Display ();
+                               IntPtr nativeWin = Glfw3.GetX11Window (hWin);
+                               Int32 scr = Glfw3.GetX11DefaultScreen (disp);
+                               IntPtr visual = Glfw3.GetX11DefaultVisual (disp, scr);
+                               surf = new XlibSurface (disp, nativeWin, visual, width, height);
+                               break;
+                       case PlatformID.Win32NT:
+                       case PlatformID.Win32S:
+                       case PlatformID.Win32Windows:
+                               IntPtr hWin32 = Glfw3.GetWin32Window (hWin);
+                               IntPtr hdc = Glfw3.GetWin32DC (hWin32);
+                               surf = new Win32Surface (hdc);
+                               break;
+                       default:
+                               throw new PlatformNotSupportedException ("Unable to create cairo image backend.");
+                       }
+               }
+               /// <summary>
+               /// Create a new offscreen backend, used in perfTests
+               /// </summary>
+               /// <param name="width">backend surface width</param>
+               /// <param name="height">backend surface height</param>
+               public DefaultBackend (int width, int height)
+               : base (width, height, IntPtr.Zero) {
+                       surf = new ImageSurface (Format.ARGB32, width, height);
+               }
+               public DefaultBackend (IntPtr surfaceBitmapData, int width, int height, int stride)
+                : base (width, height, IntPtr.Zero) {
+                       surf = new ImageSurface (surfaceBitmapData, Format.ARGB32, width, height, stride);
+               }
+
+               public override ISurface CreateSurface(int width, int height)
+                       => new ImageSurface (Format.ARGB32, width, height);
+               public override ISurface CreateSurface(byte[] data, int width, int height)
+                       => new ImageSurface (data, Format.ARGB32, width, height, 4 * width);
+               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
+               {
+                       IContext ctx = base.PrepareUIFrame (existingContext, clipping);
+
+                       clear (ctx);
+                       ctx.PushGroup ();
+
+                       return ctx;
+               }
+               public override void FlushUIFrame(IContext ctx)
+               {
+                       ctx.PopGroupToSource ();
+                       ctx.Paint ();
+
+                       surf.Flush ();
+
+                       base.FlushUIFrame (ctx);
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/ImageSurface.cs b/Backends/CairoBackend/src/ImageSurface.cs
new file mode 100644 (file)
index 0000000..2cfec61
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// Mono.Cairo.ImageSurface.cs
+//
+// Authors:
+//    Duncan Mak
+//    Miguel de Icaza.
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class ImageSurface : Surface
+       {
+               internal ImageSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public ImageSurface (Format format, int width, int height)
+                       : base (NativeMethods.cairo_image_surface_create (format, width, height), true)
+               {
+               }
+
+               [Obsolete ("Use ImageSurface (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)
+               {
+               }
+
+               public ImageSurface (byte[] data, Format format, int width, int height, int stride)
+                       : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
+               {
+               }
+
+               public ImageSurface (IntPtr data, Format format, int width, int height, int stride)
+                       : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
+               {
+               }
+
+               public ImageSurface (string filename)
+                       : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
+               {
+               }
+
+               public override int Width => NativeMethods.cairo_image_surface_get_width (handle);
+               public override int Height => NativeMethods.cairo_image_surface_get_height (handle);
+
+               public byte[] Data {
+                       get {
+                               IntPtr ptr = NativeMethods.cairo_image_surface_get_data (handle);
+                               int length = Height * Stride;
+                               byte[] data = new byte[length];
+                               Marshal.Copy (ptr, data, 0, length);
+                               return data;
+                       }
+               }
+
+               public IntPtr DataPtr {
+                       get {
+                               return NativeMethods.cairo_image_surface_get_data (handle);
+                       }
+               }
+
+               public Format Format {
+                       get { return NativeMethods.cairo_image_surface_get_format (handle); }
+               }
+
+               public int Stride {
+                       get { return NativeMethods.cairo_image_surface_get_stride (handle); }
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/LinearGradient.cs b/Backends/CairoBackend/src/LinearGradient.cs
new file mode 100644 (file)
index 0000000..49e423e
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Mono.Cairo.LinearGradient.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class LinearGradient : Gradient
+       {
+               internal LinearGradient (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public LinearGradient (double x0, double y0, double x1, double y1)
+                       : base (NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1), true)
+               {
+               }
+
+               public PointD[] LinearPoints {
+                       get {
+                               double x0, y0, x1, y1;
+                               PointD[] points = new PointD [2];
+
+                               NativeMethods.cairo_pattern_get_linear_points (handle, out x0, out y0, out x1, out y1);
+
+                               points[0] = new PointD (x0, y0);
+                               points[1] = new PointD (x1, y1);
+                               return points;
+                       }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/Matrix.cs b/Backends/CairoBackend/src/Matrix.cs
new file mode 100644 (file)
index 0000000..b565edc
--- /dev/null
@@ -0,0 +1,187 @@
+//
+// Mono.Cairo.Matrix.cs
+//
+// Author: Duncan Mak
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//         Idan Gazit (idan@fastmail.fm)
+//
+// (C) Ximian Inc, 2003 - 2005.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Crow.CairoBackend {
+
+       [StructLayout(LayoutKind.Sequential)]
+       public struct Matrix //: ICloneable
+       {
+               public double Xx;
+               public double Yx;
+               public double Xy;
+               public double Yy;
+               public double X0;
+               public double Y0;
+
+               public Matrix (double xx, double yx, double xy, double yy,
+                               double x0, double y0)
+               {
+                       this.Xx = xx; this.Yx = yx; this.Xy = xy;
+                       this.Yy = yy; this.X0 = x0; this.Y0 = y0;
+               }
+               public bool IsIdentity ()
+               {
+                       return (this == new Matrix ());
+               }
+
+               public void InitIdentity ()
+               {
+                       // this.Init(1,0,0,1,0,0);
+                       NativeMethods.cairo_matrix_init_identity (this);
+               }
+
+               public void Init (double xx, double yx, double xy, double yy,
+                                 double x0, double y0)
+               {
+                       this.Xx = xx; this.Yx = yx; this.Xy = xy;
+                       this.Yy = yy; this.X0 = x0; this.Y0 = y0;
+               }
+
+               public void InitTranslate (double tx, double ty)
+               {
+                       //this.Init (1, 0, 0, 1, tx, ty);
+                       NativeMethods.cairo_matrix_init_translate (this, tx, ty);
+               }
+
+               public void Translate (double tx, double ty)
+               {
+                       NativeMethods.cairo_matrix_translate (this, tx, ty);
+               }
+
+               public void InitScale (double sx, double sy)
+               {
+                       //this.Init (sx, 0, 0, sy, 0, 0);
+                       NativeMethods.cairo_matrix_init_scale (this, sx, sy);
+               }
+
+               public void Scale (double sx, double sy)
+               {
+                       NativeMethods.cairo_matrix_scale (this, sx, sy);
+               }
+
+               public void InitRotate (double radians)
+               {
+                       /*
+                       double s, c;
+                       s = Math.Sin (radians);
+                       c = Math.Cos (radians);
+                       this.Init (c, s, -s, c, 0, 0);
+                       */
+                       NativeMethods.cairo_matrix_init_rotate (this, radians);
+               }
+
+               public void Rotate (double radians)
+               {
+                       NativeMethods.cairo_matrix_rotate (this, radians);
+               }
+
+               public Status Invert ()
+               {
+                       return NativeMethods.cairo_matrix_invert (this);
+               }
+
+               public void Multiply (Matrix b)
+               {
+                       Matrix a = (Matrix) this.Clone ();
+                       NativeMethods.cairo_matrix_multiply (this, a, b);
+               }
+
+               public static Matrix Multiply (Matrix a, Matrix b) {
+                       Matrix result = new Matrix ();
+                       NativeMethods.cairo_matrix_multiply (result, a, b);
+                       return result;
+               }
+
+
+               public void TransformDistance (ref double dx, ref double dy)
+               {
+                       NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
+               }
+
+               public void TransformPoint (ref double x, ref double y)
+               {
+                       NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
+               }
+
+               public override String ToString ()
+               {
+                       String s = String.Format ("xx:{0:##0.0#} yx:{1:##0.0#} xy:{2:##0.0#} yy:{3:##0.0#} x0:{4:##0.0#} y0:{5:##0.0#}",
+                               this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
+                       return s;
+               }
+
+               public static bool operator == (Matrix lhs, Matrix rhs)
+               {
+                       return (lhs.Xx == rhs.Xx &&
+                               lhs.Xy == rhs.Xy &&
+                               lhs.Yx == rhs.Yx &&
+                               lhs.Yy == rhs.Yy &&
+                               lhs.X0 == rhs.X0 &&
+                               lhs.Y0 == rhs.Y0 );
+               }
+
+               public static bool operator != (Matrix lhs, Matrix rhs)
+               {
+                       return !(lhs==rhs);
+               }
+
+
+
+               public override bool Equals(object o)
+               {
+                       if (! (o is Matrix))
+                               return false;
+                       else
+                               return (this == (Matrix) o);
+               }
+
+               public override int GetHashCode()
+               {
+                       return  (int)this.Xx ^ (int)this.Xx>>32 ^
+                               (int)this.Xy ^ (int)this.Xy>>32 ^
+                               (int)this.Yx ^ (int)this.Yx>>32 ^
+                               (int)this.Yy ^ (int)this.Yy>>32 ^
+                               (int)this.X0 ^ (int)this.X0>>32 ^
+                               (int)this.Y0 ^ (int)this.Y0>>32;
+               }
+
+               public object Clone()
+               {
+                       return this.MemberwiseClone ();
+               }
+
+       }
+}
diff --git a/Backends/CairoBackend/src/MeshPattern.cs b/Backends/CairoBackend/src/MeshPattern.cs
new file mode 100644 (file)
index 0000000..39fdd2a
--- /dev/null
@@ -0,0 +1,113 @@
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class MeshPattern : Pattern
+       {
+               internal MeshPattern (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public MeshPattern ()
+                       : base (NativeMethods.cairo_pattern_create_mesh(), true)
+               {
+               }
+
+               //no idea why this is here, the base one is identical, but we can't remove it now
+               public new Extend Extend {
+                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
+                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
+               }
+
+               public Filter Filter {
+                       set { NativeMethods.cairo_pattern_set_filter (handle, value); }
+                       get { return NativeMethods.cairo_pattern_get_filter (handle); }
+               }
+
+               public void BeginPatch(){
+                       NativeMethods.cairo_mesh_pattern_begin_patch (handle);
+               }
+               public void EndPatch(){
+                       NativeMethods.cairo_mesh_pattern_end_patch (handle);
+               }
+               public void MoveTo(double x, double y){
+                       NativeMethods.cairo_mesh_pattern_move_to (handle, x, y);
+               }
+               public void MoveTo (PointD p) {
+                       NativeMethods.cairo_mesh_pattern_move_to (handle, p.X, p.Y);
+               }
+               public void LineTo(double x, double y){
+                       NativeMethods.cairo_mesh_pattern_line_to (handle, x, y);
+               }
+               public void LineTo (PointD p) {
+                       NativeMethods.cairo_mesh_pattern_line_to (handle, p.X, p.Y);
+               }
+               public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
+               {
+                       NativeMethods.cairo_mesh_pattern_curve_to (handle, x1, y1, x2, y2, x3, y3);
+               }
+               public void SetControlPoint(uint point_num, double x, double y){
+                       NativeMethods.cairo_mesh_pattern_set_control_point (handle, point_num, x, y);
+               }
+               public void SetControlPoint (uint point_num, PointD p) {
+                       NativeMethods.cairo_mesh_pattern_set_control_point (handle, point_num, p.X, p.Y);
+               }
+               public void SetCornerColorRGB(uint corner_num, double r, double g, double b){
+                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgb (handle, corner_num, r, g, b);
+               }
+               public void SetCornerColorRGBA(uint corner_num, double r, double g, double b, double a){
+                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (handle, corner_num, r, g, b, a);
+               }
+               public void SetCornerColor (uint corner_num, Color c) {
+                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (handle, corner_num, c.R, c.G, c.B, c.A);
+               }
+               public uint PatchCount {
+                       get {
+                               uint count = 0;
+                               NativeMethods.cairo_mesh_pattern_get_patch_count(handle, out count);
+                               return count;
+                       }       
+               }
+               public Path GetPath(uint patch_num){
+                       return new Path(NativeMethods.cairo_mesh_pattern_get_path(handle, patch_num));
+               }
+               public PointD GetControlPoint(uint point_num, uint patch_num = 0) {
+                       NativeMethods.cairo_mesh_pattern_get_control_point (handle, patch_num, point_num, out double x, out double y);
+                       return new PointD (x, y);
+               }
+               public void GetCornerColorRGBA(){
+                       
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/NativeMethods-internal.cs b/Backends/CairoBackend/src/NativeMethods-internal.cs
new file mode 100644 (file)
index 0000000..714ff63
--- /dev/null
@@ -0,0 +1,1027 @@
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//          John Luke (john.luke@gmail.com)
+//          Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       // sort the functions like in the following page so it is easier to find what is missing
+       // http://cairographics.org/manual/index-all.html
+
+       public static class NativeMethods
+       {
+               #if MONOTOUCH
+               const string cairo = "__Internal";
+               #else
+               const string cairo = "libcairo-2.dll";
+               #endif
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern void cairo_append_path (IntPtr cr, Path path);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+               //              [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //              public static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_clip (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_clip_preserve (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_close_path (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_copy_page (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_copy_path (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_copy_path_flat (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_create (IntPtr target);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_debug_reset_static_data ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_destroy (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_fill (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_fill_preserve (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
+
+               #region FontFace
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_face_destroy (IntPtr font_face);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern FontType cairo_font_face_get_type (IntPtr font_face);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern void cairo_font_face_get_user_data (IntPtr font_face);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern void cairo_font_face_set_user_data (IntPtr font_face);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_font_face_reference (IntPtr font_face);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_font_face_status (IntPtr font_face);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern uint cairo_font_face_get_reference_count (IntPtr surface);
+               #endregion
+
+               #region FontOptions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_font_options_copy (IntPtr original);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_font_options_create ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_destroy (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Antialias cairo_font_options_get_antialias (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern long cairo_font_options_hash (IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_font_options_status (IntPtr options);
+               #endregion
+
+               #region Freetype / FontConfig
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Antialias cairo_get_antialias (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern FillRule cairo_get_fill_rule (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_get_font_face (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_get_group_target (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern LineCap cairo_get_line_cap (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern LineJoin cairo_get_line_join (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern double cairo_get_line_width (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern double cairo_get_miter_limit (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Operator cairo_get_operator (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern uint cairo_get_reference_count (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_get_source (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_get_target (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern double cairo_get_tolerance (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               [return: MarshalAs (UnmanagedType.U1)]
+               public static extern bool cairo_has_current_point (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_identity_matrix (IntPtr cr);
+
+               #region Image Surface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               public static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_image_surface_create_from_png  (string filename);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern IntPtr cairo_image_surface_create_from_png_stream  (string filename);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Format cairo_image_surface_get_format (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_image_surface_get_height (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_image_surface_get_stride (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_image_surface_get_width  (IntPtr surface);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               [return: MarshalAs (UnmanagedType.U1)]
+               public static extern bool cairo_in_clip (IntPtr cr, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               [return: MarshalAs (UnmanagedType.U1)]
+               public static extern bool cairo_in_fill (IntPtr cr, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               [return: MarshalAs (UnmanagedType.U1)]
+               public static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_line_to (IntPtr cr, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_mask (IntPtr cr, IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+               #region Matrix
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_init_identity (Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_matrix_invert (Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_rotate (Matrix matrix, double radians);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_move_to (IntPtr cr, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_new_path (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_new_sub_path (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_paint (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_path_destroy (IntPtr path);
+
+               #region Pattern
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_destroy (IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Extend cairo_pattern_get_extend (IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Filter cairo_pattern_get_filter (IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern PatternType cairo_pattern_get_type (IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pattern_reference (IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_pattern_status (IntPtr pattern);
+               #endregion
+
+               #region PdfSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
+               #endregion
+
+               #region PostscriptSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_pop_group (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_pop_group_to_source (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_push_group (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_push_group_with_content (IntPtr cr, Content content);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_reference (IntPtr cr);
+
+               #region Regions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_region_copy (IntPtr original);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_region_create ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_region_destroy (IntPtr region);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern bool cairo_region_equal (IntPtr a, IntPtr b);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern bool cairo_region_is_empty (IntPtr region);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_region_num_rectangles (IntPtr region);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_region_reference (IntPtr region);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_status (IntPtr region);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_region_translate (IntPtr region, int dx, int dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_union (IntPtr dst, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_reset_clip (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_restore (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rotate (IntPtr cr, double angle);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_save (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_scale (IntPtr cr, double sx, double sy);
+
+               #region ScaledFont
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_scaled_font_status (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_get_scaled_font (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_get_dash_count (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_font_size (IntPtr cr, double size);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_line_width (IntPtr cr, double width);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_miter_limit (IntPtr cr, double limit);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_show_page (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_show_text (IntPtr cr, string str);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_status (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_status_to_string (Status status);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_stroke (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_stroke_preserve (IntPtr cr);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
+
+               #region Surface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_surface_create_similar (IntPtr surface, Cairo.Content content, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_destroy (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_finish (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_flush (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Content cairo_surface_get_content (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern uint cairo_surface_get_reference_count (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern SurfaceType cairo_surface_get_type (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_mark_dirty (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_surface_reference (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_surface_status (IntPtr surface);
+               #endregion
+
+               #region SVG surface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
+
+               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               //public static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_text_extents (IntPtr cr, string txt, out TextExtents extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               public static extern void cairo_text_path (IntPtr ct, byte[] utf8);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_transform (IntPtr cr, Matrix matrix);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_translate (IntPtr cr, double tx, double ty);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_version ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_version_string ();
+
+               #region DirectFBSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
+               #endregion
+
+               #region win32 fonts
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
+               #endregion
+
+               #region win32 surface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
+               #endregion
+
+               #region XcbSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
+               #endregion
+
+               #region XlibSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_xlib_surface_get_depth (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_xlib_surface_get_height (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_xlib_surface_get_width (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
+               #endregion
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
+
+               #region GLSurface
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_gl_surface_get_width (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_gl_surface_get_height (IntPtr surface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
+               #endregion
+
+               #region GLX Functions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_glx_device_get_display (IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_glx_device_get_context (IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
+               #endregion
+
+               #region WGL Fucntions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
+               #endregion
+
+               #region EGL Functions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
+               #endregion
+
+               #region DRM Functions
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_device_get_for_fd (int fd);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_device_default ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern  void cairo_drm_device_throttle (IntPtr cairo_device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format,       int width, int height);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format,   int width, int height, int stride);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void       cairo_drm_surface_unmap (IntPtr drmSurface,     IntPtr imageSurface);
+               #endregion
+
+               #region Device
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_device_acquire(IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_device_destroy (IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern IntPtr cairo_device_reference (IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void cairo_device_release(IntPtr device);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern Status cairo_device_status(IntPtr device);
+               #endregion
+
+
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
+               public static extern void crow_cairo_region_clear(IntPtr ctx, IntPtr reg);
+
+       }
+}
\ No newline at end of file
diff --git a/Backends/CairoBackend/src/NativeMethods.cs b/Backends/CairoBackend/src/NativeMethods.cs
new file mode 100644 (file)
index 0000000..7b6053a
--- /dev/null
@@ -0,0 +1,1072 @@
+//
+// Cairo.cs - a simplistic binding of the Cairo API to C#.
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//          John Luke (john.luke@gmail.com)
+//          Alp Toker (alp@atoker.com)
+//
+// (C) Ximian, Inc. 2003
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+// Copyright (C) 2006 Alp Toker
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       // sort the functions like in the following page so it is easier to find what is missing
+       // http://cairographics.org/manual/index-all.html
+
+       internal static class NativeMethods
+       {
+#if MONOTOUCH
+               const string cairo = "__Internal";
+#else
+       const string cairo = "cairo";
+#endif
+
+        //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+        //internal static extern void cairo_append_path (IntPtr cr, Path path);
+
+        [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_clip (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_clip_preserve (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_close_path (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_copy_page (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_copy_path (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_copy_path_flat (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_create (IntPtr target);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_debug_reset_static_data ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_destroy (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_fill (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_fill_preserve (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
+
+               #region FontFace
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_face_destroy (IntPtr font_face);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern FontType cairo_font_face_get_type (IntPtr font_face);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern void cairo_font_face_get_user_data (IntPtr font_face);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern void cairo_font_face_set_user_data (IntPtr font_face);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_font_face_reference (IntPtr font_face);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_font_face_status (IntPtr font_face);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern uint cairo_font_face_get_reference_count (IntPtr surface);
+               #endregion
+
+               #region FontOptions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_font_options_copy (IntPtr original);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_font_options_create ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_destroy (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               [return: MarshalAs (UnmanagedType.U1)]
+               internal static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Antialias cairo_font_options_get_antialias (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern long cairo_font_options_hash (IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_font_options_status (IntPtr options);
+               #endregion
+
+               #region Freetype / FontConfig
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Antialias cairo_get_antialias (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern FillRule cairo_get_fill_rule (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_get_font_face (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_get_group_target (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern LineCap cairo_get_line_cap (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern LineJoin cairo_get_line_join (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern double cairo_get_line_width (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_get_matrix (IntPtr cr, out Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern double cairo_get_miter_limit (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Operator cairo_get_operator (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern uint cairo_get_reference_count (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_get_source (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_get_target (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern double cairo_get_tolerance (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               [return: MarshalAs (UnmanagedType.U1)]
+               internal static extern bool cairo_has_current_point (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_identity_matrix (IntPtr cr);
+
+               #region Image Surface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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, 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, 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);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern IntPtr cairo_image_surface_create_from_png_stream  (string filename);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Format cairo_image_surface_get_format (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_image_surface_get_height (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_image_surface_get_stride (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_image_surface_get_width  (IntPtr surface);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               [return: MarshalAs (UnmanagedType.U1)]
+               internal static extern bool cairo_in_clip (IntPtr cr, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               [return: MarshalAs (UnmanagedType.U1)]
+               internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               [return: MarshalAs (UnmanagedType.U1)]
+               internal static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_line_to (IntPtr cr, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mask (IntPtr cr, IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+               #region Matrix
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_init_identity (Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_matrix_invert (Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_rotate (Matrix matrix, double radians);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_move_to (IntPtr cr, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_new_path (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_new_sub_path (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_paint (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_path_destroy (IntPtr path);
+
+               #region Pattern
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_destroy (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Extend cairo_pattern_get_extend (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Filter cairo_pattern_get_filter (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern PatternType cairo_pattern_get_type (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_reference (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_pattern_status (IntPtr pattern);
+
+               //mesh pattern
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pattern_create_mesh ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_begin_patch (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_end_patch (IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_move_to (IntPtr pattern, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_line_to (IntPtr pattern, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_curve_to (IntPtr pattern, double x1, double y1,
+                       double x2, double y2, double x3, double y3);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_set_control_point (IntPtr pattern, uint point_num, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_set_corner_color_rgb (IntPtr pattern, uint corner_num,
+                       double r, double g, double b);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_mesh_pattern_set_corner_color_rgba (IntPtr pattern, uint corner_num,
+                       double r, double g, double b, double a);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_mesh_pattern_get_patch_count (IntPtr pattern, out uint count);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_mesh_pattern_get_path (IntPtr pattern, uint patch_num);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_mesh_pattern_get_control_point (IntPtr pattern,
+                       uint patch_num, uint point_num, out double x, out double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_mesh_pattern_get_corner_color_rgba (IntPtr pattern,
+                       uint patch_num, uint point_num, out double r, out double g, out double b, out double a);
+               #endregion
+
+               #region PdfSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
+               #endregion
+
+               #region PostscriptSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_pop_group (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_pop_group_to_source (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_push_group (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_push_group_with_content (IntPtr cr, Content content);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_reference (IntPtr cr);
+
+               #region Regions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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 Rectangle rectangle);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_region_copy (IntPtr original);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_region_create ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_region_destroy (IntPtr region);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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 Rectangle extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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 Rectangle rectangle);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern bool cairo_region_is_empty (IntPtr region);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_region_num_rectangles (IntPtr region);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_region_reference (IntPtr region);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_region_status (IntPtr region);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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 Rectangle rectangle);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_region_translate (IntPtr region, int dx, int dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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 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 Rectangle rectangle);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_reset_clip (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_restore (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rotate (IntPtr cr, double angle);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_save (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scale (IntPtr cr, double sx, double sy);
+
+               #region ScaledFont
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_scaled_font_status (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_get_scaled_font (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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, FillRule fill_rule);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_font_size (IntPtr cr, double size);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_line_width (IntPtr cr, double width);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_matrix (IntPtr cr, ref Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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, Operator op);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_show_page (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_status (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_status_to_string (Status status);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_stroke (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_stroke_preserve (IntPtr cr);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
+
+               #region Surface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               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);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_finish (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_flush (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Content cairo_surface_get_content (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_mark_dirty (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_surface_reference (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_surface_status (IntPtr surface);
+               #endregion
+
+               #region SVG surface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
+
+               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               //internal static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
+               #endregion
+
+               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+               internal static extern void cairo_show_text (IntPtr cr, byte[] text);
+
+               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+               internal static extern void cairo_text_extents (IntPtr cr, byte[] utf8, out TextExtents extents);
+
+               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+               internal static extern void cairo_show_text (IntPtr cr, ref byte utf8);
+
+               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
+               internal static extern void cairo_text_extents (IntPtr cr, ref byte utf8, out TextExtents extents);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_text_path (IntPtr ct, byte[] utf8);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_transform (IntPtr cr, Matrix matrix);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_translate (IntPtr cr, double tx, double ty);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_version ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_version_string ();
+
+               #region DirectFBSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
+               #endregion
+
+               #region win32 fonts
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
+               #endregion
+
+               #region win32 surface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
+               #endregion
+
+               #region XcbSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
+               #endregion
+
+               #region XlibSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_xlib_surface_get_depth (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_xlib_surface_get_height (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_xlib_surface_get_width (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
+               #endregion
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
+
+               #region GLSurface
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_gl_surface_get_width (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_gl_surface_get_height (IntPtr surface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
+               #endregion
+
+               #region GLX Functions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_glx_device_get_display (IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_glx_device_get_context (IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
+               #endregion
+
+               #region WGL Fucntions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
+               #endregion
+
+               #region EGL Functions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
+               #endregion
+
+               #region DRM Functions
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_device_get_for_fd (int fd);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_device_default ();
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern  void cairo_drm_device_throttle (IntPtr cairo_device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format,     int width, int height);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void     cairo_drm_surface_unmap (IntPtr drmSurface,     IntPtr imageSurface);
+               #endregion
+
+               #region Device
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_device_acquire(IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_device_destroy (IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern IntPtr cairo_device_reference (IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern void cairo_device_release(IntPtr device);
+
+               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+               internal static extern Status cairo_device_status(IntPtr device);
+               #endregion
+       }
+}
\ No newline at end of file
diff --git a/Backends/CairoBackend/src/PSSurface.cs b/Backends/CairoBackend/src/PSSurface.cs
new file mode 100644 (file)
index 0000000..695b05d
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// Mono.Cairo.PostscriptSurface.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class PSSurface : Surface
+       {
+               internal PSSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public PSSurface (string filename, double width, double height)
+                       : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
+               {
+               }
+
+               public void BeginPageSetup ()
+               {
+                       NativeMethods.cairo_ps_surface_dsc_begin_page_setup (handle);
+               }
+
+               public void BeginSetup ()
+               {
+                       NativeMethods.cairo_ps_surface_dsc_begin_setup (handle);
+               }
+
+               public void DscComment (string comment)
+               {
+                       NativeMethods.cairo_ps_surface_dsc_comment (handle, comment);
+               }
+
+               public void SetSize (double width, double height)
+               {
+                       NativeMethods.cairo_ps_surface_set_size (handle, width, height);
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/Path.cs b/Backends/CairoBackend/src/Path.cs
new file mode 100644 (file)
index 0000000..54ae430
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+//   Miguel de Icaza (miguel@novell.com)
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+
+namespace Crow.CairoBackend {
+
+       public class Path : IDisposable
+       {
+               IntPtr handle = IntPtr.Zero;
+
+               internal Path (IntPtr handle)
+               {
+                       this.handle = handle;
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               ~Path ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle { get { return handle; } }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Path> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_path_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/Pattern.cs b/Backends/CairoBackend/src/Pattern.cs
new file mode 100644 (file)
index 0000000..3de491e
--- /dev/null
@@ -0,0 +1,128 @@
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       public class Pattern : IPattern
+       {
+               internal IntPtr handle;
+               public static Pattern Lookup (IntPtr pattern, bool owner)
+               {
+                       if (pattern == IntPtr.Zero)
+                               return null;
+
+                       PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
+                       switch (pt) {
+                       case PatternType.Solid:
+                               return new SolidPattern (pattern, owner);
+                       case PatternType.Surface:
+                               return new SurfacePattern (pattern, owner);
+                       case PatternType.Linear:
+                               return new LinearGradient (pattern, owner);
+                       case PatternType.Radial:
+                               return new RadialGradient (pattern, owner);
+                       default:
+                               return new Pattern (pattern, owner);
+                       }
+               }
+
+               internal Pattern (IntPtr handle, bool owned)
+               {
+                       this.handle = handle;
+                       if (!owned)
+                               NativeMethods.cairo_pattern_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               [Obsolete ("Use the SurfacePattern constructor")]
+               public Pattern (Surface surface)
+                       : this ( NativeMethods.cairo_pattern_create_for_surface (surface.handle), true)
+               {
+               }
+
+               [Obsolete]
+               protected void Reference ()
+               {
+                       NativeMethods.cairo_pattern_reference (handle);
+               }
+
+
+
+               public Status Status => NativeMethods.cairo_pattern_status (handle);
+
+               public Matrix Matrix {
+                       set => NativeMethods.cairo_pattern_set_matrix (handle, value);
+                       get {
+                               Matrix m = new Matrix ();
+                               NativeMethods.cairo_pattern_get_matrix (handle, m);
+                               return m;
+                       }
+               }
+
+               public PatternType PatternType => NativeMethods.cairo_pattern_get_type (handle);
+
+               #region IPattern implementation
+               public Extend Extend
+               {
+                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
+                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
+               }
+               public Filter Filter {
+                       get => NativeMethods.cairo_pattern_get_filter (handle);
+                       set => NativeMethods.cairo_pattern_set_filter (handle, value);
+               }
+               #endregion
+
+               ~Pattern ()
+               {
+                       Dispose (false);
+               }
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Pattern> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_pattern_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/PdfSurface.cs b/Backends/CairoBackend/src/PdfSurface.cs
new file mode 100644 (file)
index 0000000..061eaa4
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// Mono.Cairo.PdfSurface.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class PdfSurface : Surface
+       {
+               internal PdfSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public PdfSurface (string filename, double width, double height)
+                       : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
+               {
+               }
+
+               public void SetSize (double width, double height)
+               {
+                       NativeMethods.cairo_pdf_surface_set_size (handle, width, height);
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/RadialGradient.cs b/Backends/CairoBackend/src/RadialGradient.cs
new file mode 100644 (file)
index 0000000..d27aa54
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class RadialGradient : Gradient
+       {
+               internal RadialGradient (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
+                       : base (NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1), true)
+               {
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/Region.cs b/Backends/CairoBackend/src/Region.cs
new file mode 100644 (file)
index 0000000..139ebc8
--- /dev/null
@@ -0,0 +1,174 @@
+// Copyright (C) 2011 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend
+{
+       [StructLayout(LayoutKind.Sequential)]
+       struct RectangleList {
+               public Status Status;
+               public IntPtr Rectangles;
+               public int NumRectangles;
+       }
+
+
+       public class Region : IRegion {
+
+               IntPtr handle;
+
+               #region CTOR
+               public Region (IntPtr handle, bool owned)
+               {
+                       this.handle = handle;
+                       if (!owned)
+                               NativeMethods.cairo_region_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+               public Region () : this (NativeMethods.cairo_region_create () , true)
+               {}
+               public Region (Rectangle rect) {
+                       handle = NativeMethods.cairo_region_create_rectangle (ref rect);
+               }
+               #endregion
+
+               public Region Copy () => new Region (NativeMethods.cairo_region_copy (handle), true);
+
+
+               public Status Status {
+                       get { return NativeMethods.cairo_region_status (handle); }
+               }
+
+               public Rectangle Extents {
+                       get {
+                               Rectangle result;
+                               NativeMethods.cairo_region_get_extents (handle, out result);
+                               return result;
+                       }
+               }
+
+               public bool Contains (int x, int y)
+               {
+                       return NativeMethods.cairo_region_contains_point (handle, x, y);
+               }
+
+               public void Translate (int dx, int dy)
+               {
+                       NativeMethods.cairo_region_translate (handle, dx, dy);
+               }
+
+               public Status Subtract (Region other)
+               {
+                       return NativeMethods.cairo_region_subtract (handle, other.handle);
+               }
+
+               public Status SubtractRectangle (Rectangle rectangle)
+               {
+                       return NativeMethods.cairo_region_subtract_rectangle (handle, ref rectangle);
+               }
+
+               public Status Intersect (Region other)
+               {
+                       return NativeMethods.cairo_region_intersect (handle, other.handle);
+               }
+
+               public Status IntersectRectangle (Rectangle rectangle)
+               {
+                       return NativeMethods.cairo_region_intersect_rectangle (handle, ref rectangle);
+               }
+
+               public Status Union (Region other)
+               {
+                       return NativeMethods.cairo_region_union (handle, other.handle);
+               }
+
+
+               public Status Xor (Region other)
+               {
+                       return NativeMethods.cairo_region_xor (handle, other.handle);
+               }
+
+               public Status XorRectangle (Rectangle rectangle)
+               {
+                       return NativeMethods.cairo_region_xor_rectangle (handle, ref rectangle);
+               }
+
+               #region  IRegion implementation
+               public bool IsEmpty => NativeMethods.cairo_region_is_empty (handle);
+               public int NumRectangles => NativeMethods.cairo_region_num_rectangles (handle);
+               public Rectangle GetRectangle (int nth)
+               {
+                       Rectangle val;
+                       NativeMethods.cairo_region_get_rectangle (handle, nth, out val);
+                       return val;
+               }
+               public void UnionRectangle (Rectangle rectangle)
+                       => NativeMethods.cairo_region_union_rectangle (handle, ref rectangle);
+               public bool OverlapOut (Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out;
+               public RegionOverlap Contains (Rectangle rectangle)
+                       => NativeMethods.cairo_region_contains_rectangle (handle, ref rectangle);
+               public void Reset () {
+                       if (IsEmpty)
+                               return;
+                       NativeMethods.cairo_region_destroy (handle);
+                       handle = NativeMethods.cairo_region_create ();
+               }
+
+               public bool Equals(IRegion other)
+                       => other is Region r ? NativeMethods.cairo_region_equal (handle, r.handle) : false;
+               #endregion
+
+               public override bool Equals (object obj)
+                       => obj is Region r ? NativeMethods.cairo_region_equal (handle, r.handle) : false;
+
+               public override int GetHashCode () => handle.GetHashCode ();
+
+               #region IDisposable
+               ~Region ()
+               {
+                       Dispose (false);
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Region> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_region_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+               #endregion
+       }
+}
diff --git a/Backends/CairoBackend/src/ScaledFont.cs b/Backends/CairoBackend/src/ScaledFont.cs
new file mode 100644 (file)
index 0000000..8fc245e
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// Mono.Cairo.ScaledFont.cs
+//
+// (c) 2008 Jordi Mas i Hernandez (jordimash@gmail.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+       public class ScaledFont : IDisposable
+       {
+               protected IntPtr handle = IntPtr.Zero;
+
+               internal ScaledFont (IntPtr handle, bool owner)
+               {
+                       this.handle = handle;
+                       if (!owner)
+                               NativeMethods.cairo_scaled_font_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               public ScaledFont (FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options)
+                       : this (NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle), true)
+               {
+               }
+
+               ~ScaledFont ()
+               {
+                       Dispose (false);
+               }
+
+               public IntPtr Handle {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public FontExtents FontExtents {
+                       get {
+                               FontExtents extents;
+                               NativeMethods.cairo_scaled_font_extents (handle, out extents);
+                               return extents;
+                       }
+               }
+
+               public Matrix FontMatrix {
+                       get {
+                               Matrix m;
+                               NativeMethods.cairo_scaled_font_get_font_matrix (handle, out m);
+                               return m;
+                       }
+               }
+
+               public FontType FontType {
+                       get {
+                               return NativeMethods.cairo_scaled_font_get_type (handle);
+                       }
+               }
+
+               public TextExtents GlyphExtents (Glyph[] glyphs)
+               {
+                       IntPtr ptr = Context.FromGlyphToUnManagedMemory (glyphs);
+                       TextExtents extents;
+
+                       NativeMethods.cairo_scaled_font_glyph_extents (handle, ptr, glyphs.Length, out extents);
+
+                       Marshal.FreeHGlobal (ptr);
+                       return extents;
+               }
+       
+               public Status Status
+               {
+                       get { return NativeMethods.cairo_scaled_font_status (handle); }
+               }
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<ScaledFont> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_scaled_font_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+
+               [Obsolete]
+               protected void Reference ()
+               {
+                       NativeMethods.cairo_scaled_font_reference (handle);
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/SolidPattern.cs b/Backends/CairoBackend/src/SolidPattern.cs
new file mode 100644 (file)
index 0000000..65e86a0
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class SolidPattern : Pattern
+       {
+               internal SolidPattern (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public SolidPattern (Color color)
+                       : base (NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A), true)
+               {
+               }
+
+               public SolidPattern (double r, double g, double b)
+                       : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
+               {
+               }
+
+               public SolidPattern (double r, double g, double b, double a)
+                       : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
+               {
+               }
+
+               public SolidPattern (Color color, bool solid)
+                       : base (solid
+                                       ? NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B)
+                                       : NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A),
+                               true)
+               {
+               }
+
+               public Color Color {
+                       get {
+                               double red, green, blue, alpha;
+                               NativeMethods.cairo_pattern_get_rgba  (handle, out red, out green, out blue, out alpha);
+                               return new Color (red, green, blue, alpha);
+                       }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/Status.cs b/Backends/CairoBackend/src/Status.cs
new file mode 100644 (file)
index 0000000..79252f6
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// Mono.Cairo.Status.cs
+//
+// Authors:
+//   Duncan Mak (duncan@ximian.com)
+//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//   John Luke (john.luke@gmail.com)
+//   Alp Toker (alp@atoker.com)
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005 John Luke
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       
+       public enum Status
+       {
+               Success = 0,
+               NoMemory,
+               InvalidRestore,
+               InvalidPopGroup,
+               NoCurrentPoint,
+               InvalidMatrix,
+               InvalidStatus,
+               NullPointer,
+               InvalidString,
+               InvalidPathData,
+               ReadError,
+               WriteError,
+               SurfaceFinished,
+               SurfaceTypeMismatch,
+               PatternTypeMismatch,
+               InvalidContent,
+               InvalidFormat,
+               InvalidVisual,
+               FileNotFound,
+               InvalidDash,
+               InvalidDscComment,
+               InvalidIndex,
+               ClipNotRepresentable,
+       }
+}
diff --git a/Backends/CairoBackend/src/SubpixelOrder.cs b/Backends/CairoBackend/src/SubpixelOrder.cs
new file mode 100644 (file)
index 0000000..569225f
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Mono.Cairo.Cairo.cs
+//
+// Authors:
+//   John Luke (john.luke@gmail.com)
+//
+// Copyright (C) John Luke 2005
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend
+{
+       public enum SubpixelOrder
+       {
+               Default,
+               Rgb,
+               Bgr,
+               Vrgb,
+               Vbgr,
+       }
+}
diff --git a/Backends/CairoBackend/src/Surface.cs b/Backends/CairoBackend/src/Surface.cs
new file mode 100644 (file)
index 0000000..80435b5
--- /dev/null
@@ -0,0 +1,229 @@
+//
+// Mono.Cairo.Surface.cs
+//
+// Authors:
+//    Duncan Mak
+//    Miguel de Icaza.
+//    Alp Toker
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class Surface : ISurface
+       {
+               internal IntPtr handle = IntPtr.Zero;
+
+               protected Surface()
+               {
+               }
+
+               [Obsolete]
+               protected Surface (IntPtr ptr) : this (ptr, true)
+               {
+               }
+
+               protected Surface (IntPtr handle, bool owner)
+               {
+                       this.handle = handle;
+                       if (!owner)
+                               NativeMethods.cairo_surface_reference (handle);
+                       if (CairoDebug.Enabled)
+                               CairoDebug.OnAllocated (handle);
+               }
+
+               public static Surface Lookup (IntPtr surface, bool owned)
+               {
+                       SurfaceType st = NativeMethods.cairo_surface_get_type (surface);
+                       switch (st) {
+                       case SurfaceType.Image:
+                               return new ImageSurface (surface, owned);
+                       case SurfaceType.Xlib:
+                               return new XlibSurface (surface, owned);
+                       case SurfaceType.Xcb:
+                               return new XcbSurface (surface, owned);
+                       case SurfaceType.Glitz:
+                               return new GlitzSurface (surface, owned);
+                       case SurfaceType.Win32:
+                               return new Win32Surface (surface, owned);
+                       case SurfaceType.Pdf:
+                               return new PdfSurface (surface, owned);
+                       case SurfaceType.PS:
+                               return new PSSurface (surface, owned);
+                       case SurfaceType.DirectFB:
+                               return new DirectFBSurface (surface, owned);
+                       case SurfaceType.Svg:
+                               return new SvgSurface (surface, owned);
+                       case SurfaceType.GL:
+                               return new GLSurface (surface, owned);
+                       default:
+                               return new Surface (surface, owned);
+                       }
+               }
+
+               [Obsolete ("Use an ImageSurface constructor instead.")]
+               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 Surface (p, true);
+               }
+
+               [Obsolete ("Use an ImageSurface constructor instead.")]
+               public static Surface CreateForImage (
+                       Format format, int width, int height)
+               {
+                       IntPtr p = NativeMethods.cairo_image_surface_create (
+                               format, width, height);
+
+                       return new Surface (p, true);
+               }
+
+
+               public ISurface CreateSimilar (int width, int height) {
+                       IntPtr p = NativeMethods.cairo_surface_create_similar (
+                               this.handle, Content.ColorAlpha, width, height);
+                       return Surface.Lookup(p, true);
+               }
+
+               ~Surface ()
+               {
+                       Dispose (false);
+               }
+
+
+               public void Dispose ()
+               {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposing || CairoDebug.Enabled)
+                               CairoDebug.OnDisposed<Surface> (handle, disposing);
+
+                       if (!disposing|| handle == IntPtr.Zero)
+                               return;
+
+                       NativeMethods.cairo_surface_destroy (handle);
+                       handle = IntPtr.Zero;
+               }
+               public virtual void Resize (int width, int height) {
+                       
+               }
+
+               public Status Finish ()
+               {
+                       NativeMethods.cairo_surface_finish (handle);
+                       return Status;
+               }
+
+               public virtual void Flush ()
+               {
+                       NativeMethods.cairo_surface_flush (handle);
+               }
+
+               public void MarkDirty ()
+               {
+                       NativeMethods.cairo_surface_mark_dirty (handle);
+               }
+
+               public void MarkDirty (Rectangle rectangle)
+               {
+                       NativeMethods.cairo_surface_mark_dirty_rectangle (handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+               }
+               public virtual int Width => NativeMethods.cairo_image_surface_get_width (handle);
+               public virtual int Height => NativeMethods.cairo_image_surface_get_height (handle);
+               public PointD DeviceOffset {
+                       get {
+                               double x, y;
+                               NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
+                               return new PointD (x, y);
+                       }
+
+                       set {
+                               NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
+                       }
+               }
+
+               [Obsolete ("Use Dispose()")]
+               public void Destroy()
+               {
+                       Dispose ();
+               }
+
+               public void SetFallbackResolution (double x, double y)
+               {
+                       NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
+               }
+
+               public void WriteToPng (string filename)
+               {
+                       NativeMethods.cairo_surface_write_to_png (handle, filename);
+               }
+
+               [Obsolete ("Use Handle instead.")]
+               public IntPtr Pointer {
+                       get {
+                               return handle;
+                       }
+               }
+
+               public Status Status {
+                       get { return NativeMethods.cairo_surface_status (handle); }
+               }
+
+               public Content Content {
+                       get { return NativeMethods.cairo_surface_get_content (handle); }
+               }
+
+               public SurfaceType SurfaceType {
+                       get { return NativeMethods.cairo_surface_get_type (handle); }
+               }
+
+               public uint ReferenceCount {
+                       get { return NativeMethods.cairo_surface_get_reference_count (handle); }
+               }
+
+               public void WriteTo(IntPtr bitmap)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public void Clear()
+               {
+                       throw new NotImplementedException();
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/SurfacePattern.cs b/Backends/CairoBackend/src/SurfacePattern.cs
new file mode 100644 (file)
index 0000000..85a3134
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// Mono.Cairo.Pattern.cs
+//
+// Author: Jordi Mas (jordi@ximian.com)
+//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// (C) Ximian Inc, 2004.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+       public class SurfacePattern : Pattern
+       {
+               internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
+               {
+               }
+
+               public SurfacePattern (Surface surface)
+                       : base (NativeMethods.cairo_pattern_create_for_surface (surface.handle), true)
+               {
+               }
+
+               //no idea why this is here, the base one is identical, but we can't remove it now
+               public new Extend Extend {
+                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
+                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
+               }
+
+               public Filter Filter {
+                       set { NativeMethods.cairo_pattern_set_filter (handle, value); }
+                       get { return NativeMethods.cairo_pattern_get_filter (handle); }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/SurfaceType.cs b/Backends/CairoBackend/src/SurfaceType.cs
new file mode 100644 (file)
index 0000000..816635c
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// Mono.Cairo.SurfaceType.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+       public enum SurfaceType
+       {
+               Image,
+               Pdf,
+               PS,
+               Xlib,
+               Xcb,
+               Glitz,
+               Quartz,
+               Win32,
+               BeOS,
+               DirectFB,
+               Svg,
+               OS2,
+               Win32Printing,
+               QuartzImage,
+               Script,
+               Qt,
+               Recording,
+               VG,
+               GL,
+               Drm,
+               Tee,
+               Xml,
+               Skia,
+               SubSurface
+       }
+}
diff --git a/Backends/CairoBackend/src/SvgSurface.cs b/Backends/CairoBackend/src/SvgSurface.cs
new file mode 100644 (file)
index 0000000..d6d53c3
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// Mono.Cairo.SvgSurface.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class SvgSurface : Surface
+       {
+               internal SvgSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public SvgSurface (string filename, double width, double height)
+                       : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
+               {
+               }
+
+               public void RestrictToVersion (SvgVersion version)
+               {
+                       NativeMethods.cairo_svg_surface_restrict_to_version (handle, version);
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/SvgVersion.cs b/Backends/CairoBackend/src/SvgVersion.cs
new file mode 100644 (file)
index 0000000..f79cc67
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// Mono.Cairo.SvgVersion.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+       public enum SvgVersion
+       {
+               // FIXME: yuck
+               OnePointOne = 0,
+               OnePointTwo,
+       }
+}
+
diff --git a/Backends/CairoBackend/src/WGLDevice.cs b/Backends/CairoBackend/src/WGLDevice.cs
new file mode 100644 (file)
index 0000000..4d7773e
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Mono.Cairo.Device.cs
+//
+// Authors:
+//                     JP Bruyère (jp_bruyere@hotmail.com)
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2016 JP Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Crow.CairoBackend
+{
+       public class WGLDevice : GLDevice
+       {
+               public WGLDevice (IntPtr hglrc) : base (NativeMethods.cairo_wgl_device_create (hglrc), true)
+               {
+               }
+
+               public IntPtr Context {
+                       get { return NativeMethods.cairo_wgl_device_get_context (handle); }
+               }
+       }
+}
+
diff --git a/Backends/CairoBackend/src/Win32Surface.cs b/Backends/CairoBackend/src/Win32Surface.cs
new file mode 100644 (file)
index 0000000..a10a9cf
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// Mono.Cairo.Win32Surface.cs
+//
+// Authors:
+//    John Luke
+//
+// (C) John Luke, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class Win32Surface : Surface
+       {
+               IntPtr hdc;
+               internal Win32Surface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public Win32Surface (IntPtr hdc)
+                       : base (NativeMethods.cairo_win32_surface_create (hdc), true)
+               {
+                       this.hdc = hdc;
+               }
+               public override void Resize(int width, int height)
+               {
+                       if (hdc == IntPtr.Zero)
+                               base.Resize (width, height);
+                       else {
+                               NativeMethods.cairo_surface_destroy (handle);
+                               handle = NativeMethods.cairo_win32_surface_create (hdc);
+                       }
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/XcbSurface.cs b/Backends/CairoBackend/src/XcbSurface.cs
new file mode 100644 (file)
index 0000000..ed557d0
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Mono.Cairo.XcbSurface.cs
+//
+// Authors:
+//    Alp Toker
+//
+// (C) Alp Toker, 2006.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+       public class XcbSurface : Surface
+       {
+               internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns)
+               {
+               }
+
+               public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
+                       : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
+               {
+               }
+
+               public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
+               {
+                       IntPtr ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
+                       return new XcbSurface (ptr, true);
+               }
+               public override void Resize (int width, int height)
+               {
+                       NativeMethods.cairo_xcb_surface_set_size (handle, width, height);
+               }
+       }
+}
diff --git a/Backends/CairoBackend/src/XlibSurface.cs b/Backends/CairoBackend/src/XlibSurface.cs
new file mode 100644 (file)
index 0000000..6aea448
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// Mono.Cairo.XlibSurface.cs
+//
+// Authors:
+//    Duncan Mak
+//    Miguel de Icaza.
+//       JP Bruyère
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell, Inc. 2003.
+// (C) JP Bruyère 2021
+//
+// This is an OO wrapper API for the Cairo API
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// 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
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Crow.CairoBackend {
+
+       public class XlibSurface : Surface
+       {
+               public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
+                       : base (NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height), true)
+               {
+               }
+
+               public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
+               {
+               }
+
+               public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
+               {
+                       IntPtr ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
+                       return new XlibSurface(ptr, true);
+               }
+
+               public void SetDrawable (IntPtr drawable, int width, int height)
+               {
+                       NativeMethods.cairo_xlib_surface_set_drawable (handle, drawable, width, height);
+               }
+
+               public override void Resize (int width, int height)
+               {
+                       NativeMethods.cairo_xlib_surface_set_size (handle, width, height);
+               }
+
+               public int Depth => NativeMethods.cairo_xlib_surface_get_depth (handle);
+               public IntPtr Display => NativeMethods.cairo_xlib_surface_get_display (handle);
+               public IntPtr Drawable => NativeMethods.cairo_xlib_surface_get_drawable (handle);
+               public override int Width => NativeMethods.cairo_xlib_surface_get_width (handle);
+               public override int Height => NativeMethods.cairo_xlib_surface_get_height (handle);
+
+               public IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (handle);
+               public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (handle);
+       }
+}
diff --git a/Backends/CairoBackend/src/rsvg/SvgHandle.cs b/Backends/CairoBackend/src/rsvg/SvgHandle.cs
new file mode 100644 (file)
index 0000000..e767ce3
--- /dev/null
@@ -0,0 +1,99 @@
+//Copyright GPL2
+using System;
+using System.Runtime.InteropServices;
+using Drawing2D;
+
+namespace Crow.CairoBackend {
+
+
+       public sealed class SvgHandle : ISvgHandle {
+               const string lib = "rsvg-2.40";
+
+               public IntPtr Raw;
+
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_new();
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_new_from_data (byte[] data, UIntPtr n_data, out IntPtr error);
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_new_from_file (string file_name, out IntPtr error);
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_get_base_uri (IntPtr raw);
+               [DllImport (lib)]
+               static extern void rsvg_handle_set_dpi (IntPtr raw, double dpi);
+               [DllImport (lib)]
+               static extern void rsvg_handle_set_dpi_x_y (IntPtr raw, double dpi_x, double dpi_y);
+
+               [DllImport (lib)]
+               static extern void rsvg_handle_render_cairo (IntPtr raw, IntPtr cr);
+               [DllImport (lib)]
+               static extern void rsvg_handle_render_cairo_sub (IntPtr raw, IntPtr cr, string id);
+
+               [DllImport (lib)]
+               static extern void rsvg_handle_get_dimensions (IntPtr raw, IntPtr dimension_data);
+               [DllImport (lib)]
+               static extern bool rsvg_handle_close (IntPtr raw, out IntPtr error);
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_get_title (IntPtr raw);
+               [DllImport (lib)]
+               static extern IntPtr rsvg_handle_get_metadata (IntPtr raw);
+
+               public SvgHandle ()
+               {
+                       Raw = rsvg_handle_new();
+               }
+               public  SvgHandle (byte[] data)
+               {
+                       Raw = rsvg_handle_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), out IntPtr error);
+                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
+               }
+               public SvgHandle (string file_name)
+               {
+                       Raw = rsvg_handle_new_from_file(file_name, out IntPtr error);
+                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
+               }
+
+
+               public double Dpi { set => rsvg_handle_set_dpi (Raw, value); }
+               public void SetDpiXY (double dpi_x, double dpi_y) => rsvg_handle_set_dpi_x_y (Raw, dpi_x, dpi_y);
+
+
+               public void Render(IContext cr) =>
+                       rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle);
+
+               public void Render (IContext cr, string id) =>
+                       rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle, id);
+
+               [StructLayout(LayoutKind.Sequential)]
+               struct DimensionData {
+
+                       public int Width;
+                       public int Height;
+                       public double Em;
+                       public double Ex;
+
+                       public static DimensionData Zero = new DimensionData ();
+
+                       public static DimensionData New(IntPtr raw) {
+                               if (raw == IntPtr.Zero)
+                                       return DimensionData.Zero;
+                               return (DimensionData) Marshal.PtrToStructure (raw, typeof (DimensionData));
+                       }
+               }
+               public Size Dimensions {
+                       get {
+                               DimensionData dimension_data;
+                               IntPtr native_dimension_data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (DimensionData)));
+                               rsvg_handle_get_dimensions(Raw, native_dimension_data);
+                               dimension_data = DimensionData.New (native_dimension_data);
+                               Marshal.FreeHGlobal (native_dimension_data);
+                               return new Size (dimension_data.Width, dimension_data.Height);
+                       }
+               }
+
+               public void Dispose() {
+                       bool raw_ret = rsvg_handle_close(Raw, out IntPtr error);
+                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
+               }
+       }
+}
diff --git a/Backends/Crow.CairoBackend/Crow.CairoBackend.csproj b/Backends/Crow.CairoBackend/Crow.CairoBackend.csproj
deleted file mode 100644 (file)
index 9574174..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-         <TargetFramework>netcoreapp3.1</TargetFramework>
-
-               <AssemblyVersion>1.0.0</AssemblyVersion>
-               <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
-
-               <Title>C.R.O.W Cairo Backend</Title>
-               <Description>C.R.O.W. is a widget toolkit and rendering engine developed in C# with templates, styles, compositing, and bindings.</Description>
-               <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
-               <PackageTags>Crow GUI Backend cairo</PackageTags>
-               <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
-               <PackageProjectUrl>https://github.com/jpbruyere/Crow/wiki</PackageProjectUrl>
-               <PackageLicenseExpression>MIT</PackageLicenseExpression>
-               <PackageIcon>crow.png</PackageIcon>
-               <PackageCopyright>Copyright 2021</PackageCopyright>
-               <PackageReleaseNotes>
-               </PackageReleaseNotes>
-               <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-               <GenerateDocumentationFile>true</GenerateDocumentationFile>
-         <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
-  </PropertyGroup>
-
-  <ItemGroup>
-         <Compile Include="src\**\*.cs" Exclude="src\NativeMethods-internal.cs" />
-    <Content Include="..\..\Images\crow.png" Pack="true" PackagePath="" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Include="glfw-sharp" Version="$(GlfwSharpVersion)" />
-    <PackageReference Include="OpenGL.Net" Version="0.8.4" />
-    <ProjectReference Include="..\..\Drawing2D\Drawing2D.csproj" />
-  </ItemGroup>
-
-       <PropertyGroup Condition=" '$(CrowStbSharp)' == 'true'">
-               <DefineConstants>$(DefineConstants);STB_SHARP</DefineConstants>
-       </PropertyGroup>
-
-</Project>
diff --git a/Backends/Crow.CairoBackend/src/Cairo.cs b/Backends/Crow.CairoBackend/src/Cairo.cs
deleted file mode 100644 (file)
index 55f1335..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//          John Luke (john.luke@gmail.com)
-//          Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.CairoBackend
-{
-       public static class CairoAPI {
-               static public int Version {
-                       get {
-                               return NativeMethods.cairo_version ();
-                       }
-               }
-
-               static public string VersionString {
-                       get {
-                               IntPtr x = NativeMethods.cairo_version_string ();
-                               return Marshal.PtrToStringAnsi (x);
-                       }
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/CairoBackendBase.cs b/Backends/Crow.CairoBackend/src/CairoBackendBase.cs
deleted file mode 100644 (file)
index c7821ee..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.IO;
-using Drawing2D;
-using Glfw;
-
-namespace Crow.CairoBackend
-{
-       public abstract class CairoBackendBase : CrowBackend {
-               /// <summary>
-               /// Main rendering surface, usualy an accelerated window surface
-               /// </summary>
-               protected Surface surf;
-               protected IRegion clipping;
-               /// <summary> Global font rendering settings for Cairo </summary>
-               FontOptions FontRenderingOptions;
-               /// <summary> Global font rendering settings for Cairo </summary>
-               Antialias Antialias = Antialias.Subpixel;
-               bool disposeContextOnFlush;
-               protected CairoBackendBase (int width, int height, IntPtr nativeWindow)
-               : base (width, height, nativeWindow)
-               {
-                       FontRenderingOptions = new FontOptions ();
-                       FontRenderingOptions.Antialias = Antialias.Subpixel;
-                       FontRenderingOptions.HintMetrics = HintMetrics.On;
-                       FontRenderingOptions.HintStyle = HintStyle.Full;
-                       FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default;
-               }
-               ~CairoBackendBase ()
-               {
-                       Dispose (false);
-               }
-               public override abstract ISurface CreateSurface(int width, int height);
-               public override abstract ISurface CreateSurface(byte[] data, int width, int height);
-               public override ISurface MainSurface => surf;
-               public override IRegion CreateRegion () => new Region ();
-               public override IContext CreateContext (ISurface surf)
-               {
-                       Context gr = new Context (surf as Surface);
-                       gr.FontOptions = FontRenderingOptions;
-                       gr.Antialias = Antialias;
-                       return gr;
-               }
-               //IPattern CreatePattern (PatternType patternType);
-               public override IGradient CreateGradient (GradientType gradientType, Rectangle bounds)
-               {
-                       switch (gradientType) {
-                       case GradientType.Vertical:
-                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Left, bounds.Bottom);
-                       case GradientType.Horizontal:
-                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Right, bounds.Top);
-                       case GradientType.Oblic:
-                               return new LinearGradient (bounds.Left, bounds.Top, bounds.Right, bounds.Bottom);
-                       case GradientType.Radial:
-                               throw new NotImplementedException ();
-                       }
-                       return null;
-               }
-               public override byte[] LoadBitmap (Stream stream, out Size dimensions)
-               {
-                       byte[] image;
-#if STB_SHARP
-                       StbImageSharp.ImageResult stbi = StbImageSharp.ImageResult.FromStream (stream, StbImageSharp.ColorComponents.RedGreenBlueAlpha);
-                       image = new byte[stbi.Data.Length];
-                       //rgba to argb for cairo.
-                       for (int i = 0; i < stbi.Data.Length; i += 4) {
-                               image[i] = stbi.Data[i + 2];
-                               image[i + 1] = stbi.Data[i + 1];
-                               image[i + 2] = stbi.Data[i];
-                               image[i + 3] = stbi.Data[i + 3];
-                       }
-                       dimensions = new Size (stbi.Width, stbi.Height);
-#else
-                       using (StbImage stbi = new StbImage (stream)) {
-                               image = new byte [stbi.Size];
-                               for (int i = 0; i < stbi.Size; i+=4) {
-                                       //rgba to argb for cairo. ???? looks like bgra to me.
-                                       image [i] = Marshal.ReadByte (stbi.Handle, i + 2);
-                                       image [i + 1] = Marshal.ReadByte (stbi.Handle, i + 1);
-                                       image [i + 2] = Marshal.ReadByte (stbi.Handle, i);
-                                       image [i + 3] = Marshal.ReadByte (stbi.Handle, i + 3);
-                               }
-                               dimensions = new Size (stbi.Width, stbi.Height);
-                       }
-#endif
-                       return image;
-               }
-               public override ISvgHandle LoadSvg(Stream stream)
-               {
-                       using (BinaryReader sr = new BinaryReader (stream))
-                               return new SvgHandle (sr.ReadBytes ((int)stream.Length));
-               }
-               public override ISvgHandle LoadSvg(string svgFragment) =>
-                       new SvgHandle (System.Text.Encoding.Unicode.GetBytes (svgFragment));
-               protected void clear(IContext ctx) {
-                       for (int i = 0; i < clipping.NumRectangles; i++)
-                               ctx.Rectangle (clipping.GetRectangle (i));
-
-                       ctx.ClipPreserve ();
-                       ctx.Operator = Operator.Clear;
-                       ctx.Fill ();
-                       ctx.Operator = Operator.Over;
-               }
-               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
-               {
-                       this.clipping = clipping;
-                       IContext ctx = existingContext;
-                       if (ctx == null) {
-                               disposeContextOnFlush = true;
-                               ctx = new Context (surf);
-                       } else
-                               disposeContextOnFlush = false;
-                       return ctx;
-               }
-               public override void FlushUIFrame(IContext ctx)
-               {
-                       if (disposeContextOnFlush)
-                               ctx.Dispose ();
-                       clipping = null;
-               }
-               public override void ResizeMainSurface (int width, int height)
-               {
-                       surf.Resize (width, height);
-               }
-
-               #region IDispose implementation
-               public override void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!isDisposed && disposing) {
-                               surf.Dispose ();
-                               FontRenderingOptions.Dispose ();
-                       }
-                       isDisposed = true;
-               }
-               #endregion
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/CairoDebug.cs b/Backends/Crow.CairoBackend/src/CairoDebug.cs
deleted file mode 100644 (file)
index c3e92be..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// CairoDebug.cs
-//
-// Author:
-//   Michael Hutchinson (mhutch@xamarin.com)
-//
-// Copyright (C) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       static class CairoDebug
-       {
-               static System.Collections.Generic.Dictionary<IntPtr,string> traces;
-
-               public static readonly bool Enabled;
-
-               static CairoDebug ()
-               {
-                       var dbg = Environment.GetEnvironmentVariable ("MONO_CAIRO_DEBUG_DISPOSE");
-                       if (dbg == null)
-                               return;
-                       Enabled = true;
-                       traces = new System.Collections.Generic.Dictionary<IntPtr,string> ();
-               }
-
-               public static void OnAllocated (IntPtr obj)
-               {
-                       if (!Enabled)
-                               throw new InvalidOperationException ();
-
-                       traces[obj] = Environment.StackTrace;
-               }
-
-               public static void OnDisposed<T> (IntPtr obj, bool disposing)
-               {
-                       if (disposing && !Enabled)
-                               throw new InvalidOperationException ();
-
-                       if (Environment.HasShutdownStarted)
-                               return;
-
-                       if (!disposing) {
-                               System.Diagnostics.Debug.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
-                               if (Enabled) {
-                                       string val;
-                                       if (traces.TryGetValue (obj, out val)) {
-                                               System.Diagnostics.Debug.WriteLine ("Allocated from:");
-                                               System.Diagnostics.Debug.WriteLine (val);
-                                       }
-                               } else {
-                                       System.Diagnostics.Debug.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
-                               }
-                       }
-
-                       if (Enabled)
-                               traces.Remove (obj);
-               }
-       }
-
-}
diff --git a/Backends/Crow.CairoBackend/src/Content.cs b/Backends/Crow.CairoBackend/src/Content.cs
deleted file mode 100644 (file)
index 9096bf0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Mono.Cairo.Content.cs
-//
-// Authors:
-//   Duncan Mak (duncan@ximian.com)
-//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       //[Flags]
-       public enum Content
-       {
-               Color = 0x1000,
-               Alpha = 0x2000,
-               ColorAlpha = 0x3000,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Context.cs b/Backends/Crow.CairoBackend/src/Context.cs
deleted file mode 100644 (file)
index c15ecaa..0000000
+++ /dev/null
@@ -1,667 +0,0 @@
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-//   Duncan Mak (duncan@ximian.com)
-//   Miguel de Icaza (miguel@novell.com)
-//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//   Alp Toker (alp@atoker.com)
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       public class Context : IContext
-       {
-               internal IntPtr handle = IntPtr.Zero;
-
-               static int native_glyph_size, c_compiler_long_size;
-
-               static Context ()
-               {
-                       //
-                       // This is used to determine what kind of structure
-                       // we should use to marshal Glyphs, as the public
-                       // definition in Cairo uses `long', which can be
-                       // 32 bits or 64 bits depending on the platform.
-                       //
-                       // We assume that sizeof(long) == sizeof(void*)
-                       // except in the case of Win64 where sizeof(long)
-                       // is 32 bits
-                       //
-                       int ptr_size = Marshal.SizeOf (typeof (IntPtr));
-
-                       PlatformID platform = Environment.OSVersion.Platform;
-                       if (platform == PlatformID.Win32NT ||
-                           platform == PlatformID.Win32S ||
-                           platform == PlatformID.Win32Windows ||
-                           platform == PlatformID.WinCE ||
-                           ptr_size == 4){
-                               c_compiler_long_size = 4;
-                               native_glyph_size = Marshal.SizeOf (typeof (NativeGlyph_4byte_longs));
-                       } else {
-                               c_compiler_long_size = 8;
-                               native_glyph_size = Marshal.SizeOf (typeof (Glyph));
-                       }
-               }
-
-               internal Context (Surface surface) : this (NativeMethods.cairo_create (surface.handle), true)
-               {
-               }
-
-
-               internal Context (IntPtr handle, bool owner)
-               {
-                       this.handle = handle;
-                       if (!owner)
-                               NativeMethods.cairo_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               [Obsolete]
-               internal Context (IntPtr state) : this (state, true)
-               {
-               }
-
-               ~Context ()
-               {
-                       Dispose (false);
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Context> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_destroy (handle);
-                       handle = IntPtr.Zero;
-
-               }
-
-               public void Save ()
-               {
-                       NativeMethods.cairo_save (handle);
-               }
-
-               public void Restore ()
-               {
-                       NativeMethods.cairo_restore (handle);
-               }
-
-               public Antialias Antialias {
-                       get { return NativeMethods.cairo_get_antialias (handle); }
-                       set { NativeMethods.cairo_set_antialias (handle, value); }
-               }
-
-               public Status Status {
-                       get {
-                               return NativeMethods.cairo_status (handle);
-                       }
-               }
-               public string StatusString {
-                       get {
-                               return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (Status));
-                       }
-               }
-
-               public Operator Operator {
-                       set => NativeMethods.cairo_set_operator (handle, value);
-                       get => NativeMethods.cairo_get_operator (handle);
-               }
-               public double Tolerance {
-                       get => NativeMethods.cairo_get_tolerance (handle);
-                       set => NativeMethods.cairo_set_tolerance (handle, value);
-               }
-               public FillRule FillRule {
-                       set => NativeMethods.cairo_set_fill_rule (handle, value);
-                       get => NativeMethods.cairo_get_fill_rule (handle);
-               }
-               public double LineWidth {
-                       set => NativeMethods.cairo_set_line_width (handle, value);
-                       get => NativeMethods.cairo_get_line_width (handle);
-               }
-               public LineCap LineCap {
-                       set => NativeMethods.cairo_set_line_cap (handle, value);
-                       get => NativeMethods.cairo_get_line_cap (handle);
-               }
-               public LineJoin LineJoin {
-                       set => NativeMethods.cairo_set_line_join (handle, value);
-                       get => NativeMethods.cairo_get_line_join (handle);
-               }
-               public double MiterLimit {
-                       set => NativeMethods.cairo_set_miter_limit (handle, value);
-                       get => NativeMethods.cairo_get_miter_limit (handle);
-               }
-
-               public void SetDash (double [] dashes, double offset = 0)
-                       => NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset);
-
-               public void SetSource (Pattern source)
-                       => NativeMethods.cairo_set_source (handle, source.handle);
-               public Pattern GetSource ()
-               {
-                       var ptr = NativeMethods.cairo_get_source (handle);
-                       return Pattern.Lookup (ptr, false);
-               }
-
-
-               public PointD CurrentPoint {
-                       get {
-                               double x, y;
-                               NativeMethods.cairo_get_current_point (handle, out x, out y);
-                               return new PointD (x, y);
-                       }
-               }
-
-               public bool HasCurrentPoint => NativeMethods.cairo_has_current_point (handle);
-               public Surface GetTarget () =>  Surface.Lookup (NativeMethods.cairo_get_target (handle), false);
-               public void SetTarget (Surface target)
-               {
-                       if (handle != IntPtr.Zero)
-                               NativeMethods.cairo_destroy (handle);
-                       handle = NativeMethods.cairo_create (target.handle);
-               }
-               public ScaledFont GetScaledFont ()
-                       => new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false);
-               public void SetScaledFont (ScaledFont font)
-                       => NativeMethods.cairo_set_scaled_font (handle, font.Handle);
-               public uint ReferenceCount => NativeMethods.cairo_get_reference_count (handle);
-               public void SetSource (Color color)
-                       => NativeMethods.cairo_set_source_rgba (handle, color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
-               public void SetSource (double r, double g, double b)
-               {
-                       NativeMethods.cairo_set_source_rgb (handle, r, g, b);
-               }
-
-               public void SetSource (double r, double g, double b, double a)
-               {
-                       NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
-               }
-
-               //[Obsolete ("Use SetSource method (with double parameters)")]
-               public void SetSource (Surface source, int x = 0, int y = 0)
-               {
-                       NativeMethods.cairo_set_source_surface (handle, source.handle, x, y);
-               }
-
-               public void SetSource (Surface source, double x, double y)
-               {
-                       NativeMethods.cairo_set_source_surface (handle, source.handle, x, y);
-               }
-
-               public void SetSource (Surface source)
-               {
-                       NativeMethods.cairo_set_source_surface (handle, source.handle, 0, 0);
-               }
-
-               #region Path methods
-               public void NewPath () => NativeMethods.cairo_new_path (handle);
-               public void NewSubPath () => NativeMethods.cairo_new_sub_path (handle);
-               public void MoveTo (PointD p) => MoveTo (p.X, p.Y);
-               public void MoveTo (double x, double y) => NativeMethods.cairo_move_to (handle, x, y);
-               public void LineTo (PointD p) => LineTo (p.X, p.Y);
-               public void LineTo (double x, double y) => NativeMethods.cairo_line_to (handle, x, y);
-               public void CurveTo (PointD p1, PointD p2, PointD p3) => CurveTo (p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
-               public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
-                       => NativeMethods.cairo_curve_to (handle, x1, y1, x2, y2, x3, y3);
-               public void RelMoveTo (Distance d) => RelMoveTo (d.Dx, d.Dy);
-               public void RelMoveTo (double dx, double dy) => NativeMethods.cairo_rel_move_to (handle, dx, dy);
-               public void RelLineTo (Distance d) => RelLineTo (d.Dx, d.Dy);
-               public void RelLineTo (double dx, double dy) => NativeMethods.cairo_rel_line_to (handle, dx, dy);
-               public void RelCurveTo (Distance d1, Distance d2, Distance d3)
-                       => RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
-               public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
-                       => NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
-               public void Arc (double xc, double yc, double radius, double angle1, double angle2)
-                       => NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
-               public void Arc (PointD center, double radius, double angle1, double angle2)
-                       => NativeMethods.cairo_arc (handle, center.X, center.Y, radius, angle1, angle2);
-               public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
-                       => NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
-               public void ArcNegative (PointD center, double radius, double angle1, double angle2)
-                       => NativeMethods.cairo_arc_negative (handle, center.X, center.Y, radius, angle1, angle2);
-               public void Rectangle (Rectangle rectangle)
-                       => Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
-               public void Rectangle (RectangleD rectangle)
-                       => Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
-               public void Rectangle (PointD p, double width, double height)
-                       => Rectangle (p.X, p.Y, width, height);
-               public void Rectangle (double x, double y, double width, double height)
-                       => NativeMethods.cairo_rectangle (handle, x, y, width, height);
-               public void ClosePath () => NativeMethods.cairo_close_path (handle);
-               public Path CopyPath () => new Path (NativeMethods.cairo_copy_path (handle));
-               public Path CopyPathFlat () => new Path (NativeMethods.cairo_copy_path_flat (handle));
-               public void AppendPath (Path path) => NativeMethods.cairo_append_path (handle, path.Handle);
-               #endregion
-
-               #region Painting Methods
-               public void Paint () => NativeMethods.cairo_paint (handle);
-               public void PaintWithAlpha (double alpha) => NativeMethods.cairo_paint_with_alpha (handle, alpha);
-               public void Mask (Pattern pattern) => NativeMethods.cairo_mask (handle, pattern.handle);
-               public void MaskSurface (Surface surface, double surface_x, double surface_y)
-                       => NativeMethods.cairo_mask_surface (handle, surface.handle, surface_x, surface_y);
-               public void Stroke () => NativeMethods.cairo_stroke (handle);
-               public void StrokePreserve () => NativeMethods.cairo_stroke_preserve (handle);
-               public Rectangle StrokeExtents ()
-               {
-                       double x1, y1, x2, y2;
-                       NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2);
-                       return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
-               }
-
-               public void Fill () => NativeMethods.cairo_fill (handle);
-               public void FillPreserve () => NativeMethods.cairo_fill_preserve (handle);
-               public Rectangle FillExtents ()
-               {
-                       double x1, y1, x2, y2;
-                       NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2);
-                       return new Rectangle ((int)x1, (int)y1, (int)(x2 - x1), (int)(y2 - y1));
-               }
-
-               #endregion
-
-               public void Clip () => NativeMethods.cairo_clip (handle);
-               public void ClipPreserve () => NativeMethods.cairo_clip_preserve (handle);
-               public void ResetClip () => NativeMethods.cairo_reset_clip (handle);
-               public bool InClip (double x, double y) => NativeMethods.cairo_in_clip (handle, x, y);
-               /*public RectangleList GetClipRectangles (){
-                       return (RectangleList)Marshal.PtrToStructure (NativeMethods.cairo_copy_clip_rectangle_list (handle), typeof(RectangleList));
-               }*/
-               public void ClipExtendRectangle (){
-                       double x1, y1, x2, y2;
-                       NativeMethods.cairo_clip_extents (handle, out x1, out y1, out x2, out y2);
-                       NativeMethods.cairo_rectangle (handle, x1, y1, x2 - x1, y2 - y1);
-               }
-               public bool InStroke (double x, double y) => NativeMethods.cairo_in_stroke (handle, x, y);
-               public bool InFill (double x, double y) => NativeMethods.cairo_in_fill (handle, x, y);
-               public Pattern PopGroup () => Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
-               public void PopGroupToSource () => NativeMethods.cairo_pop_group_to_source (handle);
-               public void PushGroup () => NativeMethods.cairo_push_group (handle);
-               public void PushGroup (Content content) => NativeMethods.cairo_push_group_with_content (handle, content);
-               public Surface GetGroupTarget ()
-               {
-                       IntPtr surface = NativeMethods.cairo_get_group_target (handle);
-                       return Surface.Lookup (surface, false);
-               }
-
-               public void Rotate (double angle) => NativeMethods.cairo_rotate (handle, angle);
-               public void Scale (double sx, double sy) => NativeMethods.cairo_scale (handle, sx, sy);
-               public void Translate (double tx, double ty) => NativeMethods.cairo_translate (handle, tx, ty);
-               public void Transform (Matrix m) => NativeMethods.cairo_transform (handle, m);
-
-               [Obsolete("Use UserToDevice instead")]
-               public void TransformPoint (ref double x, ref double y)
-               {
-                       NativeMethods.cairo_user_to_device (handle, ref x, ref y);
-               }
-
-               [Obsolete("Use UserToDeviceDistance instead")]
-               public void TransformDistance (ref double dx, ref double dy)
-               {
-                       NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
-               }
-
-               [Obsolete("Use InverseTransformPoint instead")]
-               public void InverseTransformPoint (ref double x, ref double y)
-               {
-                       NativeMethods.cairo_device_to_user (handle, ref x, ref y);
-               }
-
-               [Obsolete("Use DeviceToUserDistance instead")]
-               public void InverseTransformDistance (ref double dx, ref double dy)
-               {
-                       NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
-               }
-
-               public void UserToDevice (ref double x, ref double y)
-               {
-                       NativeMethods.cairo_user_to_device (handle, ref x, ref y);
-               }
-
-               public void UserToDeviceDistance (ref double dx, ref double dy)
-               {
-                       NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
-               }
-
-               public void DeviceToUser (ref double x, ref double y)
-               {
-                       NativeMethods.cairo_device_to_user (handle, ref x, ref y);
-               }
-
-               public void DeviceToUserDistance (ref double dx, ref double dy)
-               {
-                       NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
-               }
-
-               public void SetFontSize (double scale)
-               {
-                       NativeMethods.cairo_set_font_size (handle, scale);
-               }
-
-               public void IdentityMatrix () => NativeMethods.cairo_identity_matrix (handle);
-               public Matrix FontMatrix {
-                       get {
-                               Matrix m;
-                               NativeMethods.cairo_get_font_matrix (handle, out m);
-                               return m;
-                       }
-                       set { NativeMethods.cairo_set_font_matrix (handle, value); }
-               }
-
-               public FontOptions FontOptions {
-                       get {
-                               FontOptions options = new FontOptions ();
-                               NativeMethods.cairo_get_font_options (handle, options.Handle);
-                               return options;
-                       }
-                       set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
-               }
-
-               [StructLayout(LayoutKind.Sequential)]
-               internal struct NativeGlyph_4byte_longs {
-                       public int index;
-                       public double x;
-                       public double y;
-
-                       public NativeGlyph_4byte_longs (Glyph source)
-                       {
-                               index = (int) source.index;
-                               x = source.x;
-                               y = source.y;
-                       }
-               }
-
-               static internal IntPtr FromGlyphToUnManagedMemory(Glyph [] glyphs)
-               {
-                       IntPtr dest = Marshal.AllocHGlobal (native_glyph_size * glyphs.Length);
-                       long pos = dest.ToInt64();
-
-                       if (c_compiler_long_size == 8){
-                               foreach (Glyph g in glyphs){
-                                       Marshal.StructureToPtr (g, (IntPtr)pos, false);
-                                       pos += native_glyph_size;
-                               }
-                       } else {
-                               foreach (Glyph g in glyphs){
-                                       NativeGlyph_4byte_longs n = new NativeGlyph_4byte_longs (g);
-
-                                       Marshal.StructureToPtr (n, (IntPtr)pos, false);
-                                       pos += native_glyph_size;
-                               }
-                       }
-
-                       return dest;
-               }
-
-               public void ShowGlyphs (Glyph[] glyphs)
-               {
-                       IntPtr ptr;
-
-                       ptr = FromGlyphToUnManagedMemory (glyphs);
-
-                       NativeMethods.cairo_show_glyphs (handle, ptr, glyphs.Length);
-
-                       Marshal.FreeHGlobal (ptr);
-               }
-
-               [Obsolete("The matrix argument was never used, use ShowGlyphs(Glyphs []) instead")]
-               public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
-               {
-                       ShowGlyphs (glyphs);
-               }
-
-               [Obsolete("The matrix argument was never used, use GlyphPath(Glyphs []) instead")]
-               public void GlyphPath (Matrix matrix, Glyph[] glyphs)
-               {
-                       GlyphPath (glyphs);
-               }
-
-               public void GlyphPath (Glyph[] glyphs)
-               {
-                       IntPtr ptr;
-
-                       ptr = FromGlyphToUnManagedMemory (glyphs);
-
-                       NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
-
-                       Marshal.FreeHGlobal (ptr);
-
-               }
-
-               public FontExtents FontExtents {
-                       get {
-                               FontExtents f_extents;
-                               NativeMethods.cairo_font_extents (handle, out f_extents);
-                               return f_extents;
-                       }
-               }
-
-               public void CopyPage ()
-               {
-                       NativeMethods.cairo_copy_page (handle);
-               }
-
-               public void SetContextFontFace (FontFace value)
-               {
-                       NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
-               }
-
-               public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
-               {
-                       NativeMethods.cairo_select_font_face (handle, family, slant, weight);
-               }
-
-               public void ShowPage ()
-               {
-                       NativeMethods.cairo_show_page (handle);
-               }
-
-               private static byte[] TerminateUtf8(byte[] utf8)
-               {
-                       if (utf8.Length > 0 && utf8[utf8.Length - 1] == 0)
-                               return utf8;
-                       var termedArray = new byte[utf8.Length + 1];
-                       Array.Copy(utf8, termedArray, utf8.Length);
-                       termedArray[utf8.Length] = 0;
-                       return termedArray;
-               }
-
-               private static byte[] TerminateUtf8(string s)
-               {
-                       // compute the byte count including the trailing \0
-                       var byteCount = Encoding.UTF8.GetMaxByteCount(s.Length + 1);
-                       var bytes = new byte[byteCount];
-                       Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
-                       return bytes;
-               }
-
-               public void ShowText(string str)
-                       => NativeMethods.cairo_show_text (handle, TerminateUtf8 (str));
-               public void TextPath(string str)
-                       => NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
-               public void TextPath(byte[] utf8)
-                       => NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
-               public TextExtents TextExtents(string s)
-               {
-                       TextExtents extents;
-                       NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
-                       return extents;
-               }
-               public void ShowText (ReadOnlySpan<char> s, int tabSize) {
-                       int size = s.Length * 4 + 1;
-                       Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
-                       int encodedBytes = s.ToUtf8 (bytes, tabSize);
-                       bytes[encodedBytes] = 0;
-                       ShowText (bytes.Slice (0, encodedBytes + 1));
-               }
-               public TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize) {
-                       TextExtents (s, tabSize, out TextExtents extents);
-                       return extents;
-               }
-               public void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents) {
-                       int size = s.Length * 4 + 1;
-                       Span<byte> bytes = size > 512 ? new byte[size] : stackalloc byte[size];
-                       int encodedBytes = s.ToUtf8 (bytes, tabSize);
-                       bytes[encodedBytes] = 0;
-                       TextExtents (bytes.Slice (0, encodedBytes + 1), out extents);
-               }
-               public void ShowText (Span<byte> bytes) {
-                       NativeMethods.cairo_show_text (handle, ref bytes.GetPinnableReference());
-               }
-               public void TextExtents (Span<byte> bytes, out TextExtents extents) {
-                       NativeMethods.cairo_text_extents (handle, ref bytes.GetPinnableReference (), out extents);
-               }
-
-               public TextExtents GlyphExtents (Glyph[] glyphs)
-               {
-                       IntPtr ptr = FromGlyphToUnManagedMemory (glyphs);
-
-                       TextExtents extents;
-
-                       NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
-
-                       Marshal.FreeHGlobal (ptr);
-
-                       return extents;
-               }
-
-               public void Flush()
-               {
-                       //throw new NotImplementedException();
-               }
-
-               public void Clear()
-               {
-                       throw new NotImplementedException();
-               }
-               public void MoveTo(Point p)
-               {
-                       throw new NotImplementedException();
-               }
-               public void LineTo(Point p)
-               {
-                       throw new NotImplementedException();
-               }
-
-/*             public void Arc(float xc, float yc, float radius, float a1, float a2)
-               {
-                       throw new NotImplementedException();
-               }
-               public void ArcNegative(float xc, float yc, float radius, float a1, float a2)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void MoveTo(float x, float y)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void RelMoveTo(float x, float y)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void LineTo(float x, float y)
-               {
-                       throw new NotImplementedException();
-               }
-               public void RelLineTo(float x, float y)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void CurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void RelCurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void Scale(float sx, float sy)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void Translate(float dx, float dy)
-               {
-                       throw new NotImplementedException();
-               }
-               public void Rotate(float alpha)
-               {
-                       throw new NotImplementedException();
-               }
-               public void SetSource(float r, float g, float b, float a = 1)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetSource(ISurface surf, float x = 0, float y = 0)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetSourceSurface(ISurface surf, float x = 0, float y = 0)
-               {
-                       throw new NotImplementedException();
-               }
-*/
-               public void Translate(PointD p)
-               {
-                       throw new NotImplementedException();
-               }
-               public void RenderSvg(ISvgHandle svg, string subId = null)
-                       => svg.Render (this, subId);
-               Matrix savedMat;
-               public void SaveTransformations()
-                       => NativeMethods.cairo_get_matrix (handle, out savedMat);
-               public void RestoreTransformations()
-                       => NativeMethods.cairo_set_matrix (handle, ref savedMat);
-               public void SetSource(IPattern pat) => NativeMethods.cairo_set_source (handle, (pat as Pattern).handle);
-               public void SetSource(ISurface surf, double x = 0, double y = 0)
-                       => NativeMethods.cairo_set_source_surface (handle, (surf as Surface).handle, x, y);
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/DRMDevice.cs b/Backends/Crow.CairoBackend/src/DRMDevice.cs
deleted file mode 100644 (file)
index 69009fc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.CairoBackend
-{
-       public class DRMDevice : CairoDevice
-       {
-               public DRMDevice () : base (NativeMethods.cairo_drm_device_default (), true)
-               {
-               }
-               public DRMDevice (int fd) : base (NativeMethods.cairo_drm_device_get_for_fd (fd), true)
-               {
-               }
-               public DRMDevice (IntPtr udev_device) : base (NativeMethods.cairo_drm_device_get (udev_device), true)
-               {
-               }
-
-               public int FileDescriptor {
-                       get { return NativeMethods.cairo_drm_device_get_fd (handle); }
-               }
-
-               public void DeviceThrottle () { NativeMethods.cairo_drm_device_throttle (handle);}
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/DRMSurface.cs b/Backends/Crow.CairoBackend/src/DRMSurface.cs
deleted file mode 100644 (file)
index cf57d17..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// Mono.Cairo.GLSurface.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class DRMSurface : Surface
-       {
-
-               public DRMSurface (IntPtr ptr, bool own) : base (ptr, own)
-               {}
-
-               public DRMSurface (DRMDevice device, Format format, int width, int height)
-                       : base (NativeMethods.cairo_drm_surface_create (device.Handle, format, width, height), true)
-               {}
-
-               public DRMSurface (DRMDevice device, uint name, Format format, int width, int height, int stride)
-                       : base (NativeMethods.cairo_drm_surface_create_for_name (device.Handle, name, format, width, height, stride), true)
-               {}
-
-               public DRMSurface (DRMDevice device, IntPtr imageSurface)
-                       : base (NativeMethods.cairo_drm_surface_create_from_cacheable_image (device.Handle, imageSurface), true)
-               {}
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Device.cs b/Backends/Crow.CairoBackend/src/Device.cs
deleted file mode 100644 (file)
index 2efe76e..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using Drawing2D;
-using Glfw;
-
-namespace Crow.CairoBackend
-{
-       public abstract class CairoDevice : Device {
-               protected IntPtr handle = IntPtr.Zero;
-               public IntPtr Handle => handle;
-               protected CairoDevice (IntPtr handle, bool owner = true)
-               {
-                       this.handle = handle;
-                       if (!owner)
-                               NativeMethods.cairo_device_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-               public string Status {
-                       get {
-                return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
-                       }
-               }
-               public Status Acquire()
-               {
-                       return NativeMethods.cairo_device_acquire (handle);
-               }
-               public void Release()
-               {
-                       NativeMethods.cairo_device_release (handle);
-               }
-
-               protected override void Dispose (bool disposing)
-               {
-                       base.Dispose (disposing);
-
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Device> (handle, disposing);
-
-                       if (!disposing || handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_device_destroy (handle);
-
-                       handle = IntPtr.Zero;
-               }
-       }
-       public class Device : IDevice
-       {
-
-               public Device()
-               {
-               }
-
-               ~Device ()
-               {
-                       Dispose (false);
-               }
-
-               #region IDevice implementation
-               public void GetDpy(out int hdpy, out int vdpy)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetDpy(int hdpy, int vdpy)
-               {
-                       throw new NotImplementedException();
-               }
-
-
-
-
-
-
-               #endregion
-
-               #region IDispose implementation
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (disposing){
-                               
-                       }
-                               
-               }
-               #endregion
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/DirectFBSurface.cs b/Backends/Crow.CairoBackend/src/DirectFBSurface.cs
deleted file mode 100644 (file)
index ca7cd71..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Mono.Cairo.DirectFBSurface.cs
-//
-// Authors:
-//    Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-       public class DirectFBSurface : Surface
-       {
-               internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
-                       : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
-               {
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Distance.cs b/Backends/Crow.CairoBackend/src/Distance.cs
deleted file mode 100644 (file)
index 160fa1e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-//   Duncan Mak (duncan@ximian.com)
-//   Miguel de Icaza (miguel@novell.com)
-//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//   Alp Toker (alp@atoker.com)
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace Crow.CairoBackend {
-
-       public struct Distance
-       {
-               public Distance (double dx, double dy)
-               {
-                       this.dx = dx;
-                       this.dy = dy;
-               }
-
-               double dx, dy;
-               public double Dx {
-                       get { return dx; }
-                       set { dx = value; }
-               }
-
-               public double Dy {
-                       get { return dy; }
-                       set { dy = value; }
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/EGLDevice.cs b/Backends/Crow.CairoBackend/src/EGLDevice.cs
deleted file mode 100644 (file)
index ef3d554..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.CairoBackend
-{
-       public class EGLDevice : GLDevice
-       {
-               public EGLDevice (IntPtr dpy, IntPtr gl_ctx, bool threadAwayre = false)
-                       : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
-               {
-                       SetThreadAware(threadAwayre);
-               }
-               /*public override ISurface CreateSurface (IntPtr nativeWindoPointer, int width, int height) {
-                       return new GLSurface (this, Glfw.Glfw3.GetEGLSurface (nativeWindoPointer), width, height);
-               }*/
-
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/EglBackend.cs b/Backends/Crow.CairoBackend/src/EglBackend.cs
deleted file mode 100644 (file)
index 909c3cd..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-using System;
-using System.IO;
-using Drawing2D;
-using Glfw;
-
-namespace Crow.CairoBackend
-{
-       public class EglBackend : CairoBackendBase {
-               EGLDevice device;
-               /// <summary>
-               /// Create a new generic backend bound to the application surface
-               /// </summary>
-               /// <param name="width">backend surface width</param>
-               /// <param name="height">backend surface height</param>
-               public EglBackend (int width, int height, IntPtr nativeWindoPointer)
-               : base (width, height, nativeWindoPointer) {
-                       if (nativeWindoPointer == IntPtr.Zero) {
-                               Glfw3.Init ();
-                               Glfw3.WindowHint (WindowAttribute.ClientApi, Constants.OpenglEsApi);
-                               Glfw3.WindowHint (WindowAttribute.ContextVersionMajor, 3);
-                               Glfw3.WindowHint (WindowAttribute.ContextVersionMinor, 2);
-                               Glfw3.WindowHint (WindowAttribute.ContextCreationApi, Constants.EglContextApi);
-                               Glfw3.WindowHint (WindowAttribute.Resizable, 1);
-                               Glfw3.WindowHint (WindowAttribute.Decorated, 1);
-
-                               hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero);
-                               if (hWin == IntPtr.Zero)
-                                       throw new Exception ("[GLFW3] Unable to create Window");
-                       }
-
-                       Glfw3.MakeContextCurrent (hWin);
-                       Glfw3.SwapInterval (0);
-
-                       device = new EGLDevice (Glfw3.GetEGLDisplay (), Glfw3.GetEGLContext (hWin));
-                       surf = new GLSurface (device, Glfw3.GetEGLSurface (hWin), width, height);
-               }
-               /// <summary>
-               /// Create a new offscreen backend, used in perfTests
-               /// </summary>
-               /// <param name="width">backend surface width</param>
-               /// <param name="height">backend surface height</param>
-               public EglBackend (int width, int height)
-               : base (width, height, IntPtr.Zero) {
-                       device = new EGLDevice (Glfw3.GetEGLDisplay (), IntPtr.Zero);
-                       surf = new GLTextureSurface (device, width, height);
-               }
-               public override ISurface CreateSurface(int width, int height)
-                       //=> new GLTextureSurface (device, width, height);
-                       => new ImageSurface (Format.ARGB32, width, height);
-               public override ISurface CreateSurface(byte[] data, int width, int height)
-                       => new ImageSurface (data, Format.ARGB32, width, height, 4 * width);
-               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
-               {
-                       Glfw3.MakeContextCurrent (hWin);
-
-                       IContext ctx = base.PrepareUIFrame (existingContext, clipping);
-
-                       clear (ctx);
-
-                       return ctx;
-               }
-               public override void FlushUIFrame(IContext ctx)
-               {
-                       base.FlushUIFrame (ctx);
-
-                       (surf as GLSurface).SwapBuffers ();
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/FontFace.cs b/Backends/Crow.CairoBackend/src/FontFace.cs
deleted file mode 100644 (file)
index 5b97dc2..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// Mono.Cairo.FontFace.cs
-//
-// Author:
-//   Alp Toker (alp@atoker.com)
-//   Miguel de Icaza (miguel@novell.com)
-//
-// (C) Ximian Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.CairoBackend
-{
-       public class FontFace : IDisposable
-       {
-               IntPtr handle;
-
-               internal static FontFace Lookup (IntPtr handle, bool owner)
-               {
-                       if (handle == IntPtr.Zero)
-                               return null;
-                       return new FontFace (handle, owner);
-               }
-
-               ~FontFace ()
-               {
-                       Dispose (false);
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<FontFace> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_font_face_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-
-               [Obsolete]
-               public FontFace (IntPtr handle) : this (handle, true)
-               {
-               }
-
-               public FontFace (IntPtr handle, bool owned)
-               {
-                       this.handle = handle;
-                       if (!owned)
-                               NativeMethods.cairo_font_face_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               public IntPtr Handle {
-                       get {
-                               return handle;
-                       }
-               }
-
-               public Status Status {
-                       get {
-                               return NativeMethods.cairo_font_face_status (handle);
-                       }
-               }
-               
-               public FontType FontType {
-                       get {
-                               return NativeMethods.cairo_font_face_get_type (handle);
-                       }
-               }
-
-               public uint ReferenceCount {
-                       get { return NativeMethods.cairo_font_face_get_reference_count (handle); }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/FontOptions.cs b/Backends/Crow.CairoBackend/src/FontOptions.cs
deleted file mode 100644 (file)
index ee952bb..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// Mono.Cairo.FontOptions.cs
-//
-// Author:
-//   John Luke (john.luke@gmail.com)
-//
-// (C) John Luke 2005.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       public class FontOptions : IDisposable
-       {
-               IntPtr handle;
-
-               public FontOptions () : this (NativeMethods.cairo_font_options_create ())
-               {
-               }
-
-               ~FontOptions ()
-               {
-                       Dispose (false);
-               }
-
-               internal FontOptions (IntPtr handle)
-               {
-                       this.handle = handle;
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               public FontOptions Copy ()
-               {
-                       return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
-               }
-
-               [Obsolete ("Use Dispose()")]
-               public void Destroy ()
-               {
-                       Dispose ();
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<FontOptions> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_font_options_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-
-               public static bool operator == (FontOptions options, FontOptions other)
-               {
-                       return Equals (options, other);
-               }
-
-               public static bool operator != (FontOptions options, FontOptions other)
-               {
-                       return !(options == other);
-               }
-
-               public override bool Equals (object other)
-               {
-                       return Equals (other as FontOptions);
-               }
-
-               bool Equals (FontOptions options)
-               {
-                       return options != null && NativeMethods.cairo_font_options_equal (Handle, options.Handle);
-               }
-
-               public IntPtr Handle {
-                       get { return handle; }
-               }
-
-               public override int GetHashCode ()
-               {
-                       return (int) NativeMethods.cairo_font_options_hash (handle);
-               }
-
-               public void Merge (FontOptions other)
-               {
-                       if (other == null)
-                               throw new ArgumentNullException ("other");
-                       NativeMethods.cairo_font_options_merge (handle, other.Handle);
-               }
-
-               public Antialias Antialias {
-                       get { return NativeMethods.cairo_font_options_get_antialias (handle); }
-                       set { NativeMethods.cairo_font_options_set_antialias (handle, value); }
-               }
-
-               public HintMetrics HintMetrics {
-                       get { return NativeMethods.cairo_font_options_get_hint_metrics (handle);}
-                       set { NativeMethods.cairo_font_options_set_hint_metrics (handle, value); }
-               }
-
-               public HintStyle HintStyle {
-                       get { return NativeMethods.cairo_font_options_get_hint_style (handle);}
-                       set { NativeMethods.cairo_font_options_set_hint_style (handle, value); }
-               }
-
-               public Status Status {
-                       get { return NativeMethods.cairo_font_options_status (handle); }
-               }
-
-               public SubpixelOrder SubpixelOrder {
-                       get { return NativeMethods.cairo_font_options_get_subpixel_order (handle);}
-                       set { NativeMethods.cairo_font_options_set_subpixel_order (handle, value); }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/FontType.cs b/Backends/Crow.CairoBackend/src/FontType.cs
deleted file mode 100644 (file)
index 664c2f5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Mono.Cairo.FontType.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public enum FontType
-       {
-               Toy,
-               FreeType,
-               Win32,
-               Atsui,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/GLDevice.cs b/Backends/Crow.CairoBackend/src/GLDevice.cs
deleted file mode 100644 (file)
index 3c90592..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 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 Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       public abstract class GLDevice : CairoDevice
-       {
-               protected GLDevice (IntPtr handle, bool owner = true) : base (handle, owner) {}
-               public void SetThreadAware (bool value) {
-                       NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
-               }
-
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/GLSurface.cs b/Backends/Crow.CairoBackend/src/GLSurface.cs
deleted file mode 100644 (file)
index 4fa262c..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Mono.Cairo.GLSurface.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using OpenGL;
-using static OpenGL.Gl;
-
-namespace Crow.CairoBackend {
-
-       public class GLTextureSurface : Surface
-       {
-               uint texId;
-               internal GLTextureSurface (CairoDevice device, int width, int height)
-                       : base ()
-               {
-                       texId = GenTexture ();
-                       BindTexture (TextureTarget.Texture2d, texId);
-                       TexImage2D (TextureTarget.Texture2d, 0, InternalFormat.Rgb, width, height,
-                               0, PixelFormat.Rgb, PixelType.UnsignedByte, 0);
-                       TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, NEAREST);
-                       TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, NEAREST);
-
-                       handle = NativeMethods.cairo_gl_surface_create_for_texture (device.Handle,
-                               (uint)Content.ColorAlpha, texId, width, height);
-               }
-               protected override void Dispose (bool disposing)
-               {
-                       if (disposing && handle != IntPtr.Zero)
-                               OpenGL.Gl.DeleteTextures (texId);
-                       base.Dispose (disposing);
-               }
-
-       }
-       public class GLSurface : Surface
-       {
-               public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
-               {}
-
-               public GLSurface (CairoDevice 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)
-               {}
-
-               public GLSurface (EGLDevice device, IntPtr eglSurf, int width, int height)
-                       : base (NativeMethods.cairo_gl_surface_create_for_egl (device.Handle, eglSurf, width, height), true)
-               {}
-
-               public GLSurface (GLXDevice device, IntPtr window, int width, int height)
-                       : base (NativeMethods.cairo_gl_surface_create_for_window (device.Handle, window, width, height),true)
-               {}
-
-               public GLSurface (WGLDevice device, IntPtr hdc, int width, int height)
-                       : base (NativeMethods.cairo_gl_surface_create_for_dc (device.Handle, hdc, width, height), true)
-               {}
-               public override void Flush ()
-               {
-                       //base.Flush ();
-                       SwapBuffers ();
-               }
-               public override int Width => NativeMethods.cairo_gl_surface_get_width (handle);
-               public override int Height => NativeMethods.cairo_gl_surface_get_height (handle);
-               public override void Resize(int width, int height)
-                       => NativeMethods.cairo_gl_surface_set_size(handle, width, height);
-
-               public void SwapBuffers(){
-                       NativeMethods.cairo_gl_surface_swapbuffers (this.handle);
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/GLXDevice.cs b/Backends/Crow.CairoBackend/src/GLXDevice.cs
deleted file mode 100644 (file)
index 4a788c9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.CairoBackend
-{
-       public class GLXDevice : CairoDevice
-       {
-               public GLXDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_glx_device_create (dpy, gl_ctx), true)
-               {
-               }
-
-               public IntPtr Display {
-                       get { return NativeMethods.cairo_glx_device_get_display (handle); }
-               }
-
-               public IntPtr Context {
-                       get { return NativeMethods.cairo_glx_device_get_context (handle); }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/GlitzSurface.cs b/Backends/Crow.CairoBackend/src/GlitzSurface.cs
deleted file mode 100644 (file)
index 4497877..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Mono.Cairo.GlitzSurface.cs
-//
-// Authors:
-//    Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-       public class GlitzSurface : Surface
-       {
-               internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public GlitzSurface (IntPtr glitz_surface)
-                       : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
-               {
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Glyph.cs b/Backends/Crow.CairoBackend/src/Glyph.cs
deleted file mode 100644 (file)
index fdd8436..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Mono.Cairo.Glyph.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.CairoBackend
-{
-       [StructLayout(LayoutKind.Sequential)]
-       public struct Glyph
-       {
-               internal long index;
-               internal double x;
-               internal double y;
-               
-               public Glyph (long index, double x, double y)
-               {
-                       this.index = index;
-                       this.x = x;
-                       this.y = y;
-               }
-               
-               public long Index {
-                       get { return index; }
-                       set { index = value; }
-               }
-               
-               public double X {
-                       get { return x; }
-                       set { x = value; }
-               }
-               
-               public double Y {
-                       get { return y; }
-                       set { y = value; }
-               }
-
-               public override bool Equals (object obj)
-               {
-                       if (obj is Glyph)
-                               return this == (Glyph)obj;
-                       return false;
-               }
-
-               public override int GetHashCode ()
-               {
-                       return (int) Index ^ (int) X ^ (int) Y;
-               }
-
-               internal static IntPtr GlyphsToIntPtr (Glyph[] glyphs)
-               {
-                       int size = Marshal.SizeOf (glyphs[0]);
-                       IntPtr dest = Marshal.AllocHGlobal (size * glyphs.Length);
-                       long pos = dest.ToInt64 ();
-                       for (int i = 0; i < glyphs.Length; i++, pos += size)
-                               Marshal.StructureToPtr (glyphs[i], (IntPtr) pos, false);
-                       return dest;
-               }
-
-               public static bool operator == (Glyph glyph, Glyph other)
-               {
-                       return glyph.Index == other.Index && glyph.X == other.X && glyph.Y == other.Y;
-               }
-
-               public static bool operator != (Glyph glyph, Glyph other)
-               {
-                       return !(glyph == other);
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Gradient.cs b/Backends/Crow.CairoBackend/src/Gradient.cs
deleted file mode 100644 (file)
index 74ac7d4..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Mono.Cairo.Gradient.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class Gradient : Pattern, IGradient
-       {
-               protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public int ColorStopCount {
-                       get {
-                               int cnt;
-                               NativeMethods.cairo_pattern_get_color_stop_count (handle, out cnt);
-                               return cnt;
-                       }
-               }
-               #region IGradient implementation
-               public void AddColorStop (double offset, Color c)
-                       => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0);
-               public void AddColorStop(float offset, float r, float g, float b, float a = 1)
-                       => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, r, g, b, a);
-               #endregion
-
-               public Status AddColorStopRgb (double offset, Color c)
-               {
-                       NativeMethods.cairo_pattern_add_color_stop_rgb (handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0);
-                       return Status;
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/HintMetrics.cs b/Backends/Crow.CairoBackend/src/HintMetrics.cs
deleted file mode 100644 (file)
index 8f4f95c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Mono.Cairo.HintMetrics.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       
-       public enum HintMetrics
-       {
-               Default,
-               Off,
-               On,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/HintStyle.cs b/Backends/Crow.CairoBackend/src/HintStyle.cs
deleted file mode 100644 (file)
index 6616174..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Mono.Cairo.HintStyle.cs
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       
-       public enum HintStyle
-       {
-               Default,
-               None,
-               Slight,
-               Medium,
-               Full,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/ImageBackend.cs b/Backends/Crow.CairoBackend/src/ImageBackend.cs
deleted file mode 100644 (file)
index 96899db..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.IO;
-using Drawing2D;
-using Glfw;
-
-namespace Crow.CairoBackend
-{
-       public class DefaultBackend : CairoBackendBase {
-               /// <summary>
-               /// Create a new generic backend bound to the application surface
-               /// </summary>
-               /// <param name="width">backend surface width</param>
-               /// <param name="height">backend surface height</param>
-               /// <param name="nativeWindoPointer"></param>
-               public DefaultBackend (int width, int height, IntPtr nativeWindoPointer)
-               : base (width, height, nativeWindoPointer) {
-                       if (nativeWindoPointer == IntPtr.Zero) {
-                               Glfw3.Init ();
-                               Glfw3.WindowHint (WindowAttribute.ClientApi, 0);
-                               Glfw3.WindowHint (WindowAttribute.Resizable, 1);
-                               Glfw3.WindowHint (WindowAttribute.Decorated, 1);
-
-                               hWin = Glfw3.CreateWindow (width, height, "win name", MonitorHandle.Zero, IntPtr.Zero);
-                               if (hWin == IntPtr.Zero)
-                                       throw new Exception ("[GLFW3] Unable to create Window");
-                       }
-                       switch (Environment.OSVersion.Platform) {
-                       case PlatformID.Unix:
-                               IntPtr disp = Glfw3.GetX11Display ();
-                               IntPtr nativeWin = Glfw3.GetX11Window (hWin);
-                               Int32 scr = Glfw3.GetX11DefaultScreen (disp);
-                               IntPtr visual = Glfw3.GetX11DefaultVisual (disp, scr);
-                               surf = new XlibSurface (disp, nativeWin, visual, width, height);
-                               break;
-                       case PlatformID.Win32NT:
-                       case PlatformID.Win32S:
-                       case PlatformID.Win32Windows:
-                               IntPtr hWin32 = Glfw3.GetWin32Window (hWin);
-                               IntPtr hdc = Glfw3.GetWin32DC (hWin32);
-                               surf = new Win32Surface (hdc);
-                               break;
-                       default:
-                               throw new PlatformNotSupportedException ("Unable to create cairo image backend.");
-                       }
-               }
-               /// <summary>
-               /// Create a new offscreen backend, used in perfTests
-               /// </summary>
-               /// <param name="width">backend surface width</param>
-               /// <param name="height">backend surface height</param>
-               public DefaultBackend (int width, int height)
-               : base (width, height, IntPtr.Zero) {
-                       surf = new ImageSurface (Format.ARGB32, width, height);
-               }
-               public DefaultBackend (IntPtr surfaceBitmapData, int width, int height, int stride)
-                : base (width, height, IntPtr.Zero) {
-                       surf = new ImageSurface (surfaceBitmapData, Format.ARGB32, width, height, stride);
-               }
-
-               public override ISurface CreateSurface(int width, int height)
-                       => new ImageSurface (Format.ARGB32, width, height);
-               public override ISurface CreateSurface(byte[] data, int width, int height)
-                       => new ImageSurface (data, Format.ARGB32, width, height, 4 * width);
-               public override IContext PrepareUIFrame(IContext existingContext, IRegion clipping)
-               {
-                       IContext ctx = base.PrepareUIFrame (existingContext, clipping);
-
-                       clear (ctx);
-                       ctx.PushGroup ();
-
-                       return ctx;
-               }
-               public override void FlushUIFrame(IContext ctx)
-               {
-                       ctx.PopGroupToSource ();
-                       ctx.Paint ();
-
-                       surf.Flush ();
-
-                       base.FlushUIFrame (ctx);
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/ImageSurface.cs b/Backends/Crow.CairoBackend/src/ImageSurface.cs
deleted file mode 100644 (file)
index 2cfec61..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// Mono.Cairo.ImageSurface.cs
-//
-// Authors:
-//    Duncan Mak
-//    Miguel de Icaza.
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class ImageSurface : Surface
-       {
-               internal ImageSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public ImageSurface (Format format, int width, int height)
-                       : base (NativeMethods.cairo_image_surface_create (format, width, height), true)
-               {
-               }
-
-               [Obsolete ("Use ImageSurface (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)
-               {
-               }
-
-               public ImageSurface (byte[] data, Format format, int width, int height, int stride)
-                       : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
-               {
-               }
-
-               public ImageSurface (IntPtr data, Format format, int width, int height, int stride)
-                       : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
-               {
-               }
-
-               public ImageSurface (string filename)
-                       : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
-               {
-               }
-
-               public override int Width => NativeMethods.cairo_image_surface_get_width (handle);
-               public override int Height => NativeMethods.cairo_image_surface_get_height (handle);
-
-               public byte[] Data {
-                       get {
-                               IntPtr ptr = NativeMethods.cairo_image_surface_get_data (handle);
-                               int length = Height * Stride;
-                               byte[] data = new byte[length];
-                               Marshal.Copy (ptr, data, 0, length);
-                               return data;
-                       }
-               }
-
-               public IntPtr DataPtr {
-                       get {
-                               return NativeMethods.cairo_image_surface_get_data (handle);
-                       }
-               }
-
-               public Format Format {
-                       get { return NativeMethods.cairo_image_surface_get_format (handle); }
-               }
-
-               public int Stride {
-                       get { return NativeMethods.cairo_image_surface_get_stride (handle); }
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/LinearGradient.cs b/Backends/Crow.CairoBackend/src/LinearGradient.cs
deleted file mode 100644 (file)
index 49e423e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Mono.Cairo.LinearGradient.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class LinearGradient : Gradient
-       {
-               internal LinearGradient (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public LinearGradient (double x0, double y0, double x1, double y1)
-                       : base (NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1), true)
-               {
-               }
-
-               public PointD[] LinearPoints {
-                       get {
-                               double x0, y0, x1, y1;
-                               PointD[] points = new PointD [2];
-
-                               NativeMethods.cairo_pattern_get_linear_points (handle, out x0, out y0, out x1, out y1);
-
-                               points[0] = new PointD (x0, y0);
-                               points[1] = new PointD (x1, y1);
-                               return points;
-                       }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/Matrix.cs b/Backends/Crow.CairoBackend/src/Matrix.cs
deleted file mode 100644 (file)
index b565edc..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// Mono.Cairo.Matrix.cs
-//
-// Author: Duncan Mak
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//         Idan Gazit (idan@fastmail.fm)
-//
-// (C) Ximian Inc, 2003 - 2005.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Crow.CairoBackend {
-
-       [StructLayout(LayoutKind.Sequential)]
-       public struct Matrix //: ICloneable
-       {
-               public double Xx;
-               public double Yx;
-               public double Xy;
-               public double Yy;
-               public double X0;
-               public double Y0;
-
-               public Matrix (double xx, double yx, double xy, double yy,
-                               double x0, double y0)
-               {
-                       this.Xx = xx; this.Yx = yx; this.Xy = xy;
-                       this.Yy = yy; this.X0 = x0; this.Y0 = y0;
-               }
-               public bool IsIdentity ()
-               {
-                       return (this == new Matrix ());
-               }
-
-               public void InitIdentity ()
-               {
-                       // this.Init(1,0,0,1,0,0);
-                       NativeMethods.cairo_matrix_init_identity (this);
-               }
-
-               public void Init (double xx, double yx, double xy, double yy,
-                                 double x0, double y0)
-               {
-                       this.Xx = xx; this.Yx = yx; this.Xy = xy;
-                       this.Yy = yy; this.X0 = x0; this.Y0 = y0;
-               }
-
-               public void InitTranslate (double tx, double ty)
-               {
-                       //this.Init (1, 0, 0, 1, tx, ty);
-                       NativeMethods.cairo_matrix_init_translate (this, tx, ty);
-               }
-
-               public void Translate (double tx, double ty)
-               {
-                       NativeMethods.cairo_matrix_translate (this, tx, ty);
-               }
-
-               public void InitScale (double sx, double sy)
-               {
-                       //this.Init (sx, 0, 0, sy, 0, 0);
-                       NativeMethods.cairo_matrix_init_scale (this, sx, sy);
-               }
-
-               public void Scale (double sx, double sy)
-               {
-                       NativeMethods.cairo_matrix_scale (this, sx, sy);
-               }
-
-               public void InitRotate (double radians)
-               {
-                       /*
-                       double s, c;
-                       s = Math.Sin (radians);
-                       c = Math.Cos (radians);
-                       this.Init (c, s, -s, c, 0, 0);
-                       */
-                       NativeMethods.cairo_matrix_init_rotate (this, radians);
-               }
-
-               public void Rotate (double radians)
-               {
-                       NativeMethods.cairo_matrix_rotate (this, radians);
-               }
-
-               public Status Invert ()
-               {
-                       return NativeMethods.cairo_matrix_invert (this);
-               }
-
-               public void Multiply (Matrix b)
-               {
-                       Matrix a = (Matrix) this.Clone ();
-                       NativeMethods.cairo_matrix_multiply (this, a, b);
-               }
-
-               public static Matrix Multiply (Matrix a, Matrix b) {
-                       Matrix result = new Matrix ();
-                       NativeMethods.cairo_matrix_multiply (result, a, b);
-                       return result;
-               }
-
-
-               public void TransformDistance (ref double dx, ref double dy)
-               {
-                       NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
-               }
-
-               public void TransformPoint (ref double x, ref double y)
-               {
-                       NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
-               }
-
-               public override String ToString ()
-               {
-                       String s = String.Format ("xx:{0:##0.0#} yx:{1:##0.0#} xy:{2:##0.0#} yy:{3:##0.0#} x0:{4:##0.0#} y0:{5:##0.0#}",
-                               this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
-                       return s;
-               }
-
-               public static bool operator == (Matrix lhs, Matrix rhs)
-               {
-                       return (lhs.Xx == rhs.Xx &&
-                               lhs.Xy == rhs.Xy &&
-                               lhs.Yx == rhs.Yx &&
-                               lhs.Yy == rhs.Yy &&
-                               lhs.X0 == rhs.X0 &&
-                               lhs.Y0 == rhs.Y0 );
-               }
-
-               public static bool operator != (Matrix lhs, Matrix rhs)
-               {
-                       return !(lhs==rhs);
-               }
-
-
-
-               public override bool Equals(object o)
-               {
-                       if (! (o is Matrix))
-                               return false;
-                       else
-                               return (this == (Matrix) o);
-               }
-
-               public override int GetHashCode()
-               {
-                       return  (int)this.Xx ^ (int)this.Xx>>32 ^
-                               (int)this.Xy ^ (int)this.Xy>>32 ^
-                               (int)this.Yx ^ (int)this.Yx>>32 ^
-                               (int)this.Yy ^ (int)this.Yy>>32 ^
-                               (int)this.X0 ^ (int)this.X0>>32 ^
-                               (int)this.Y0 ^ (int)this.Y0>>32;
-               }
-
-               public object Clone()
-               {
-                       return this.MemberwiseClone ();
-               }
-
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/MeshPattern.cs b/Backends/Crow.CairoBackend/src/MeshPattern.cs
deleted file mode 100644 (file)
index 39fdd2a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class MeshPattern : Pattern
-       {
-               internal MeshPattern (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public MeshPattern ()
-                       : base (NativeMethods.cairo_pattern_create_mesh(), true)
-               {
-               }
-
-               //no idea why this is here, the base one is identical, but we can't remove it now
-               public new Extend Extend {
-                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
-                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
-               }
-
-               public Filter Filter {
-                       set { NativeMethods.cairo_pattern_set_filter (handle, value); }
-                       get { return NativeMethods.cairo_pattern_get_filter (handle); }
-               }
-
-               public void BeginPatch(){
-                       NativeMethods.cairo_mesh_pattern_begin_patch (handle);
-               }
-               public void EndPatch(){
-                       NativeMethods.cairo_mesh_pattern_end_patch (handle);
-               }
-               public void MoveTo(double x, double y){
-                       NativeMethods.cairo_mesh_pattern_move_to (handle, x, y);
-               }
-               public void MoveTo (PointD p) {
-                       NativeMethods.cairo_mesh_pattern_move_to (handle, p.X, p.Y);
-               }
-               public void LineTo(double x, double y){
-                       NativeMethods.cairo_mesh_pattern_line_to (handle, x, y);
-               }
-               public void LineTo (PointD p) {
-                       NativeMethods.cairo_mesh_pattern_line_to (handle, p.X, p.Y);
-               }
-               public void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
-               {
-                       NativeMethods.cairo_mesh_pattern_curve_to (handle, x1, y1, x2, y2, x3, y3);
-               }
-               public void SetControlPoint(uint point_num, double x, double y){
-                       NativeMethods.cairo_mesh_pattern_set_control_point (handle, point_num, x, y);
-               }
-               public void SetControlPoint (uint point_num, PointD p) {
-                       NativeMethods.cairo_mesh_pattern_set_control_point (handle, point_num, p.X, p.Y);
-               }
-               public void SetCornerColorRGB(uint corner_num, double r, double g, double b){
-                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgb (handle, corner_num, r, g, b);
-               }
-               public void SetCornerColorRGBA(uint corner_num, double r, double g, double b, double a){
-                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (handle, corner_num, r, g, b, a);
-               }
-               public void SetCornerColor (uint corner_num, Color c) {
-                       NativeMethods.cairo_mesh_pattern_set_corner_color_rgba (handle, corner_num, c.R, c.G, c.B, c.A);
-               }
-               public uint PatchCount {
-                       get {
-                               uint count = 0;
-                               NativeMethods.cairo_mesh_pattern_get_patch_count(handle, out count);
-                               return count;
-                       }       
-               }
-               public Path GetPath(uint patch_num){
-                       return new Path(NativeMethods.cairo_mesh_pattern_get_path(handle, patch_num));
-               }
-               public PointD GetControlPoint(uint point_num, uint patch_num = 0) {
-                       NativeMethods.cairo_mesh_pattern_get_control_point (handle, patch_num, point_num, out double x, out double y);
-                       return new PointD (x, y);
-               }
-               public void GetCornerColorRGBA(){
-                       
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/NativeMethods-internal.cs b/Backends/Crow.CairoBackend/src/NativeMethods-internal.cs
deleted file mode 100644 (file)
index 714ff63..0000000
+++ /dev/null
@@ -1,1027 +0,0 @@
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//          John Luke (john.luke@gmail.com)
-//          Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       // sort the functions like in the following page so it is easier to find what is missing
-       // http://cairographics.org/manual/index-all.html
-
-       public static class NativeMethods
-       {
-               #if MONOTOUCH
-               const string cairo = "__Internal";
-               #else
-               const string cairo = "libcairo-2.dll";
-               #endif
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern void cairo_append_path (IntPtr cr, Path path);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
-               //              [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //              public static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_clip (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_clip_preserve (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_close_path (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_copy_page (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_copy_path (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_copy_path_flat (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_create (IntPtr target);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_debug_reset_static_data ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_destroy (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_fill (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_fill_preserve (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
-
-               #region FontFace
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_face_destroy (IntPtr font_face);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern FontType cairo_font_face_get_type (IntPtr font_face);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern void cairo_font_face_get_user_data (IntPtr font_face);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern void cairo_font_face_set_user_data (IntPtr font_face);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_font_face_reference (IntPtr font_face);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_font_face_status (IntPtr font_face);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern uint cairo_font_face_get_reference_count (IntPtr surface);
-               #endregion
-
-               #region FontOptions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_font_options_copy (IntPtr original);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_font_options_create ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_destroy (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Antialias cairo_font_options_get_antialias (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern long cairo_font_options_hash (IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_font_options_status (IntPtr options);
-               #endregion
-
-               #region Freetype / FontConfig
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Antialias cairo_get_antialias (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern FillRule cairo_get_fill_rule (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_get_font_face (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_get_group_target (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern LineCap cairo_get_line_cap (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern LineJoin cairo_get_line_join (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern double cairo_get_line_width (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_get_matrix (IntPtr cr, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern double cairo_get_miter_limit (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Operator cairo_get_operator (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern uint cairo_get_reference_count (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_get_source (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_get_target (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern double cairo_get_tolerance (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               [return: MarshalAs (UnmanagedType.U1)]
-               public static extern bool cairo_has_current_point (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_identity_matrix (IntPtr cr);
-
-               #region Image Surface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               public static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_image_surface_create_from_png  (string filename);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern IntPtr cairo_image_surface_create_from_png_stream  (string filename);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Format cairo_image_surface_get_format (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_image_surface_get_height (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_image_surface_get_stride (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_image_surface_get_width  (IntPtr surface);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               [return: MarshalAs (UnmanagedType.U1)]
-               public static extern bool cairo_in_clip (IntPtr cr, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               [return: MarshalAs (UnmanagedType.U1)]
-               public static extern bool cairo_in_fill (IntPtr cr, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               [return: MarshalAs (UnmanagedType.U1)]
-               public static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_line_to (IntPtr cr, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_mask (IntPtr cr, IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
-
-               #region Matrix
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_init_identity (Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_matrix_invert (Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_rotate (Matrix matrix, double radians);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_move_to (IntPtr cr, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_new_path (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_new_sub_path (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_paint (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_path_destroy (IntPtr path);
-
-               #region Pattern
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_destroy (IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Extend cairo_pattern_get_extend (IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Filter cairo_pattern_get_filter (IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern PatternType cairo_pattern_get_type (IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pattern_reference (IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_pattern_status (IntPtr pattern);
-               #endregion
-
-               #region PdfSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
-               #endregion
-
-               #region PostscriptSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_pop_group (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_pop_group_to_source (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_push_group (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_push_group_with_content (IntPtr cr, Content content);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_reference (IntPtr cr);
-
-               #region Regions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_region_copy (IntPtr original);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_region_create ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_region_create_rectangle (ref Crow.Rectangle rect);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_region_create_rectangles (IntPtr rects, int count);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_region_destroy (IntPtr region);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern bool cairo_region_equal (IntPtr a, IntPtr b);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_region_get_extents (IntPtr region, out Crow.Rectangle extents);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern bool cairo_region_is_empty (IntPtr region);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_region_num_rectangles (IntPtr region);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_region_reference (IntPtr region);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_status (IntPtr region);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_region_translate (IntPtr region, int dx, int dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_union (IntPtr dst, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_union_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_reset_clip (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_restore (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rotate (IntPtr cr, double angle);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_save (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_scale (IntPtr cr, double sx, double sy);
-
-               #region ScaledFont
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_scaled_font_status (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_get_scaled_font (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               public static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               public static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_get_dash_count (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               public static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_font_size (IntPtr cr, double size);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_line_width (IntPtr cr, double width);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_matrix (IntPtr cr, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_miter_limit (IntPtr cr, double limit);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_show_page (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_show_text (IntPtr cr, string str);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_status (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_status_to_string (Status status);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_stroke (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_stroke_preserve (IntPtr cr);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
-
-               #region Surface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_surface_create_similar (IntPtr surface, Cairo.Content content, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_destroy (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_finish (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_flush (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Content cairo_surface_get_content (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern SurfaceType cairo_surface_get_type (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_mark_dirty (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_surface_reference (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_surface_status (IntPtr surface);
-               #endregion
-
-               #region SVG surface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
-
-               //[MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               //public static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_text_extents (IntPtr cr, string txt, out TextExtents extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               public static extern void cairo_text_path (IntPtr ct, byte[] utf8);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_transform (IntPtr cr, Matrix matrix);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_translate (IntPtr cr, double tx, double ty);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_version ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_version_string ();
-
-               #region DirectFBSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
-               #endregion
-
-               #region win32 fonts
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
-               #endregion
-
-               #region win32 surface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
-               #endregion
-
-               #region XcbSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
-               #endregion
-
-               #region XlibSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_xlib_surface_get_depth (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_xlib_surface_get_height (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_xlib_surface_get_width (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
-               #endregion
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
-
-               #region GLSurface
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_gl_surface_get_width (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_gl_surface_get_height (IntPtr surface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
-               #endregion
-
-               #region GLX Functions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_glx_device_get_display (IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_glx_device_get_context (IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
-               #endregion
-
-               #region WGL Fucntions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
-               #endregion
-
-               #region EGL Functions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
-               #endregion
-
-               #region DRM Functions
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_device_get_for_fd (int fd);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_device_default ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern  void cairo_drm_device_throttle (IntPtr cairo_device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format,       int width, int height);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format,   int width, int height, int stride);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void       cairo_drm_surface_unmap (IntPtr drmSurface,     IntPtr imageSurface);
-               #endregion
-
-               #region Device
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_device_acquire(IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_device_destroy (IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern IntPtr cairo_device_reference (IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void cairo_device_release(IntPtr device);
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern Status cairo_device_status(IntPtr device);
-               #endregion
-
-
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
-               public static extern void crow_cairo_region_clear(IntPtr ctx, IntPtr reg);
-
-       }
-}
\ No newline at end of file
diff --git a/Backends/Crow.CairoBackend/src/NativeMethods.cs b/Backends/Crow.CairoBackend/src/NativeMethods.cs
deleted file mode 100644 (file)
index 7b6053a..0000000
+++ /dev/null
@@ -1,1072 +0,0 @@
-//
-// Cairo.cs - a simplistic binding of the Cairo API to C#.
-//
-// Authors: Duncan Mak (duncan@ximian.com)
-//          Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//          John Luke (john.luke@gmail.com)
-//          Alp Toker (alp@atoker.com)
-//
-// (C) Ximian, Inc. 2003
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-// Copyright (C) 2006 Alp Toker
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       // sort the functions like in the following page so it is easier to find what is missing
-       // http://cairographics.org/manual/index-all.html
-
-       internal static class NativeMethods
-       {
-#if MONOTOUCH
-               const string cairo = "__Internal";
-#else
-       const string cairo = "cairo";
-#endif
-
-        //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-        //internal static extern void cairo_append_path (IntPtr cr, Path path);
-
-        [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_arc (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_arc_negative (IntPtr cr, double xc, double yc, double radius, double angle1, double angle2);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_atsui_font_face_create_for_atsu_font_id (IntPtr font_id);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_clip (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_clip_preserve (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_clip_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_close_path (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_copy_page (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_copy_path (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_copy_path_flat (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_append_path (IntPtr cr, IntPtr path);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_create (IntPtr target);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_debug_reset_static_data ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_destroy (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_device_to_user (IntPtr cr, ref double x, ref double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_device_to_user_distance (IntPtr cr, ref double dx, ref double dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_fill (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_fill_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_fill_preserve (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_extents (IntPtr cr, out FontExtents extents);
-
-               #region FontFace
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_face_destroy (IntPtr font_face);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern FontType cairo_font_face_get_type (IntPtr font_face);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern void cairo_font_face_get_user_data (IntPtr font_face);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern void cairo_font_face_set_user_data (IntPtr font_face);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_font_face_reference (IntPtr font_face);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_font_face_status (IntPtr font_face);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern uint cairo_font_face_get_reference_count (IntPtr surface);
-               #endregion
-
-               #region FontOptions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_font_options_copy (IntPtr original);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_font_options_create ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_destroy (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               [return: MarshalAs (UnmanagedType.U1)]
-               internal static extern bool cairo_font_options_equal (IntPtr options, IntPtr other);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Antialias cairo_font_options_get_antialias (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern HintMetrics cairo_font_options_get_hint_metrics (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern HintStyle cairo_font_options_get_hint_style (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern SubpixelOrder cairo_font_options_get_subpixel_order (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern long cairo_font_options_hash (IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_merge (IntPtr options, IntPtr other);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_set_antialias (IntPtr options, Antialias aa);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_set_hint_metrics (IntPtr options, HintMetrics metrics);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_set_hint_style (IntPtr options, HintStyle style);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_font_options_set_subpixel_order (IntPtr options, SubpixelOrder order);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_font_options_status (IntPtr options);
-               #endregion
-
-               #region Freetype / FontConfig
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_ft_font_face_create_for_ft_face (IntPtr face, int load_flags);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_ft_font_face_create_for_pattern (IntPtr fc_pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ft_font_options_substitute (FontOptions options, IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_ft_scaled_font_lock_face (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ft_scaled_font_unlock_face (IntPtr scaled_font);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Antialias cairo_get_antialias (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_get_current_point (IntPtr cr, out double x, out double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern FillRule cairo_get_fill_rule (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_get_font_face (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_get_font_matrix (IntPtr cr, out Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_get_font_options (IntPtr cr, IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_get_group_target (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern LineCap cairo_get_line_cap (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern LineJoin cairo_get_line_join (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern double cairo_get_line_width (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_get_matrix (IntPtr cr, out Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern double cairo_get_miter_limit (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Operator cairo_get_operator (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern uint cairo_get_reference_count (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_get_source (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_get_target (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern double cairo_get_tolerance (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_glitz_surface_create (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_glyph_extents (IntPtr cr, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_glyph_path (IntPtr cr, IntPtr glyphs, int num_glyphs);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               [return: MarshalAs (UnmanagedType.U1)]
-               internal static extern bool cairo_has_current_point (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_identity_matrix (IntPtr cr);
-
-               #region Image Surface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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, 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, 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);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern IntPtr cairo_image_surface_create_from_png_stream  (string filename);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_image_surface_get_data (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Format cairo_image_surface_get_format (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_image_surface_get_height (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_image_surface_get_stride (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_image_surface_get_width  (IntPtr surface);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               [return: MarshalAs (UnmanagedType.U1)]
-               internal static extern bool cairo_in_clip (IntPtr cr, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               [return: MarshalAs (UnmanagedType.U1)]
-               internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               [return: MarshalAs (UnmanagedType.U1)]
-               internal static extern bool cairo_in_stroke (IntPtr cr, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_line_to (IntPtr cr, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mask (IntPtr cr, IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mask_surface (IntPtr cr, IntPtr surface, double x, double y);
-
-               #region Matrix
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_init (Matrix matrix, double xx, double yx, double xy, double yy, double x0, double y0);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_init_identity (Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_init_rotate (Matrix matrix, double radians);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_init_scale (Matrix matrix, double sx, double sy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_init_translate (Matrix matrix, double tx, double ty);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_matrix_invert (Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_multiply (Matrix result, Matrix a, Matrix b);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_scale (Matrix matrix, double sx, double sy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_rotate (Matrix matrix, double radians);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_transform_distance (Matrix matrix, ref double dx, ref double dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_transform_point (Matrix matrix, ref double x, ref double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_matrix_translate (Matrix matrix, double tx, double ty);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_move_to (IntPtr cr, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_new_path (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_new_sub_path (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_paint (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_paint_with_alpha (IntPtr cr, double alpha);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_path_destroy (IntPtr path);
-
-               #region Pattern
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_add_color_stop_rgb (IntPtr pattern, double offset, double red, double green, double blue);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_add_color_stop_rgba (IntPtr pattern, double offset, double red, double green, double blue, double alpha);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_color_stop_count (IntPtr pattern, out int count);
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_color_stop_rgba (IntPtr pattern, int index, out double offset, out double red, out double green, out double blue, out double alpha);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_for_surface (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_surface (IntPtr pattern, out IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_linear_points (IntPtr pattern, out double x0, out double y0, out double x1, out double y1);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_radial_circles (IntPtr pattern, out double x0, out double y0, out double r0, out double x1, out double y1, out double r1);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_rgb (double r, double g, double b);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_rgba (double r, double g, double b, double a);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_get_rgba (IntPtr pattern, out double red, out double green, out double blue, out double alpha);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_destroy (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Extend cairo_pattern_get_extend (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Filter cairo_pattern_get_filter (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern PatternType cairo_pattern_get_type (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_reference (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_set_extend (IntPtr pattern, Extend extend);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_set_filter (IntPtr pattern, Filter filter);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pattern_set_matrix (IntPtr pattern, Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_pattern_status (IntPtr pattern);
-
-               //mesh pattern
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pattern_create_mesh ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_begin_patch (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_end_patch (IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_move_to (IntPtr pattern, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_line_to (IntPtr pattern, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_curve_to (IntPtr pattern, double x1, double y1,
-                       double x2, double y2, double x3, double y3);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_set_control_point (IntPtr pattern, uint point_num, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_set_corner_color_rgb (IntPtr pattern, uint corner_num,
-                       double r, double g, double b);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_mesh_pattern_set_corner_color_rgba (IntPtr pattern, uint corner_num,
-                       double r, double g, double b, double a);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_mesh_pattern_get_patch_count (IntPtr pattern, out uint count);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_mesh_pattern_get_path (IntPtr pattern, uint patch_num);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_mesh_pattern_get_control_point (IntPtr pattern,
-                       uint patch_num, uint point_num, out double x, out double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_mesh_pattern_get_corner_color_rgba (IntPtr pattern,
-                       uint patch_num, uint point_num, out double r, out double g, out double b, out double a);
-               #endregion
-
-               #region PdfSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pdf_surface_create (string filename, double width, double height);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern IntPtr cairo_pdf_surface_create_for_stream (string filename, double width, double height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pdf_surface_set_size (IntPtr surface, double x, double y);
-               #endregion
-
-               #region PostscriptSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_ps_surface_create (string filename, double width, double height);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_ps_surface_set_size (IntPtr surface, double x, double y);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_pop_group (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_pop_group_to_source (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_push_group (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_push_group_with_content (IntPtr cr, Content content);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_quartz_surface_create (IntPtr context, bool flipped, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_reference (IntPtr cr);
-
-               #region Regions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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 Rectangle rectangle);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_region_copy (IntPtr original);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_region_create ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_region_destroy (IntPtr region);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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 Rectangle extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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 Rectangle rectangle);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern bool cairo_region_is_empty (IntPtr region);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_region_num_rectangles (IntPtr region);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_region_reference (IntPtr region);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_region_status (IntPtr region);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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 Rectangle rectangle);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_region_translate (IntPtr region, int dx, int dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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 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 Rectangle rectangle);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_reset_clip (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_restore (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rotate (IntPtr cr, double angle);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_save (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scale (IntPtr cr, double sx, double sy);
-
-               #region ScaledFont
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_scaled_font_create (IntPtr fontFace, Matrix matrix, Matrix ctm, IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_scaled_font_destroy (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scaled_font_extents (IntPtr scaled_font, out FontExtents extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_scaled_font_get_font_face (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scaled_font_get_font_matrix (IntPtr scaled_font, out Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_scaled_font_get_font_options (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_scaled_font_reference (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_scaled_font_status (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_scaled_font (IntPtr cr, IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_get_scaled_font (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, byte[] utf8, out TextExtents extents);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_antialias (IntPtr cr, Antialias antialias);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_get_dash (IntPtr cr, IntPtr dashes, out double offset);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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, FillRule fill_rule);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_font_face (IntPtr cr, IntPtr fontFace);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_font_matrix (IntPtr cr, Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_font_options (IntPtr cr, IntPtr options);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_font_size (IntPtr cr, double size);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_line_width (IntPtr cr, double width);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_matrix (IntPtr cr, ref Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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, Operator op);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_source (IntPtr cr, IntPtr pattern);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_source_rgb (IntPtr cr, double red, double green, double blue);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_source_rgba (IntPtr cr, double red, double green, double blue, double alpha);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_source_surface (IntPtr cr, IntPtr surface, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_set_tolerance (IntPtr cr, double tolerance);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_show_glyphs (IntPtr ct, IntPtr glyphs, int num_glyphs);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_show_page (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_status (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_status_to_string (Status status);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_stroke (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_stroke_extents (IntPtr cr, out double x1, out double y1, out double x2, out double y2);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_stroke_preserve (IntPtr cr);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_rectangle_list_destroy (IntPtr rectangle_list);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_copy_clip_rectangle_list (IntPtr cr);
-
-               #region Surface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               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);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_finish (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_flush (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Content cairo_surface_get_content (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_get_device_offset (IntPtr surface, out double x, out double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_mark_dirty (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_mark_dirty_rectangle (IntPtr surface, int x, int y, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_surface_reference (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_set_device_offset (IntPtr surface, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_set_fallback_resolution (IntPtr surface, double x, double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_surface_status (IntPtr surface);
-               #endregion
-
-               #region SVG surface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_surface_write_to_png (IntPtr surface, string filename);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern void cairo_surface_write_to_png_stream (IntPtr surface, WriteFunc writeFunc);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_svg_surface_create (string fileName, double width, double height);
-
-               //[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               //internal static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
-               #endregion
-
-               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
-               internal static extern void cairo_show_text (IntPtr cr, byte[] text);
-
-               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
-               internal static extern void cairo_text_extents (IntPtr cr, byte[] utf8, out TextExtents extents);
-
-               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
-               internal static extern void cairo_show_text (IntPtr cr, ref byte utf8);
-
-               [DllImport (cairo, CallingConvention = CallingConvention.Cdecl)]
-               internal static extern void cairo_text_extents (IntPtr cr, ref byte utf8, out TextExtents extents);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_text_path (IntPtr ct, byte[] utf8);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_transform (IntPtr cr, Matrix matrix);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_translate (IntPtr cr, double tx, double ty);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_user_to_device_distance (IntPtr cr, ref double dx, ref double dy);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_version ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_version_string ();
-
-               #region DirectFBSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_directfb_surface_create (IntPtr dfb, IntPtr surface);
-               #endregion
-
-               #region win32 fonts
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_win32_font_face_create_for_logfontw (IntPtr logfontw);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_win32_scaled_font_done_font (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern double cairo_win32_scaled_font_get_metrics_factor (IntPtr scaled_font);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_win32_scaled_font_select_font (IntPtr scaled_font, IntPtr hdc);
-               #endregion
-
-               #region win32 surface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_win32_surface_create (IntPtr hdc);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_win32_surface_create_with_ddb (IntPtr hdc, Format format, int width, int height);
-               #endregion
-
-               #region XcbSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xcb_surface_create (IntPtr connection, uint drawable, IntPtr visual, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xcb_surface_create_for_bitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_xcb_surface_set_size (IntPtr surface, int width, int height);
-               #endregion
-
-               #region XlibSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_create (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_create_for_bitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_xlib_surface_get_depth (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_get_display (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_get_drawable (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_xlib_surface_get_height (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_get_screen (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_xlib_surface_get_visual (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_xlib_surface_get_width (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_xlib_surface_set_drawable (IntPtr surface, IntPtr drawable, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
-               #endregion
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_gl_device_set_thread_aware(IntPtr device, int value);
-
-               #region GLSurface
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_gl_surface_create (IntPtr device, uint content, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_gl_surface_create_for_texture (IntPtr device, uint content, uint tex, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_gl_surface_set_size (IntPtr surface, int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_gl_surface_get_width (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_gl_surface_get_height (IntPtr surface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_gl_surface_swapbuffers (IntPtr surf);
-               #endregion
-
-               #region GLX Functions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_glx_device_create (IntPtr dpy, IntPtr gl_ctx);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_glx_device_get_display (IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_glx_device_get_context (IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_gl_surface_create_for_window (IntPtr device, IntPtr window, int width, int height);
-               #endregion
-
-               #region WGL Fucntions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_wgl_device_create (IntPtr hglrc);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_wgl_device_get_context (IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_gl_surface_create_for_dc (IntPtr device, IntPtr hdc, int width, int height);
-               #endregion
-
-               #region EGL Functions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_egl_device_create (IntPtr dpy, IntPtr gl_ctx);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_gl_surface_create_for_egl (IntPtr device, IntPtr eglSurface, int width, int height);
-               #endregion
-
-               #region DRM Functions
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_device_get (IntPtr udev_device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_device_get_for_fd (int fd);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_device_default ();
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_drm_device_get_fd (IntPtr cairo_device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern  void cairo_drm_device_throttle (IntPtr cairo_device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_create (IntPtr cairo_device, Format format,     int width, int height);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_create_for_name (IntPtr cairo_device, uint name, Format format, int width, int height, int stride);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_create_from_cacheable_image (IntPtr cairo_device, IntPtr imageSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_drm_surface_enable_scan_out (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_get_handle (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_get_name (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Format cairo_drm_surface_get_format (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_drm_surface_get_width (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_drm_surface_get_height (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern int cairo_drm_surface_get_stride (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_drm_surface_map_to_image (IntPtr drmSurface);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void     cairo_drm_surface_unmap (IntPtr drmSurface,     IntPtr imageSurface);
-               #endregion
-
-               #region Device
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_device_acquire(IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_device_destroy (IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern IntPtr cairo_device_reference (IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern void cairo_device_release(IntPtr device);
-
-               [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
-               internal static extern Status cairo_device_status(IntPtr device);
-               #endregion
-       }
-}
\ No newline at end of file
diff --git a/Backends/Crow.CairoBackend/src/PSSurface.cs b/Backends/Crow.CairoBackend/src/PSSurface.cs
deleted file mode 100644 (file)
index 695b05d..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// Mono.Cairo.PostscriptSurface.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class PSSurface : Surface
-       {
-               internal PSSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public PSSurface (string filename, double width, double height)
-                       : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
-               {
-               }
-
-               public void BeginPageSetup ()
-               {
-                       NativeMethods.cairo_ps_surface_dsc_begin_page_setup (handle);
-               }
-
-               public void BeginSetup ()
-               {
-                       NativeMethods.cairo_ps_surface_dsc_begin_setup (handle);
-               }
-
-               public void DscComment (string comment)
-               {
-                       NativeMethods.cairo_ps_surface_dsc_comment (handle, comment);
-               }
-
-               public void SetSize (double width, double height)
-               {
-                       NativeMethods.cairo_ps_surface_set_size (handle, width, height);
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Path.cs b/Backends/Crow.CairoBackend/src/Path.cs
deleted file mode 100644 (file)
index 54ae430..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Mono.Cairo.Context.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@novell.com)
-//
-// This is an OO wrapper API for the Cairo API.
-//
-// Copyright 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-
-namespace Crow.CairoBackend {
-
-       public class Path : IDisposable
-       {
-               IntPtr handle = IntPtr.Zero;
-
-               internal Path (IntPtr handle)
-               {
-                       this.handle = handle;
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               ~Path ()
-               {
-                       Dispose (false);
-               }
-
-               public IntPtr Handle { get { return handle; } }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Path> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_path_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Pattern.cs b/Backends/Crow.CairoBackend/src/Pattern.cs
deleted file mode 100644 (file)
index 3de491e..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       public class Pattern : IPattern
-       {
-               internal IntPtr handle;
-               public static Pattern Lookup (IntPtr pattern, bool owner)
-               {
-                       if (pattern == IntPtr.Zero)
-                               return null;
-
-                       PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
-                       switch (pt) {
-                       case PatternType.Solid:
-                               return new SolidPattern (pattern, owner);
-                       case PatternType.Surface:
-                               return new SurfacePattern (pattern, owner);
-                       case PatternType.Linear:
-                               return new LinearGradient (pattern, owner);
-                       case PatternType.Radial:
-                               return new RadialGradient (pattern, owner);
-                       default:
-                               return new Pattern (pattern, owner);
-                       }
-               }
-
-               internal Pattern (IntPtr handle, bool owned)
-               {
-                       this.handle = handle;
-                       if (!owned)
-                               NativeMethods.cairo_pattern_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               [Obsolete ("Use the SurfacePattern constructor")]
-               public Pattern (Surface surface)
-                       : this ( NativeMethods.cairo_pattern_create_for_surface (surface.handle), true)
-               {
-               }
-
-               [Obsolete]
-               protected void Reference ()
-               {
-                       NativeMethods.cairo_pattern_reference (handle);
-               }
-
-
-
-               public Status Status => NativeMethods.cairo_pattern_status (handle);
-
-               public Matrix Matrix {
-                       set => NativeMethods.cairo_pattern_set_matrix (handle, value);
-                       get {
-                               Matrix m = new Matrix ();
-                               NativeMethods.cairo_pattern_get_matrix (handle, m);
-                               return m;
-                       }
-               }
-
-               public PatternType PatternType => NativeMethods.cairo_pattern_get_type (handle);
-
-               #region IPattern implementation
-               public Extend Extend
-               {
-                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
-                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
-               }
-               public Filter Filter {
-                       get => NativeMethods.cairo_pattern_get_filter (handle);
-                       set => NativeMethods.cairo_pattern_set_filter (handle, value);
-               }
-               #endregion
-
-               ~Pattern ()
-               {
-                       Dispose (false);
-               }
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Pattern> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_pattern_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/PdfSurface.cs b/Backends/Crow.CairoBackend/src/PdfSurface.cs
deleted file mode 100644 (file)
index 061eaa4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Mono.Cairo.PdfSurface.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class PdfSurface : Surface
-       {
-               internal PdfSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public PdfSurface (string filename, double width, double height)
-                       : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
-               {
-               }
-
-               public void SetSize (double width, double height)
-               {
-                       NativeMethods.cairo_pdf_surface_set_size (handle, width, height);
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/RadialGradient.cs b/Backends/Crow.CairoBackend/src/RadialGradient.cs
deleted file mode 100644 (file)
index d27aa54..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class RadialGradient : Gradient
-       {
-               internal RadialGradient (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
-                       : base (NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1), true)
-               {
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/Region.cs b/Backends/Crow.CairoBackend/src/Region.cs
deleted file mode 100644 (file)
index 139ebc8..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (C) 2011 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend
-{
-       [StructLayout(LayoutKind.Sequential)]
-       struct RectangleList {
-               public Status Status;
-               public IntPtr Rectangles;
-               public int NumRectangles;
-       }
-
-
-       public class Region : IRegion {
-
-               IntPtr handle;
-
-               #region CTOR
-               public Region (IntPtr handle, bool owned)
-               {
-                       this.handle = handle;
-                       if (!owned)
-                               NativeMethods.cairo_region_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-               public Region () : this (NativeMethods.cairo_region_create () , true)
-               {}
-               public Region (Rectangle rect) {
-                       handle = NativeMethods.cairo_region_create_rectangle (ref rect);
-               }
-               #endregion
-
-               public Region Copy () => new Region (NativeMethods.cairo_region_copy (handle), true);
-
-
-               public Status Status {
-                       get { return NativeMethods.cairo_region_status (handle); }
-               }
-
-               public Rectangle Extents {
-                       get {
-                               Rectangle result;
-                               NativeMethods.cairo_region_get_extents (handle, out result);
-                               return result;
-                       }
-               }
-
-               public bool Contains (int x, int y)
-               {
-                       return NativeMethods.cairo_region_contains_point (handle, x, y);
-               }
-
-               public void Translate (int dx, int dy)
-               {
-                       NativeMethods.cairo_region_translate (handle, dx, dy);
-               }
-
-               public Status Subtract (Region other)
-               {
-                       return NativeMethods.cairo_region_subtract (handle, other.handle);
-               }
-
-               public Status SubtractRectangle (Rectangle rectangle)
-               {
-                       return NativeMethods.cairo_region_subtract_rectangle (handle, ref rectangle);
-               }
-
-               public Status Intersect (Region other)
-               {
-                       return NativeMethods.cairo_region_intersect (handle, other.handle);
-               }
-
-               public Status IntersectRectangle (Rectangle rectangle)
-               {
-                       return NativeMethods.cairo_region_intersect_rectangle (handle, ref rectangle);
-               }
-
-               public Status Union (Region other)
-               {
-                       return NativeMethods.cairo_region_union (handle, other.handle);
-               }
-
-
-               public Status Xor (Region other)
-               {
-                       return NativeMethods.cairo_region_xor (handle, other.handle);
-               }
-
-               public Status XorRectangle (Rectangle rectangle)
-               {
-                       return NativeMethods.cairo_region_xor_rectangle (handle, ref rectangle);
-               }
-
-               #region  IRegion implementation
-               public bool IsEmpty => NativeMethods.cairo_region_is_empty (handle);
-               public int NumRectangles => NativeMethods.cairo_region_num_rectangles (handle);
-               public Rectangle GetRectangle (int nth)
-               {
-                       Rectangle val;
-                       NativeMethods.cairo_region_get_rectangle (handle, nth, out val);
-                       return val;
-               }
-               public void UnionRectangle (Rectangle rectangle)
-                       => NativeMethods.cairo_region_union_rectangle (handle, ref rectangle);
-               public bool OverlapOut (Rectangle rectangle) => Contains (rectangle) == RegionOverlap.Out;
-               public RegionOverlap Contains (Rectangle rectangle)
-                       => NativeMethods.cairo_region_contains_rectangle (handle, ref rectangle);
-               public void Reset () {
-                       if (IsEmpty)
-                               return;
-                       NativeMethods.cairo_region_destroy (handle);
-                       handle = NativeMethods.cairo_region_create ();
-               }
-
-               public bool Equals(IRegion other)
-                       => other is Region r ? NativeMethods.cairo_region_equal (handle, r.handle) : false;
-               #endregion
-
-               public override bool Equals (object obj)
-                       => obj is Region r ? NativeMethods.cairo_region_equal (handle, r.handle) : false;
-
-               public override int GetHashCode () => handle.GetHashCode ();
-
-               #region IDisposable
-               ~Region ()
-               {
-                       Dispose (false);
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Region> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_region_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-               #endregion
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/ScaledFont.cs b/Backends/Crow.CairoBackend/src/ScaledFont.cs
deleted file mode 100644 (file)
index 8fc245e..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// Mono.Cairo.ScaledFont.cs
-//
-// (c) 2008 Jordi Mas i Hernandez (jordimash@gmail.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-       public class ScaledFont : IDisposable
-       {
-               protected IntPtr handle = IntPtr.Zero;
-
-               internal ScaledFont (IntPtr handle, bool owner)
-               {
-                       this.handle = handle;
-                       if (!owner)
-                               NativeMethods.cairo_scaled_font_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               public ScaledFont (FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options)
-                       : this (NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle), true)
-               {
-               }
-
-               ~ScaledFont ()
-               {
-                       Dispose (false);
-               }
-
-               public IntPtr Handle {
-                       get {
-                               return handle;
-                       }
-               }
-
-               public FontExtents FontExtents {
-                       get {
-                               FontExtents extents;
-                               NativeMethods.cairo_scaled_font_extents (handle, out extents);
-                               return extents;
-                       }
-               }
-
-               public Matrix FontMatrix {
-                       get {
-                               Matrix m;
-                               NativeMethods.cairo_scaled_font_get_font_matrix (handle, out m);
-                               return m;
-                       }
-               }
-
-               public FontType FontType {
-                       get {
-                               return NativeMethods.cairo_scaled_font_get_type (handle);
-                       }
-               }
-
-               public TextExtents GlyphExtents (Glyph[] glyphs)
-               {
-                       IntPtr ptr = Context.FromGlyphToUnManagedMemory (glyphs);
-                       TextExtents extents;
-
-                       NativeMethods.cairo_scaled_font_glyph_extents (handle, ptr, glyphs.Length, out extents);
-
-                       Marshal.FreeHGlobal (ptr);
-                       return extents;
-               }
-       
-               public Status Status
-               {
-                       get { return NativeMethods.cairo_scaled_font_status (handle); }
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<ScaledFont> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_scaled_font_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-
-               [Obsolete]
-               protected void Reference ()
-               {
-                       NativeMethods.cairo_scaled_font_reference (handle);
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/SolidPattern.cs b/Backends/Crow.CairoBackend/src/SolidPattern.cs
deleted file mode 100644 (file)
index 65e86a0..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class SolidPattern : Pattern
-       {
-               internal SolidPattern (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public SolidPattern (Color color)
-                       : base (NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A), true)
-               {
-               }
-
-               public SolidPattern (double r, double g, double b)
-                       : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
-               {
-               }
-
-               public SolidPattern (double r, double g, double b, double a)
-                       : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
-               {
-               }
-
-               public SolidPattern (Color color, bool solid)
-                       : base (solid
-                                       ? NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B)
-                                       : NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A),
-                               true)
-               {
-               }
-
-               public Color Color {
-                       get {
-                               double red, green, blue, alpha;
-                               NativeMethods.cairo_pattern_get_rgba  (handle, out red, out green, out blue, out alpha);
-                               return new Color (red, green, blue, alpha);
-                       }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/Status.cs b/Backends/Crow.CairoBackend/src/Status.cs
deleted file mode 100644 (file)
index 79252f6..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// Mono.Cairo.Status.cs
-//
-// Authors:
-//   Duncan Mak (duncan@ximian.com)
-//   Hisham Mardam Bey (hisham.mardambey@gmail.com)
-//   John Luke (john.luke@gmail.com)
-//   Alp Toker (alp@atoker.com)
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 John Luke
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       
-       public enum Status
-       {
-               Success = 0,
-               NoMemory,
-               InvalidRestore,
-               InvalidPopGroup,
-               NoCurrentPoint,
-               InvalidMatrix,
-               InvalidStatus,
-               NullPointer,
-               InvalidString,
-               InvalidPathData,
-               ReadError,
-               WriteError,
-               SurfaceFinished,
-               SurfaceTypeMismatch,
-               PatternTypeMismatch,
-               InvalidContent,
-               InvalidFormat,
-               InvalidVisual,
-               FileNotFound,
-               InvalidDash,
-               InvalidDscComment,
-               InvalidIndex,
-               ClipNotRepresentable,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/SubpixelOrder.cs b/Backends/Crow.CairoBackend/src/SubpixelOrder.cs
deleted file mode 100644 (file)
index 569225f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Mono.Cairo.Cairo.cs
-//
-// Authors:
-//   John Luke (john.luke@gmail.com)
-//
-// Copyright (C) John Luke 2005
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend
-{
-       public enum SubpixelOrder
-       {
-               Default,
-               Rgb,
-               Bgr,
-               Vrgb,
-               Vbgr,
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/Surface.cs b/Backends/Crow.CairoBackend/src/Surface.cs
deleted file mode 100644 (file)
index 80435b5..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// Mono.Cairo.Surface.cs
-//
-// Authors:
-//    Duncan Mak
-//    Miguel de Icaza.
-//    Alp Toker
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class Surface : ISurface
-       {
-               internal IntPtr handle = IntPtr.Zero;
-
-               protected Surface()
-               {
-               }
-
-               [Obsolete]
-               protected Surface (IntPtr ptr) : this (ptr, true)
-               {
-               }
-
-               protected Surface (IntPtr handle, bool owner)
-               {
-                       this.handle = handle;
-                       if (!owner)
-                               NativeMethods.cairo_surface_reference (handle);
-                       if (CairoDebug.Enabled)
-                               CairoDebug.OnAllocated (handle);
-               }
-
-               public static Surface Lookup (IntPtr surface, bool owned)
-               {
-                       SurfaceType st = NativeMethods.cairo_surface_get_type (surface);
-                       switch (st) {
-                       case SurfaceType.Image:
-                               return new ImageSurface (surface, owned);
-                       case SurfaceType.Xlib:
-                               return new XlibSurface (surface, owned);
-                       case SurfaceType.Xcb:
-                               return new XcbSurface (surface, owned);
-                       case SurfaceType.Glitz:
-                               return new GlitzSurface (surface, owned);
-                       case SurfaceType.Win32:
-                               return new Win32Surface (surface, owned);
-                       case SurfaceType.Pdf:
-                               return new PdfSurface (surface, owned);
-                       case SurfaceType.PS:
-                               return new PSSurface (surface, owned);
-                       case SurfaceType.DirectFB:
-                               return new DirectFBSurface (surface, owned);
-                       case SurfaceType.Svg:
-                               return new SvgSurface (surface, owned);
-                       case SurfaceType.GL:
-                               return new GLSurface (surface, owned);
-                       default:
-                               return new Surface (surface, owned);
-                       }
-               }
-
-               [Obsolete ("Use an ImageSurface constructor instead.")]
-               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 Surface (p, true);
-               }
-
-               [Obsolete ("Use an ImageSurface constructor instead.")]
-               public static Surface CreateForImage (
-                       Format format, int width, int height)
-               {
-                       IntPtr p = NativeMethods.cairo_image_surface_create (
-                               format, width, height);
-
-                       return new Surface (p, true);
-               }
-
-
-               public ISurface CreateSimilar (int width, int height) {
-                       IntPtr p = NativeMethods.cairo_surface_create_similar (
-                               this.handle, Content.ColorAlpha, width, height);
-                       return Surface.Lookup(p, true);
-               }
-
-               ~Surface ()
-               {
-                       Dispose (false);
-               }
-
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (!disposing || CairoDebug.Enabled)
-                               CairoDebug.OnDisposed<Surface> (handle, disposing);
-
-                       if (!disposing|| handle == IntPtr.Zero)
-                               return;
-
-                       NativeMethods.cairo_surface_destroy (handle);
-                       handle = IntPtr.Zero;
-               }
-               public virtual void Resize (int width, int height) {
-                       
-               }
-
-               public Status Finish ()
-               {
-                       NativeMethods.cairo_surface_finish (handle);
-                       return Status;
-               }
-
-               public virtual void Flush ()
-               {
-                       NativeMethods.cairo_surface_flush (handle);
-               }
-
-               public void MarkDirty ()
-               {
-                       NativeMethods.cairo_surface_mark_dirty (handle);
-               }
-
-               public void MarkDirty (Rectangle rectangle)
-               {
-                       NativeMethods.cairo_surface_mark_dirty_rectangle (handle, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
-               }
-               public virtual int Width => NativeMethods.cairo_image_surface_get_width (handle);
-               public virtual int Height => NativeMethods.cairo_image_surface_get_height (handle);
-               public PointD DeviceOffset {
-                       get {
-                               double x, y;
-                               NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
-                               return new PointD (x, y);
-                       }
-
-                       set {
-                               NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
-                       }
-               }
-
-               [Obsolete ("Use Dispose()")]
-               public void Destroy()
-               {
-                       Dispose ();
-               }
-
-               public void SetFallbackResolution (double x, double y)
-               {
-                       NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
-               }
-
-               public void WriteToPng (string filename)
-               {
-                       NativeMethods.cairo_surface_write_to_png (handle, filename);
-               }
-
-               [Obsolete ("Use Handle instead.")]
-               public IntPtr Pointer {
-                       get {
-                               return handle;
-                       }
-               }
-
-               public Status Status {
-                       get { return NativeMethods.cairo_surface_status (handle); }
-               }
-
-               public Content Content {
-                       get { return NativeMethods.cairo_surface_get_content (handle); }
-               }
-
-               public SurfaceType SurfaceType {
-                       get { return NativeMethods.cairo_surface_get_type (handle); }
-               }
-
-               public uint ReferenceCount {
-                       get { return NativeMethods.cairo_surface_get_reference_count (handle); }
-               }
-
-               public void WriteTo(IntPtr bitmap)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void Clear()
-               {
-                       throw new NotImplementedException();
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/SurfacePattern.cs b/Backends/Crow.CairoBackend/src/SurfacePattern.cs
deleted file mode 100644 (file)
index 85a3134..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Mono.Cairo.Pattern.cs
-//
-// Author: Jordi Mas (jordi@ximian.com)
-//         Hisham Mardam Bey (hisham.mardambey@gmail.com)
-// (C) Ximian Inc, 2004.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-       public class SurfacePattern : Pattern
-       {
-               internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
-               {
-               }
-
-               public SurfacePattern (Surface surface)
-                       : base (NativeMethods.cairo_pattern_create_for_surface (surface.handle), true)
-               {
-               }
-
-               //no idea why this is here, the base one is identical, but we can't remove it now
-               public new Extend Extend {
-                       set { NativeMethods.cairo_pattern_set_extend (handle, value); }
-                       get { return NativeMethods.cairo_pattern_get_extend (handle); }
-               }
-
-               public Filter Filter {
-                       set { NativeMethods.cairo_pattern_set_filter (handle, value); }
-                       get { return NativeMethods.cairo_pattern_get_filter (handle); }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/SurfaceType.cs b/Backends/Crow.CairoBackend/src/SurfaceType.cs
deleted file mode 100644 (file)
index 816635c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Mono.Cairo.SurfaceType.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-       public enum SurfaceType
-       {
-               Image,
-               Pdf,
-               PS,
-               Xlib,
-               Xcb,
-               Glitz,
-               Quartz,
-               Win32,
-               BeOS,
-               DirectFB,
-               Svg,
-               OS2,
-               Win32Printing,
-               QuartzImage,
-               Script,
-               Qt,
-               Recording,
-               VG,
-               GL,
-               Drm,
-               Tee,
-               Xml,
-               Skia,
-               SubSurface
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/SvgSurface.cs b/Backends/Crow.CairoBackend/src/SvgSurface.cs
deleted file mode 100644 (file)
index d6d53c3..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Mono.Cairo.SvgSurface.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class SvgSurface : Surface
-       {
-               internal SvgSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public SvgSurface (string filename, double width, double height)
-                       : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
-               {
-               }
-
-               public void RestrictToVersion (SvgVersion version)
-               {
-                       NativeMethods.cairo_svg_surface_restrict_to_version (handle, version);
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/SvgVersion.cs b/Backends/Crow.CairoBackend/src/SvgVersion.cs
deleted file mode 100644 (file)
index f79cc67..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Mono.Cairo.SvgVersion.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-       public enum SvgVersion
-       {
-               // FIXME: yuck
-               OnePointOne = 0,
-               OnePointTwo,
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/WGLDevice.cs b/Backends/Crow.CairoBackend/src/WGLDevice.cs
deleted file mode 100644 (file)
index 4d7773e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Mono.Cairo.Device.cs
-//
-// Authors:
-//                     JP Bruyère (jp_bruyere@hotmail.com)
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2016 JP Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace Crow.CairoBackend
-{
-       public class WGLDevice : GLDevice
-       {
-               public WGLDevice (IntPtr hglrc) : base (NativeMethods.cairo_wgl_device_create (hglrc), true)
-               {
-               }
-
-               public IntPtr Context {
-                       get { return NativeMethods.cairo_wgl_device_get_context (handle); }
-               }
-       }
-}
-
diff --git a/Backends/Crow.CairoBackend/src/Win32Surface.cs b/Backends/Crow.CairoBackend/src/Win32Surface.cs
deleted file mode 100644 (file)
index a10a9cf..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Mono.Cairo.Win32Surface.cs
-//
-// Authors:
-//    John Luke
-//
-// (C) John Luke, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class Win32Surface : Surface
-       {
-               IntPtr hdc;
-               internal Win32Surface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public Win32Surface (IntPtr hdc)
-                       : base (NativeMethods.cairo_win32_surface_create (hdc), true)
-               {
-                       this.hdc = hdc;
-               }
-               public override void Resize(int width, int height)
-               {
-                       if (hdc == IntPtr.Zero)
-                               base.Resize (width, height);
-                       else {
-                               NativeMethods.cairo_surface_destroy (handle);
-                               handle = NativeMethods.cairo_win32_surface_create (hdc);
-                       }
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/XcbSurface.cs b/Backends/Crow.CairoBackend/src/XcbSurface.cs
deleted file mode 100644 (file)
index ed557d0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Mono.Cairo.XcbSurface.cs
-//
-// Authors:
-//    Alp Toker
-//
-// (C) Alp Toker, 2006.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-       public class XcbSurface : Surface
-       {
-               internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns)
-               {
-               }
-
-               public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
-                       : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
-               {
-               }
-
-               public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
-               {
-                       IntPtr ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
-                       return new XcbSurface (ptr, true);
-               }
-               public override void Resize (int width, int height)
-               {
-                       NativeMethods.cairo_xcb_surface_set_size (handle, width, height);
-               }
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/XlibSurface.cs b/Backends/Crow.CairoBackend/src/XlibSurface.cs
deleted file mode 100644 (file)
index 6aea448..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// Mono.Cairo.XlibSurface.cs
-//
-// Authors:
-//    Duncan Mak
-//    Miguel de Icaza.
-//       JP Bruyère
-//
-// (C) Ximian Inc, 2003.
-// (C) Novell, Inc. 2003.
-// (C) JP Bruyère 2021
-//
-// This is an OO wrapper API for the Cairo API
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// 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
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Crow.CairoBackend {
-
-       public class XlibSurface : Surface
-       {
-               public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
-                       : base (NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height), true)
-               {
-               }
-
-               public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
-               {
-               }
-
-               public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
-               {
-                       IntPtr ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
-                       return new XlibSurface(ptr, true);
-               }
-
-               public void SetDrawable (IntPtr drawable, int width, int height)
-               {
-                       NativeMethods.cairo_xlib_surface_set_drawable (handle, drawable, width, height);
-               }
-
-               public override void Resize (int width, int height)
-               {
-                       NativeMethods.cairo_xlib_surface_set_size (handle, width, height);
-               }
-
-               public int Depth => NativeMethods.cairo_xlib_surface_get_depth (handle);
-               public IntPtr Display => NativeMethods.cairo_xlib_surface_get_display (handle);
-               public IntPtr Drawable => NativeMethods.cairo_xlib_surface_get_drawable (handle);
-               public override int Width => NativeMethods.cairo_xlib_surface_get_width (handle);
-               public override int Height => NativeMethods.cairo_xlib_surface_get_height (handle);
-
-               public IntPtr Screen => NativeMethods.cairo_xlib_surface_get_screen (handle);
-               public IntPtr Visual=> NativeMethods.cairo_xlib_surface_get_visual (handle);
-       }
-}
diff --git a/Backends/Crow.CairoBackend/src/rsvg/SvgHandle.cs b/Backends/Crow.CairoBackend/src/rsvg/SvgHandle.cs
deleted file mode 100644 (file)
index e767ce3..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//Copyright GPL2
-using System;
-using System.Runtime.InteropServices;
-using Drawing2D;
-
-namespace Crow.CairoBackend {
-
-
-       public sealed class SvgHandle : ISvgHandle {
-               const string lib = "rsvg-2.40";
-
-               public IntPtr Raw;
-
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_new();
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_new_from_data (byte[] data, UIntPtr n_data, out IntPtr error);
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_new_from_file (string file_name, out IntPtr error);
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_get_base_uri (IntPtr raw);
-               [DllImport (lib)]
-               static extern void rsvg_handle_set_dpi (IntPtr raw, double dpi);
-               [DllImport (lib)]
-               static extern void rsvg_handle_set_dpi_x_y (IntPtr raw, double dpi_x, double dpi_y);
-
-               [DllImport (lib)]
-               static extern void rsvg_handle_render_cairo (IntPtr raw, IntPtr cr);
-               [DllImport (lib)]
-               static extern void rsvg_handle_render_cairo_sub (IntPtr raw, IntPtr cr, string id);
-
-               [DllImport (lib)]
-               static extern void rsvg_handle_get_dimensions (IntPtr raw, IntPtr dimension_data);
-               [DllImport (lib)]
-               static extern bool rsvg_handle_close (IntPtr raw, out IntPtr error);
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_get_title (IntPtr raw);
-               [DllImport (lib)]
-               static extern IntPtr rsvg_handle_get_metadata (IntPtr raw);
-
-               public SvgHandle ()
-               {
-                       Raw = rsvg_handle_new();
-               }
-               public  SvgHandle (byte[] data)
-               {
-                       Raw = rsvg_handle_new_from_data(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)), out IntPtr error);
-                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
-               }
-               public SvgHandle (string file_name)
-               {
-                       Raw = rsvg_handle_new_from_file(file_name, out IntPtr error);
-                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
-               }
-
-
-               public double Dpi { set => rsvg_handle_set_dpi (Raw, value); }
-               public void SetDpiXY (double dpi_x, double dpi_y) => rsvg_handle_set_dpi_x_y (Raw, dpi_x, dpi_y);
-
-
-               public void Render(IContext cr) =>
-                       rsvg_handle_render_cairo (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle);
-
-               public void Render (IContext cr, string id) =>
-                       rsvg_handle_render_cairo_sub (Raw, cr == null ? IntPtr.Zero : (cr as Context).handle, id);
-
-               [StructLayout(LayoutKind.Sequential)]
-               struct DimensionData {
-
-                       public int Width;
-                       public int Height;
-                       public double Em;
-                       public double Ex;
-
-                       public static DimensionData Zero = new DimensionData ();
-
-                       public static DimensionData New(IntPtr raw) {
-                               if (raw == IntPtr.Zero)
-                                       return DimensionData.Zero;
-                               return (DimensionData) Marshal.PtrToStructure (raw, typeof (DimensionData));
-                       }
-               }
-               public Size Dimensions {
-                       get {
-                               DimensionData dimension_data;
-                               IntPtr native_dimension_data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (DimensionData)));
-                               rsvg_handle_get_dimensions(Raw, native_dimension_data);
-                               dimension_data = DimensionData.New (native_dimension_data);
-                               Marshal.FreeHGlobal (native_dimension_data);
-                               return new Size (dimension_data.Width, dimension_data.Height);
-                       }
-               }
-
-               public void Dispose() {
-                       bool raw_ret = rsvg_handle_close(Raw, out IntPtr error);
-                       if (error != IntPtr.Zero) throw new Exception (error.ToString());
-               }
-       }
-}
index 306a123eb328acdd9a7c221ad0c12e21e908a526..0e333546e81dcbe6d10a5c3c81e41018e2bf545b 100644 (file)
                <GlfwSharpVersion>0.2.14</GlfwSharpVersion>
 
                <NoWarn>$(NoWarn);1591</NoWarn>
+
+               <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
+               <GenerateDocumentationFile>true</GenerateDocumentationFile>
+               <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+               <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
+               <PackageProjectUrl>https://github.com/jpbruyere/Crow/wiki</PackageProjectUrl>
+               <PackageLicenseExpression>MIT</PackageLicenseExpression>
+               <PackageIcon>crow.png</PackageIcon>
+               <PackageCopyright>Copyright 2021</PackageCopyright>
+
        </PropertyGroup>
+       <ItemGroup>
+               <Content Include="..\..\Images\crow.png" Pack="true" PackagePath="" />
+       </ItemGroup>
 </Project>
index f77f3b43e7162d3048ec1dcc6fed67c539c2ff55..208fa632eab129fe6382caec1940b133af8a9eee 100644 (file)
@@ -4,7 +4,7 @@
                <TargetFramework>netstandard2.1</TargetFramework>
                <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
 
-               <AssemblyVersion>1.0.0</AssemblyVersion>
+               <AssemblyVersion>1.1.0</AssemblyVersion>
                <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
 
                <Title>Drawing 2D Library</Title>
index 0effb2d8be58f782e0f3c0a4e4ec7469398e276b..5966c1e829cfe6b2d3d67cdd73353b76cf5ec0cb 100644 (file)
@@ -23,7 +23,7 @@
        <ItemGroup>
          <ProjectReference Include="$(SolutionDir)Drawing2D\Drawing2D.csproj" />
          <!--<ProjectReference Include="$(SolutionDir)Backends\SkiaBackend\Crow.SkiaBackend.csproj" />-->
-         <ProjectReference Include="$(SolutionDir)Backends\Crow.CairoBackend\Crow.CairoBackend.csproj" />
+         <ProjectReference Include="$(SolutionDir)Backends\CairoBackend\Crow.CairoBackend.csproj" />
          <!--<ProjectReference Include="$(SolutionDir)Backends\VkvgBackend\Crow.VkvgBackend.csproj" />-->
        </ItemGroup>
        <ItemGroup>