<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="GtkSharp" version="3.1.3" targetFramework="net45" />
<package id="OpenTK" version="2.0.0" targetFramework="net45" />
</packages>
<frameworkAssembly assemblyName="System" />
<frameworkAssembly assemblyName="System.Drawing" />
<frameworkAssembly assemblyName="System.Xml" />
- <frameworkAssembly assemblyName="cairo-sharp" />
</frameworkAssemblies>
</metadata>
<files>
<Compile Include="src\CrowThread.cs" />
<Compile Include="src\GraphicObjects\ScrollingObject.cs" />
<Compile Include="src\GraphicObjects\ScrollingTextBox.cs" />
+ <Compile Include="src\Mono.Cairo\Antialias.cs" />
+ <Compile Include="src\Mono.Cairo\Cairo.cs" />
+ <Compile Include="src\Mono.Cairo\CairoDebug.cs" />
+ <Compile Include="src\Mono.Cairo\Color.cs" />
+ <Compile Include="src\Mono.Cairo\Content.cs" />
+ <Compile Include="src\Mono.Cairo\Context.cs" />
+ <Compile Include="src\Mono.Cairo\DRMDevice.cs" />
+ <Compile Include="src\Mono.Cairo\DRMSurface.cs" />
+ <Compile Include="src\Mono.Cairo\Device.cs" />
+ <Compile Include="src\Mono.Cairo\DirectFBSurface.cs" />
+ <Compile Include="src\Mono.Cairo\Distance.cs" />
+ <Compile Include="src\Mono.Cairo\EGLDevice.cs" />
+ <Compile Include="src\Mono.Cairo\Extend.cs" />
+ <Compile Include="src\Mono.Cairo\FillRule.cs" />
+ <Compile Include="src\Mono.Cairo\Filter.cs" />
+ <Compile Include="src\Mono.Cairo\FontExtents.cs" />
+ <Compile Include="src\Mono.Cairo\FontFace.cs" />
+ <Compile Include="src\Mono.Cairo\FontOptions.cs" />
+ <Compile Include="src\Mono.Cairo\FontSlant.cs" />
+ <Compile Include="src\Mono.Cairo\FontType.cs" />
+ <Compile Include="src\Mono.Cairo\FontWeight.cs" />
+ <Compile Include="src\Mono.Cairo\Format.cs" />
+ <Compile Include="src\Mono.Cairo\GLSurface.cs" />
+ <Compile Include="src\Mono.Cairo\GLXDevice.cs" />
+ <Compile Include="src\Mono.Cairo\GlitzSurface.cs" />
+ <Compile Include="src\Mono.Cairo\Glyph.cs" />
+ <Compile Include="src\Mono.Cairo\Gradient.cs" />
+ <Compile Include="src\Mono.Cairo\HintMetrics.cs" />
+ <Compile Include="src\Mono.Cairo\HintStyle.cs" />
+ <Compile Include="src\Mono.Cairo\ImageSurface.cs" />
+ <Compile Include="src\Mono.Cairo\LineCap.cs" />
+ <Compile Include="src\Mono.Cairo\LineJoin.cs" />
+ <Compile Include="src\Mono.Cairo\LinearGradient.cs" />
+ <Compile Include="src\Mono.Cairo\Matrix.cs" />
+ <Compile Include="src\Mono.Cairo\NativeMethods.cs" />
+ <Compile Include="src\Mono.Cairo\Operator.cs" />
+ <Compile Include="src\Mono.Cairo\PSSurface.cs" />
+ <Compile Include="src\Mono.Cairo\Path.cs" />
+ <Compile Include="src\Mono.Cairo\Pattern.cs" />
+ <Compile Include="src\Mono.Cairo\PatternType.cs" />
+ <Compile Include="src\Mono.Cairo\PdfSurface.cs" />
+ <Compile Include="src\Mono.Cairo\Point.cs" />
+ <Compile Include="src\Mono.Cairo\PointD.cs" />
+ <Compile Include="src\Mono.Cairo\RadialGradient.cs" />
+ <Compile Include="src\Mono.Cairo\Rectangle.cs" />
+ <Compile Include="src\Mono.Cairo\Region.cs" />
+ <Compile Include="src\Mono.Cairo\ScaledFont.cs" />
+ <Compile Include="src\Mono.Cairo\SolidPattern.cs" />
+ <Compile Include="src\Mono.Cairo\Status.cs" />
+ <Compile Include="src\Mono.Cairo\SubpixelOrder.cs" />
+ <Compile Include="src\Mono.Cairo\Surface.cs" />
+ <Compile Include="src\Mono.Cairo\SurfacePattern.cs" />
+ <Compile Include="src\Mono.Cairo\SurfaceType.cs" />
+ <Compile Include="src\Mono.Cairo\SvgSurface.cs" />
+ <Compile Include="src\Mono.Cairo\SvgVersion.cs" />
+ <Compile Include="src\Mono.Cairo\TextExtents.cs" />
+ <Compile Include="src\Mono.Cairo\WGLDevice.cs" />
+ <Compile Include="src\Mono.Cairo\Win32Surface.cs" />
+ <Compile Include="src\Mono.Cairo\XcbSurface.cs" />
+ <Compile Include="src\Mono.Cairo\XlibSurface.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Drawing" />
- <Reference Include="Mono.Cairo" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
- <Reference Include="cairo-sharp">
- <Package>gtk-sharp-3.0</Package>
- </Reference>
<Reference Include="OpenTK">
<HintPath>$(SolutionDir)packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
<Package>opentk</Package>
--- /dev/null
+//
+// Mono.Cairo.Antialias.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 Cairo
+{
+ [Serializable]
+ public enum Antialias
+ {
+ Default,
+ None,
+ Gray,
+ Subpixel,
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public static class CairoAPI {
+ static public int Version {
+ get {
+ return Cairo.NativeMethods.cairo_version ();
+ }
+ }
+
+ static public string VersionString {
+ get {
+ IntPtr x = Cairo.NativeMethods.cairo_version_string ();
+ return Marshal.PtrToStringAnsi (x);
+ }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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) {
+ Console.Error.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
+ if (Enabled) {
+ string val;
+ if (traces.TryGetValue (obj, out val)) {
+ Console.Error.WriteLine ("Allocated from:");
+ Console.Error.WriteLine (val);
+ }
+ } else {
+ Console.Error.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
+ }
+ }
+
+ if (Enabled)
+ traces.Remove (obj);
+ }
+ }
+
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ public struct Color
+ {
+ public Color(double r, double g, double b) : this (r, g, b, 1.0)
+ {
+ }
+
+ public Color(double r, double g, double b, double a)
+ {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ }
+
+ double r, g, b, a;
+
+ public double R {
+ get { return r; }
+ set { r = value; }
+ }
+
+ public double G {
+ get { return g; }
+ set { g = value; }
+ }
+
+ public double B {
+ get { return b; }
+ set { b = value; }
+ }
+
+ public double A {
+ get { return a; }
+ set { a = value; }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ //[Flags]
+ [Serializable]
+ public enum Content
+ {
+ Color = 0x1000,
+ Alpha = 0x2000,
+ ColorAlpha = 0x3000,
+ }
+}
--- /dev/null
+//
+// 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 Cairo;
+
+namespace Cairo {
+
+ [Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")]
+ public class Graphics : Context {
+ public Graphics (IntPtr state) : base (state) {}
+ public Graphics (Surface surface) : base (surface) {}
+ }
+
+ public class Context : IDisposable
+ {
+ 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));
+ }
+ }
+
+ public Context (Surface surface) : this (NativeMethods.cairo_create (surface.Handle), true)
+ {
+ }
+
+
+ public Context (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ [Obsolete]
+ public 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 Cairo.Status Status {
+ get {
+ return NativeMethods.cairo_status (handle);
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public Operator Operator {
+ set {
+ NativeMethods.cairo_set_operator (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_operator (handle);
+ }
+ }
+
+ [Obsolete ("Use SetSourceColor method")]
+ public Color Color {
+ set {
+ SetSourceColor (value);
+ }
+ }
+
+ [Obsolete ("Use SetSourceRGBA method")]
+ public Cairo.Color ColorRgb {
+ set {
+ Color = new Color (value.R, value.G, value.B);
+ }
+ }
+
+ public double Tolerance {
+ get {
+ return NativeMethods.cairo_get_tolerance (handle);
+ }
+
+ set {
+ NativeMethods.cairo_set_tolerance (handle, value);
+ }
+ }
+
+ public Cairo.FillRule FillRule {
+ set {
+ NativeMethods.cairo_set_fill_rule (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_fill_rule (handle);
+ }
+ }
+
+ public double LineWidth {
+ set {
+ NativeMethods.cairo_set_line_width (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_line_width (handle);
+ }
+ }
+
+ public Cairo.LineCap LineCap {
+ set {
+ NativeMethods.cairo_set_line_cap (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_line_cap (handle);
+ }
+ }
+
+ public Cairo.LineJoin LineJoin {
+ set {
+ NativeMethods.cairo_set_line_join (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_line_join (handle);
+ }
+ }
+
+ public void SetDash (double [] dashes, double offset)
+ {
+ NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset);
+ }
+
+ [Obsolete("Use GetSource/SetSource")]
+ public Pattern Pattern {
+ set {
+ SetSource (value);
+ }
+ get {
+ return GetSource ();
+ }
+ }
+
+ //This is obsolete because it wasn't obvious it needed to be disposed
+ [Obsolete("Use GetSource/SetSource")]
+ public Pattern Source {
+ set {
+ SetSource (value);
+ }
+ get {
+ return GetSource ();
+ }
+ }
+
+ public void SetSource (Pattern source)
+ {
+ NativeMethods.cairo_set_source (handle, source.Handle);
+ }
+
+ public Pattern GetSource ()
+ {
+ var ptr = NativeMethods.cairo_get_source (handle);
+ return Cairo.Pattern.Lookup (ptr, false);
+ }
+
+ public double MiterLimit {
+ set {
+ NativeMethods.cairo_set_miter_limit (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_miter_limit (handle);
+ }
+ }
+
+ 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 {
+ get {
+ return NativeMethods.cairo_has_current_point (handle);
+ }
+ }
+
+ [Obsolete ("Use GetTarget/SetTarget")]
+ public Cairo.Surface Target {
+ set {
+ if (handle != IntPtr.Zero)
+ NativeMethods.cairo_destroy (handle);
+
+ handle = NativeMethods.cairo_create (value.Handle);
+ }
+
+ get {
+ return GetTarget ();
+ }
+ }
+
+ public Surface GetTarget ()
+ {
+ return 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);
+ }
+
+ [Obsolete("Use GetScaledFont/SetScaledFont")]
+ public ScaledFont ScaledFont {
+ set {
+ SetScaledFont (value);
+ }
+
+ get {
+ return GetScaledFont ();
+ }
+ }
+
+ public ScaledFont GetScaledFont ()
+ {
+ return 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 {
+ get { return NativeMethods.cairo_get_reference_count (handle); }
+ }
+
+ public void SetSourceColor (Color color)
+ {
+ NativeMethods.cairo_set_source_rgba (handle, color.R, color.G, color.B, color.A);
+ }
+
+ public void SetSourceRGB (double r, double g, double b)
+ {
+ NativeMethods.cairo_set_source_rgb (handle, r, g, b);
+ }
+
+ public void SetSourceRGBA (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 SetSourceSurface (Surface source, int x, int y)
+ {
+ 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 ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
+ }
+
+ public void Rectangle (Rectangle 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 ()
+ {
+ return new Path (NativeMethods.cairo_copy_path (handle));
+ }
+
+ public Path CopyPathFlat ()
+ {
+ return 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 (x1, y1, x2 - x1, y2 - y1);
+ }
+
+ public void Fill ()
+ {
+ NativeMethods.cairo_fill (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 (x1, y1, x2 - x1, y2 - y1);
+ }
+
+ public void FillPreserve ()
+ {
+ NativeMethods.cairo_fill_preserve (handle);
+ }
+
+#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)
+ {
+ return 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)
+ {
+ return NativeMethods.cairo_in_stroke (handle, x, y);
+ }
+
+ public bool InFill (double x, double y)
+ {
+ return NativeMethods.cairo_in_fill (handle, x, y);
+ }
+
+ public Pattern PopGroup ()
+ {
+ return 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);
+ }
+
+ [Obsolete ("Use GetGroupTarget()")]
+ public Surface GroupTarget {
+ get {
+ return GetGroupTarget ();
+ }
+ }
+
+ 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 Matrix Matrix {
+ set {
+ NativeMethods.cairo_set_matrix (handle, value);
+ }
+
+ get {
+ Matrix m = new Matrix();
+ NativeMethods.cairo_get_matrix (handle, m);
+ return m;
+ }
+ }
+
+ public void SetFontSize (double scale)
+ {
+ NativeMethods.cairo_set_font_size (handle, scale);
+ }
+
+ public void IdentityMatrix ()
+ {
+ NativeMethods.cairo_identity_matrix (handle);
+ }
+
+ [Obsolete ("Use SetFontSize() instead.")]
+ public void FontSetSize (double scale)
+ {
+ SetFontSize (scale);
+ }
+
+ [Obsolete ("Use SetFontSize() instead.")]
+ public double FontSize {
+ set { SetFontSize (value); }
+ }
+
+ 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);
+ }
+
+ [Obsolete ("Use SelectFontFace() instead.")]
+ public void FontFace (string family, FontSlant slant, FontWeight weight)
+ {
+ SelectFontFace (family, slant, weight);
+ }
+
+ [Obsolete("Use GetFontFace/SetFontFace")]
+ public FontFace ContextFontFace {
+ get {
+ return GetContextFontFace ();
+ }
+ set {
+ SetContextFontFace (value);
+ }
+ }
+
+ public FontFace GetContextFontFace ()
+ {
+ return Cairo.FontFace.Lookup (NativeMethods.cairo_get_font_face (handle), false);
+ }
+
+ public void SetContextFontFace (FontFace value)
+ {
+ NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+
+ 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 ShowText(byte[] utf8)
+ {
+ NativeMethods.cairo_show_text (handle, TerminateUtf8(utf8));
+ }
+
+ 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 TextExtents TextExtents(byte[] utf8)
+ {
+ TextExtents extents;
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(utf8), out extents);
+ return 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;
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public class DRMDevice : Device
+ {
+ 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);}
+ }
+}
+
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ 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)
+ {}
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public class Device : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
+ protected Device()
+ {
+ }
+
+ protected Device (IntPtr ptr) : this (ptr, true)
+ {
+ }
+
+ protected Device (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_device_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ ~Device ()
+ {
+ Dispose (false);
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+ public string Status {
+ get {
+ return System.Runtime.InteropServices.Marshal.PtrToStringAuto(NativeMethods.cairo_status_to_string (NativeMethods.cairo_device_status (handle)));
+ }
+ }
+ public void SetThreadAware (bool value){
+ NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0);
+ }
+ public Status Acquire()
+ {
+ return NativeMethods.cairo_device_acquire (handle);
+ }
+ public void Release()
+ {
+ NativeMethods.cairo_device_release (handle);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Device> (handle, disposing);
+
+ if (!disposing || handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_device_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+ 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)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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; }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public class EGLDevice : Device
+ {
+ public EGLDevice (IntPtr dpy, IntPtr gl_ctx) : base (NativeMethods.cairo_egl_device_create (dpy, gl_ctx), true)
+ {
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Extend.cs
+//
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// 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 Cairo
+{
+ [Serializable]
+ public enum Extend
+ {
+ None,
+ Repeat,
+ Reflect,
+ Pad,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FillRule.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 Cairo
+{
+ [Serializable]
+ public enum FillRule
+ {
+ Winding,
+ EvenOdd
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Filter.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 Cairo
+{
+ [Serializable]
+ public enum Filter
+ {
+ Fast,
+ Good,
+ Best,
+ Nearest,
+ Bilinear,
+ Gaussian,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontExtents.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+//
+// This is a simplistic binding of the Cairo API to C#. All functions
+// in cairo.h are transcribed into their C# equivelants
+//
+// 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 Cairo
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct FontExtents
+ {
+ double ascent;
+ double descent;
+ double height;
+ double maxXAdvance;
+ double maxYAdvance;
+
+ public double Ascent {
+ get { return ascent; }
+ set { ascent = value; }
+ }
+
+ public double Descent {
+ get { return descent; }
+ set { descent = value; }
+ }
+
+ public double Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public double MaxXAdvance {
+ get { return maxXAdvance; }
+ set { maxXAdvance = value; }
+ }
+
+ public double MaxYAdvance {
+ get { return maxYAdvance; }
+ set { maxYAdvance = value; }
+ }
+
+ public FontExtents (double ascent, double descent, double height, double maxXAdvance, double maxYAdvance)
+ {
+ this.ascent = ascent;
+ this.descent = descent;
+ this.height = height;
+ this.maxXAdvance = maxXAdvance;
+ this.maxYAdvance = maxYAdvance;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is FontExtents)
+ return this == (FontExtents) obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) Ascent ^ (int) Descent ^ (int) Height ^ (int) MaxXAdvance ^ (int) MaxYAdvance;
+ }
+
+ public static bool operator == (FontExtents extents, FontExtents other)
+ {
+ return extents.Ascent == other.Ascent && extents.Descent == other.Descent && extents.Height == other.Height && extents.MaxXAdvance == other.MaxXAdvance && extents.MaxYAdvance == other.MaxYAdvance;
+ }
+
+ public static bool operator != (FontExtents extents, FontExtents other)
+ {
+ return !(extents == other);
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ 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); }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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;
+
+namespace Cairo
+{
+ 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); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.FontSlant.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 Cairo
+{
+ [Serializable]
+ public enum FontSlant
+ {
+ Normal,
+ Italic,
+ Oblique
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ [Serializable]
+ public enum FontType
+ {
+ Toy,
+ FreeType,
+ Win32,
+ Atsui,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.FontWeight.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 Cairo
+{
+ [Serializable]
+ public enum FontWeight
+ {
+ Normal,
+ Bold,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Format.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 Cairo
+{
+ [Serializable]
+ public enum Format
+ {
+ Argb32 = 0,
+ Rgb24 = 1,
+ A8 = 2,
+ A1 = 3,
+ Rgb16565 = 4,
+
+ //[Obsolete ("Use Argb32")]
+ ARGB32 = Argb32,
+ //[Obsolete ("Use Rgb24")]
+ RGB24 = Rgb24,
+ }
+}
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ public class GLSurface : Surface
+ {
+
+ public GLSurface (IntPtr ptr, bool own) : base (ptr, own)
+ {}
+
+ public GLSurface (Device device, Cairo.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 void SwapBuffers(){
+ NativeMethods.cairo_gl_surface_swapbuffers (this.Handle);
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public class GLXDevice : Device
+ {
+ 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); }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+ 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)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ [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);
+ }
+ }
+}
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ public class Gradient : Pattern
+ {
+ protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
+ {
+ }
+
+ [Obsolete]
+ protected Gradient ()
+ {
+ }
+
+ public int ColorStopCount {
+ get {
+ int cnt;
+ NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt);
+ return cnt;
+ }
+ }
+
+ public Status AddColorStop (double offset, Color c)
+ {
+ NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R, c.G, c.B, c.A);
+ return Status;
+ }
+
+ public Status AddColorStopRgb (double offset, Color c)
+ {
+ NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R, c.G, c.B);
+ return Status;
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo
+{
+ [Serializable]
+ public enum HintMetrics
+ {
+ Default,
+ Off,
+ On,
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ [Serializable]
+ public enum HintStyle
+ {
+ Default,
+ None,
+ Slight,
+ Medium,
+ Full,
+ }
+}
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ 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, Cairo.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 int Width {
+ get { return NativeMethods.cairo_image_surface_get_width (Handle); }
+ }
+
+ public int Height {
+ get { return 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); }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.LineCap.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 Cairo
+{
+ [Serializable]
+ public enum LineCap
+ {
+ Butt,
+ Round,
+ Square,
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.LineJoin.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 Cairo
+{
+ [Serializable]
+ public enum LineJoin
+ {
+ Miter,
+ Round,
+ Bevel
+ }
+}
+
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ 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;
+ }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ [StructLayout(LayoutKind.Sequential)]
+ public class 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 Matrix ()
+ {
+ this.InitIdentity ();
+ }
+
+ 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 Cairo.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 ();
+ }
+
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ // 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 = "libcairo-2.dll";
+#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, 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 (Cairo.Format format, int width, int height);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_image_surface_create_for_data (IntPtr data, Cairo.Format format, int width, int height, int stride);
+
+ [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);
+ #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 Crow.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 Crow.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 Crow.Rectangle extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out Crow.Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+
+ [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 Crow.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 Crow.Rectangle rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref Crow.Rectangle rectangle);
+ #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, Cairo.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, 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, Cairo.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 void cairo_show_text (IntPtr cr, byte[] utf8);
+
+ [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, Cairo.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_text_extents (IntPtr cr, 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
--- /dev/null
+//
+// Mono.Cairo.Operator.cs
+//
+// Authors: Duncan Mak (duncan@ximian.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// John Luke (john.luke@gmail.com)
+//
+// (C) Ximian, Inc. 2003
+// 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 Cairo
+{
+ [Serializable]
+ public enum Operator
+ {
+ Clear,
+ Source,
+ Over,
+ In,
+ Out,
+ Atop,
+
+ Dest,
+ DestOver,
+ DestIn,
+ DestOut,
+ DestAtop,
+
+ Xor,
+ Add,
+ Saturate,
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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);
+ }
+ }
+}
--- /dev/null
+//
+// 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;
+using Cairo;
+
+namespace Cairo {
+
+ 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;
+ }
+ }
+}
--- /dev/null
+//
+// 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 System.Collections;
+
+namespace Cairo {
+
+ public class Pattern : IDisposable
+ {
+ [Obsolete]
+ protected IntPtr pattern = IntPtr.Zero;
+
+ 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);
+ }
+ }
+
+ [Obsolete]
+ protected Pattern ()
+ {
+ }
+
+ internal Pattern (IntPtr handle, bool owned)
+ {
+ Handle = handle;
+ if (!owned)
+ NativeMethods.cairo_pattern_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ ~Pattern ()
+ {
+ Dispose (false);
+ }
+
+ [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 (pattern);
+ }
+
+ 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;
+ }
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy ()
+ {
+ Dispose ();
+ }
+
+ public Status Status
+ {
+ get { return NativeMethods.cairo_pattern_status (Handle); }
+ }
+
+ public Extend Extend
+ {
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
+ }
+
+ 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;
+ }
+ }
+
+#pragma warning disable 612
+ public IntPtr Handle {
+ get { return pattern; }
+ private set { pattern = value; }
+ }
+#pragma warning restore 612
+
+ [Obsolete]
+ public IntPtr Pointer {
+ get { return pattern; }
+ }
+
+ public PatternType PatternType {
+ get { return NativeMethods.cairo_pattern_get_type (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.PatternType.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 Cairo {
+
+ [Serializable]
+ public enum PatternType
+ {
+ Solid,
+ Surface,
+ Linear,
+ Radial,
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ 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);
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+ public struct Point
+ {
+ public Point (int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ int x, y;
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ public struct PointD
+ {
+ public PointD (double x, double y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ double x, y;
+ public double X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public double Y {
+ get { return y; }
+ set { y = value; }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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)
+ {
+ }
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.Rectangle.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;
+
+namespace Cairo
+{
+ public struct Rectangle
+ {
+ double x;
+ double y;
+ double width;
+ double height;
+
+ public Rectangle (double x, double y, double width, double height)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public Rectangle (Point point, double width, double height)
+ {
+ x = point.X;
+ y = point.Y;
+ this.width = width;
+ this.height = height;
+ }
+
+ public double X {
+ get { return x; }
+ }
+
+ public double Y {
+ get { return y; }
+ }
+
+ public double Width {
+ get { return width; }
+ }
+
+ public double Height {
+ get { return height; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is Rectangle)
+ return this == (Rectangle)obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) (x + y + width + height);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("x:{0} y:{1} w:{2} h:{3}", x, y, width, height);
+ }
+
+ public static bool operator == (Rectangle rectangle, Rectangle other)
+ {
+ return rectangle.X == other.X && rectangle.Y == other.Y && rectangle.Width == other.Width && rectangle.Height == other.Height;
+ }
+
+ public static bool operator != (Rectangle rectangle, Rectangle other)
+ {
+ return !(rectangle == other);
+ }
+ }
+}
--- /dev/null
+// 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.Runtime.InteropServices;
+
+namespace Cairo
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RectangleList {
+ public Status Status;
+ public IntPtr Rectangles;
+ public int NumRectangles;
+ }
+
+ public enum RegionOverlap {
+ In,
+ Out,
+ Part,
+ }
+
+ public class Region : IDisposable {
+
+ IntPtr handle;
+ public IntPtr Handle {
+ get { return handle; }
+ }
+
+ [Obsolete]
+ public Region (IntPtr handle) : this (handle, false) {}
+
+ 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 (Crow.Rectangle rect)
+ {
+ handle = NativeMethods.cairo_region_create_rectangle (ref rect);
+ }
+
+ public Region (RectangleList rects)
+ {
+ handle = NativeMethods.cairo_region_create_rectangles (rects.Rectangles, rects.NumRectangles);
+ }
+
+ public Region Copy ()
+ {
+ return new Region (NativeMethods.cairo_region_copy (Handle), true);
+ }
+
+ #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
+
+ public override bool Equals (object obj)
+ {
+ return (obj is Region) && NativeMethods.cairo_region_equal (Handle, (obj as Region).Handle);
+ }
+
+ public override int GetHashCode ()
+ {
+ return Handle.GetHashCode ();
+ }
+
+ public Status Status {
+ get { return NativeMethods.cairo_region_status (Handle); }
+ }
+
+ public Crow.Rectangle Extents {
+ get {
+ Crow.Rectangle result;
+ NativeMethods.cairo_region_get_extents (Handle, out result);
+ return result;
+ }
+ }
+
+ public int NumRectangles {
+ get { return NativeMethods.cairo_region_num_rectangles (Handle); }
+ }
+
+ public Crow.Rectangle GetRectangle (int nth)
+ {
+ Crow.Rectangle val;
+ NativeMethods.cairo_region_get_rectangle (Handle, nth, out val);
+ return val;
+ }
+
+ public bool IsEmpty {
+ get { return NativeMethods.cairo_region_is_empty (Handle); }
+ }
+
+ public RegionOverlap Contains (Crow.Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle);
+ }
+
+ 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 (Crow.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 (Crow.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 UnionRectangle (Crow.Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_union_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Xor (Region other)
+ {
+ return NativeMethods.cairo_region_xor (Handle, other.Handle);
+ }
+
+ public Status XorRectangle (Crow.Rectangle rectangle)
+ {
+ return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle);
+ }
+ }
+}
--- /dev/null
+//
+// 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;
+
+namespace Cairo {
+
+ 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);
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ 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);
+ }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo
+{
+ [Serializable]
+ 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,
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ [Serializable]
+ public enum SubpixelOrder
+ {
+ Default,
+ Rgb,
+ Bgr,
+ Vrgb,
+ Vbgr,
+ }
+}
--- /dev/null
+//
+// 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 System.Collections;
+
+namespace Cairo {
+
+ public class Surface : IDisposable
+ {
+ [Obsolete]
+ protected static Hashtable surfaces = new Hashtable ();
+
+ IntPtr handle = IntPtr.Zero;
+
+ [Obsolete]
+ 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 Cairo.Surface CreateForImage (
+ ref byte[] data, Cairo.Format format, int width, int height, int stride)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
+ data, format, width, height, stride);
+
+ return new Cairo.Surface (p, true);
+ }
+
+ [Obsolete ("Use an ImageSurface constructor instead.")]
+ public static Cairo.Surface CreateForImage (
+ Cairo.Format format, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create (
+ format, width, height);
+
+ return new Cairo.Surface (p, true);
+ }
+
+
+ public Cairo.Surface CreateSimilar (
+ Cairo.Content content, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_surface_create_similar (
+ this.Handle, content, width, height);
+
+ return new Cairo.Surface (p, true);
+ }
+
+ ~Surface ()
+ {
+ Dispose (false);
+ }
+
+ //[Obsolete ("Use Context.SetSource() followed by Context.Paint()")]
+ public void Show (Context gr, double x, double y)
+ {
+ NativeMethods.cairo_set_source_surface (gr.Handle, handle, x, y);
+ NativeMethods.cairo_paint (gr.Handle);
+ }
+
+ 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 Status Finish ()
+ {
+ NativeMethods.cairo_surface_finish (handle);
+ return Status;
+ }
+
+ public 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, (int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);
+ }
+
+ public IntPtr Handle {
+ get {
+ return 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); }
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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); }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ [Serializable]
+ 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
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+
+ 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);
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ [Serializable]
+ public enum SvgVersion
+ {
+ // FIXME: yuck
+ OnePointOne = 0,
+ OnePointTwo,
+ }
+}
+
--- /dev/null
+//
+// Mono.Cairo.TextExtents.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 Cairo
+{
+ [StructLayout (LayoutKind.Sequential)]
+ public struct TextExtents
+ {
+ double xbearing;
+ double ybearing;
+ double width;
+ double height;
+ double xadvance;
+ double yadvance;
+
+ public double XBearing {
+ get { return xbearing; }
+ set { xbearing = value; }
+ }
+
+ public double YBearing {
+ get { return ybearing; }
+ set { ybearing = value; }
+ }
+
+ public double Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ public double Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public double XAdvance {
+ get { return xadvance; }
+ set { xadvance = value; }
+ }
+
+ public double YAdvance {
+ get { return yadvance; }
+ set { yadvance = value; }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is TextExtents)
+ return this == (TextExtents)obj;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)XBearing ^ (int)YBearing ^ (int)Width ^ (int)Height ^ (int)XAdvance ^ (int)YAdvance;
+ }
+
+ public static bool operator == (TextExtents extents, TextExtents other)
+ {
+ return extents.XBearing == other.XBearing && extents.YBearing == other.YBearing && extents.Width == other.Width && extents.Height == other.Height && extents.XAdvance == other.XAdvance && extents.YAdvance == other.YAdvance;
+ }
+
+ public static bool operator != (TextExtents extents, TextExtents other)
+ {
+ return !(extents == other);
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo
+{
+ public class WGLDevice : Device
+ {
+ public WGLDevice (IntPtr hglrc) : base (NativeMethods.cairo_wgl_device_create (hglrc), true)
+ {
+ }
+
+ public IntPtr Context {
+ get { return NativeMethods.cairo_wgl_device_get_context (Handle); }
+ }
+ }
+}
+
--- /dev/null
+//
+// 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 Cairo {
+
+ public class Win32Surface : Surface
+ {
+ internal Win32Surface (IntPtr handle, bool owns) : base (handle, owns)
+ {
+ }
+
+ public Win32Surface (IntPtr hdc)
+ : base (NativeMethods.cairo_win32_surface_create (hdc), true)
+ {
+ }
+ }
+}
--- /dev/null
+//
+// 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 Cairo {
+ 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 void SetSize (int width, int height)
+ {
+ NativeMethods.cairo_xcb_surface_set_size (Handle, width, height);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.XlibSurface.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;
+
+namespace Cairo {
+
+ 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 void SetSize (int width, int height)
+ {
+ NativeMethods.cairo_xlib_surface_set_size (Handle, width, height);
+ }
+
+ public int Depth {
+ get { return NativeMethods.cairo_xlib_surface_get_depth (Handle); }
+ }
+
+ public IntPtr Display {
+ get { return NativeMethods.cairo_xlib_surface_get_display (Handle); }
+ }
+
+ public IntPtr Drawable {
+ get { return NativeMethods.cairo_xlib_surface_get_drawable (Handle); }
+ }
+
+ public int Height {
+ get { return NativeMethods.cairo_xlib_surface_get_height (Handle); }
+ }
+
+ public IntPtr Screen {
+ get { return NativeMethods.cairo_xlib_surface_get_screen (Handle); }
+ }
+
+ public IntPtr Visual {
+ get { return NativeMethods.cairo_xlib_surface_get_visual (Handle); }
+ }
+
+ public int Width {
+ get { return NativeMethods.cairo_xlib_surface_get_width (Handle); }
+ }
+
+ }
+}