Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo.dll.sources6
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs79
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Color.cs75
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Context.cs954
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs5
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Distance.cs58
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs36
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs22
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/GlitzSurface.cs5
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Gradient.cs21
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs57
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/LinearGradient.cs21
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Matrix.cs136
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/NativeMethods.cs89
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs13
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Path.cs39
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs136
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs7
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Point.cs57
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PointD.cs58
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/RadialGradient.cs12
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Region.cs196
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/ScaledFont.cs53
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SolidPattern.cs33
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs188
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SurfacePattern.cs23
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs7
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Win32Surface.cs6
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/XcbSurface.cs11
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs27
30 files changed, 1483 insertions, 947 deletions
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources b/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources
index e95096f73f1..880cdf2adc3 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources
+++ b/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources
@@ -3,9 +3,12 @@
../../build/common/Locale.cs
./Mono.Cairo/Antialias.cs
./Mono.Cairo/Cairo.cs
+./Mono.Cairo/CairoDebug.cs
+./Mono.Cairo/Color.cs
./Mono.Cairo/Content.cs
./Mono.Cairo/Context.cs
./Mono.Cairo/DirectFBSurface.cs
+./Mono.Cairo/Distance.cs
./Mono.Cairo/Extend.cs
./Mono.Cairo/FillRule.cs
./Mono.Cairo/Filter.cs
@@ -32,9 +35,12 @@
./Mono.Cairo/Pattern.cs
./Mono.Cairo/PatternType.cs
./Mono.Cairo/PdfSurface.cs
+./Mono.Cairo/Point.cs
+./Mono.Cairo/PointD.cs
./Mono.Cairo/PSSurface.cs
./Mono.Cairo/RadialGradient.cs
./Mono.Cairo/Rectangle.cs
+./Mono.Cairo/Region.cs
./Mono.Cairo/ScaledFont.cs
./Mono.Cairo/SolidPattern.cs
./Mono.Cairo/Status.cs
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs b/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs
new file mode 100644
index 00000000000..43b370f8b06
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/CairoDebug.cs
@@ -0,0 +1,79 @@
+//
+// 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 (!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);
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Color.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Color.cs
new file mode 100644
index 00000000000..030089e882b
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Color.cs
@@ -0,0 +1,75 @@
+//
+// 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; }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
index 5d6b7679aac..1eff46c1ec1 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
@@ -21,10 +21,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -41,117 +41,18 @@ using Cairo;
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; }
- }
- }
-
- 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; }
- }
- }
-
-
- 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; }
- }
- }
-
- 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; }
- }
-
- }
-
[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
- {
- internal IntPtr state = IntPtr.Zero;
+ public class Context : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
static int native_glyph_size, c_compiler_long_size;
-
+
static Context ()
{
//
@@ -165,7 +66,7 @@ namespace Cairo {
// is 32 bits
//
int ptr_size = Marshal.SizeOf (typeof (IntPtr));
-
+
PlatformID platform = Environment.OSVersion.Platform;
if (platform == PlatformID.Win32NT ||
platform == PlatformID.Win32S ||
@@ -179,558 +80,603 @@ namespace Cairo {
native_glyph_size = Marshal.SizeOf (typeof (Glyph));
}
}
-
- public Context (Surface surface)
- {
- state = NativeMethods.cairo_create (surface.Handle);
- }
-
- public Context (IntPtr state)
+
+ public Context (Surface surface) : this (NativeMethods.cairo_create (surface.Handle), true)
{
- this.state = state;
}
-
+
+
+ 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);
}
- void IDisposable.Dispose ()
+ public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing){
- Console.Error.WriteLine ("Cairo.Context: called from finalization thread, programmer is missing a call to Dispose");
- return;
- }
-
- if (state == IntPtr.Zero)
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Context> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
return;
- //Console.WriteLine ("Destroying");
- NativeMethods.cairo_destroy (state);
- state = IntPtr.Zero;
- }
+ NativeMethods.cairo_destroy (handle);
+ handle = IntPtr.Zero;
- public void Save ()
- {
- NativeMethods.cairo_save (state);
- }
+ }
- public void Restore ()
- {
- NativeMethods.cairo_restore (state);
- }
+ public void Save ()
+ {
+ NativeMethods.cairo_save (handle);
+ }
+
+ public void Restore ()
+ {
+ NativeMethods.cairo_restore (handle);
+ }
public Antialias Antialias {
- get { return NativeMethods.cairo_get_antialias (state); }
- set { NativeMethods.cairo_set_antialias (state, value); }
- }
-
- public Cairo.Status Status {
- get {
- return NativeMethods.cairo_status (state);
- }
- }
-
- public IntPtr Handle {
- get {
- return state;
- }
- }
-
- public Cairo.Operator Operator {
- set {
- NativeMethods.cairo_set_operator (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_operator (state);
- }
- }
-
- //FIXME: obsolete this property
- public Cairo.Color Color {
- set {
- NativeMethods.cairo_set_source_rgba (state, value.R, value.G, value.B, value.A);
- }
- }
-
- [Obsolete ("Use Color property")]
- public Cairo.Color ColorRgb {
- set {
+ 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 SetSourceRGBA method")]
+ public Color Color {
+ set {
+ NativeMethods.cairo_set_source_rgba (handle, value.R, value.G, value.B, value.A);
+ }
+ }
+
+ [Obsolete ("Use SetSourceRGBA method")]
+ public Cairo.Color ColorRgb {
+ set {
Color = new Color (value.R, value.G, value.B);
}
- }
+ }
- public double Tolerance {
+ public double Tolerance {
get {
- return NativeMethods.cairo_get_tolerance (state);
- }
-
- set {
- NativeMethods.cairo_set_tolerance (state, value);
- }
- }
-
- public Cairo.FillRule FillRule {
- set {
- NativeMethods.cairo_set_fill_rule (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_fill_rule (state);
- }
- }
-
- public double LineWidth {
- set {
- NativeMethods.cairo_set_line_width (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_width (state);
- }
- }
-
- public Cairo.LineCap LineCap {
- set {
- NativeMethods.cairo_set_line_cap (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_cap (state);
- }
- }
-
- public Cairo.LineJoin LineJoin {
- set {
- NativeMethods.cairo_set_line_join (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_join (state);
- }
- }
-
- public void SetDash (double [] dashes, double offset)
- {
- NativeMethods.cairo_set_dash (state, dashes, dashes.Length, offset);
- }
-
- public Pattern Pattern {
- set {
- NativeMethods.cairo_set_source (state, value.Pointer);
- }
-
+ 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 new Pattern (NativeMethods.cairo_get_source (state));
- }
- }
-
- public Pattern Source {
- set {
- NativeMethods.cairo_set_source (state, value.Pointer);
- }
-
+ return NativeMethods.cairo_get_fill_rule (handle);
+ }
+ }
+
+ public double LineWidth {
+ set {
+ NativeMethods.cairo_set_line_width (handle, value);
+ }
+
get {
- return Pattern.Lookup (NativeMethods.cairo_get_source (state));
- }
- }
-
- public double MiterLimit {
- set {
- NativeMethods.cairo_set_miter_limit (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_miter_limit (state);
- }
- }
-
- public PointD CurrentPoint {
- get {
- double x, y;
- NativeMethods.cairo_get_current_point (state, out x, out y);
- return new PointD (x, y);
- }
- }
-
- public Cairo.Surface Target {
- set {
- if (state != IntPtr.Zero)
- NativeMethods.cairo_destroy (state);
-
- state = NativeMethods.cairo_create (value.Handle);
- }
-
- get {
- return Cairo.Surface.LookupExternalSurface (
- NativeMethods.cairo_get_target (state));
- }
- }
-
- public Cairo.ScaledFont ScaledFont {
- set {
- NativeMethods.cairo_set_scaled_font (state, value.Handle);
- }
-
- get {
- return new ScaledFont (NativeMethods.cairo_get_scaled_font (state));
- }
- }
+ 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/GetSource")]
+ 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/GetSource")]
+ 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);
+ }
+ }
+
+ [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 (state); }
+ get { return NativeMethods.cairo_get_reference_count (handle); }
}
public void SetSourceRGB (double r, double g, double b)
{
- NativeMethods.cairo_set_source_rgb (state, r, g, 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 (state, r, g, b, 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 (state, source.Handle, x, 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 (state, source.Handle, x, y);
+ NativeMethods.cairo_set_source_surface (handle, source.Handle, x, y);
}
public void SetSource (Surface source)
{
- NativeMethods.cairo_set_source_surface (state, source.Handle, 0, 0);
+ NativeMethods.cairo_set_source_surface (handle, source.Handle, 0, 0);
}
-
+
#region Path methods
-
- public void NewPath ()
- {
- NativeMethods.cairo_new_path (state);
- }
+
+ public void NewPath ()
+ {
+ NativeMethods.cairo_new_path (handle);
+ }
public void NewSubPath ()
{
- NativeMethods.cairo_new_sub_path (state);
+ NativeMethods.cairo_new_sub_path (handle);
}
-
- public void MoveTo (PointD p)
- {
+
+ public void MoveTo (PointD p)
+ {
MoveTo (p.X, p.Y);
- }
+ }
public void MoveTo (double x, double y)
{
- NativeMethods.cairo_move_to (state, x, y);
+ NativeMethods.cairo_move_to (handle, x, y);
}
-
- public void LineTo (PointD p)
+
+ public void LineTo (PointD p)
{
LineTo (p.X, p.Y);
}
-
+
public void LineTo (double x, double y)
- {
- NativeMethods.cairo_line_to (state, x, y);
- }
+ {
+ NativeMethods.cairo_line_to (handle, x, y);
+ }
- public void CurveTo (PointD p1, PointD p2, PointD p3)
+ 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 (state, x1, y1, x2, y2, x3, y3);
- }
- public void RelMoveTo (Distance d)
+ 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 (state, dx, dy);
- }
-
- public void RelLineTo (Distance d)
- {
+
+ 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)
+ }
+
+ public void RelLineTo (double dx, double dy)
{
- NativeMethods.cairo_rel_line_to (state, dx, dy);
+ NativeMethods.cairo_rel_line_to (handle, dx, dy);
}
-
- public void RelCurveTo (Distance d1, Distance d2, Distance d3)
+
+ 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 (state, dx1, dy1, dx2, dy2, dx3, dy3);
- }
+ public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+ {
+ NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
+ }
+
+ public void Arc (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
+ }
- public void Arc (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc (state, 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 ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc_negative (state, xc, yc, radius, angle1, angle2);
- }
-
- public void Rectangle (Rectangle rectangle)
+ public void Rectangle (Rectangle rectangle)
{
Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
}
- public void Rectangle (PointD p, double width, double 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 (state, x, y, width, height);
- }
-
- public void ClosePath ()
- {
- NativeMethods.cairo_close_path (state);
- }
+ 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 ()
+ public Path CopyPath ()
{
- return new Path (NativeMethods.cairo_copy_path (state));
+ return new Path (NativeMethods.cairo_copy_path (handle));
}
public Path CopyPathFlat ()
{
- return new Path (NativeMethods.cairo_copy_path_flat (state));
+ return new Path (NativeMethods.cairo_copy_path_flat (handle));
}
public void AppendPath (Path path)
{
- NativeMethods.cairo_append_path (state, path.handle);
+ NativeMethods.cairo_append_path (handle, path.Handle);
}
-
+
#endregion
#region Painting Methods
public void Paint ()
{
- NativeMethods.cairo_paint (state);
+ NativeMethods.cairo_paint (handle);
}
-
+
public void PaintWithAlpha (double alpha)
{
- NativeMethods.cairo_paint_with_alpha (state, alpha);
+ NativeMethods.cairo_paint_with_alpha (handle, alpha);
}
-
+
public void Mask (Pattern pattern)
{
- NativeMethods.cairo_mask (state, pattern.Pointer);
+ NativeMethods.cairo_mask (handle, pattern.Handle);
}
-
+
public void MaskSurface (Surface surface, double surface_x, double surface_y)
{
- NativeMethods.cairo_mask_surface (state, surface.Handle, surface_x, 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 void Stroke ()
- {
- NativeMethods.cairo_stroke (state);
- }
-
- public void StrokePreserve ()
- {
- NativeMethods.cairo_stroke_preserve (state);
- }
public Rectangle StrokeExtents ()
{
double x1, y1, x2, y2;
- NativeMethods.cairo_stroke_extents (state, out x1, out y1, out x2, out y2);
- return new Rectangle (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 (state);
- }
+ public void Fill ()
+ {
+ NativeMethods.cairo_fill (handle);
+ }
- public Rectangle FillExtents ()
+ public Rectangle FillExtents ()
{
double x1, y1, x2, y2;
- NativeMethods.cairo_fill_extents (state, out x1, out y1, out x2, out y2);
- return new Rectangle (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 (state);
+ NativeMethods.cairo_fill_preserve (handle);
}
#endregion
- public void Clip ()
- {
- NativeMethods.cairo_clip (state);
- }
+ public void Clip ()
+ {
+ NativeMethods.cairo_clip (handle);
+ }
public void ClipPreserve ()
{
- NativeMethods.cairo_clip_preserve (state);
+ NativeMethods.cairo_clip_preserve (handle);
}
-
+
public void ResetClip ()
{
- NativeMethods.cairo_reset_clip (state);
+ NativeMethods.cairo_reset_clip (handle);
}
-
+
public bool InStroke (double x, double y)
{
- return NativeMethods.cairo_in_stroke (state, x, y);
+ return NativeMethods.cairo_in_stroke (handle, x, y);
}
public bool InFill (double x, double y)
{
- return NativeMethods.cairo_in_fill (state, x, y);
+ return NativeMethods.cairo_in_fill (handle, x, y);
}
public Pattern PopGroup ()
{
- return Pattern.Lookup (NativeMethods.cairo_pop_group (state));
+ return Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
}
public void PopGroupToSource ()
{
- NativeMethods.cairo_pop_group_to_source (state);
+ NativeMethods.cairo_pop_group_to_source (handle);
}
public void PushGroup ()
{
- NativeMethods.cairo_push_group (state);
+ NativeMethods.cairo_push_group (handle);
}
public void PushGroup (Content content)
{
- NativeMethods.cairo_push_group_with_content (state, content);
+ NativeMethods.cairo_push_group_with_content (handle, content);
}
+ [Obsolete ("Use GetGroupTarget()")]
public Surface GroupTarget {
get {
- IntPtr surface = NativeMethods.cairo_get_group_target (state);
- return Surface.LookupSurface (surface);
+ return GetGroupTarget ();
}
}
- public void Rotate (double angle)
- {
- NativeMethods.cairo_rotate (state, angle);
- }
+ public Surface GetGroupTarget ()
+ {
+ IntPtr surface = NativeMethods.cairo_get_group_target (handle);
+ return Surface.Lookup (surface, false);
+ }
- public void Scale (double sx, double sy)
- {
- NativeMethods.cairo_scale (state, sx, sy);
- }
+ 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 Translate (double tx, double ty)
- {
- NativeMethods.cairo_translate (state, tx, ty);
- }
-
public void Transform (Matrix m)
{
- NativeMethods.cairo_transform (state, m);
+ NativeMethods.cairo_transform (handle, m);
}
-
-#region Methods that will become obsolete in the long term, after 1.2.5 becomes wildly available
-
- //[Obsolete("Use UserToDevice instead")]
+
+ [Obsolete("Use UserToDevice instead")]
public void TransformPoint (ref double x, ref double y)
{
- NativeMethods.cairo_user_to_device (state, ref x, ref y);
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
}
-
- //[Obsolete("Use UserToDeviceDistance instead")]
- public void TransformDistance (ref double dx, ref double dy)
+
+ [Obsolete("Use UserToDeviceDistance instead")]
+ public void TransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_user_to_device_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
}
-
- //[Obsolete("Use InverseTransformPoint instead")]
+
+ [Obsolete("Use InverseTransformPoint instead")]
public void InverseTransformPoint (ref double x, ref double y)
{
- NativeMethods.cairo_device_to_user (state, ref x, ref y);
+ NativeMethods.cairo_device_to_user (handle, ref x, ref y);
}
- //[Obsolete("Use DeviceToUserDistance instead")]
+ [Obsolete("Use DeviceToUserDistance instead")]
public void InverseTransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_device_to_user_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
}
-#endregion
-
+
public void UserToDevice (ref double x, ref double y)
{
- NativeMethods.cairo_user_to_device (state, ref x, ref y);
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
}
-
- public void UserToDeviceDistance (ref double dx, ref double dy)
+
+ public void UserToDeviceDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_user_to_device_distance (state, ref dx, ref 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 (state, ref x, ref 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 (state, ref dx, ref dy);
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
}
-
- public Cairo.Matrix Matrix {
- set {
- NativeMethods.cairo_set_matrix (state, value);
- }
- get {
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_set_matrix (handle, value);
+ }
+
+ get {
Matrix m = new Matrix();
- NativeMethods.cairo_get_matrix (state, m);
- return m;
- }
- }
+ NativeMethods.cairo_get_matrix (handle, m);
+ return m;
+ }
+ }
public void SetFontSize (double scale)
{
- NativeMethods.cairo_set_font_size (state, scale);
+ NativeMethods.cairo_set_font_size (handle, scale);
}
public void IdentityMatrix ()
{
- NativeMethods.cairo_identity_matrix (state);
+ NativeMethods.cairo_identity_matrix (handle);
}
-
+
[Obsolete ("Use SetFontSize() instead.")]
public void FontSetSize (double scale)
{
@@ -741,23 +687,23 @@ namespace Cairo {
public double FontSize {
set { SetFontSize (value); }
}
-
+
public Matrix FontMatrix {
get {
Matrix m;
- NativeMethods.cairo_get_font_matrix (state, out m);
+ NativeMethods.cairo_get_font_matrix (handle, out m);
return m;
}
- set { NativeMethods.cairo_set_font_matrix (state, value); }
+ set { NativeMethods.cairo_set_font_matrix (handle, value); }
}
public FontOptions FontOptions {
get {
FontOptions options = new FontOptions ();
- NativeMethods.cairo_get_font_options (state, options.Handle);
+ NativeMethods.cairo_get_font_options (handle, options.Handle);
return options;
}
- set { NativeMethods.cairo_set_font_options (state, value.Handle); }
+ set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
}
[StructLayout(LayoutKind.Sequential)]
@@ -787,7 +733,7 @@ namespace Cairo {
} 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;
}
@@ -796,52 +742,52 @@ namespace Cairo {
return dest;
}
- public void ShowGlyphs (Glyph[] glyphs)
+ public void ShowGlyphs (Glyph[] glyphs)
{
- IntPtr ptr;
+ IntPtr ptr;
- ptr = FromGlyphToUnManagedMemory (glyphs);
-
- NativeMethods.cairo_show_glyphs (state, ptr, glyphs.Length);
+ ptr = FromGlyphToUnManagedMemory (glyphs);
- Marshal.FreeHGlobal (ptr);
+ 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)
- {
+ 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)
- {
+ public void GlyphPath (Matrix matrix, Glyph[] glyphs)
+ {
GlyphPath (glyphs);
}
public void GlyphPath (Glyph[] glyphs)
{
- IntPtr ptr;
+ IntPtr ptr;
+
+ ptr = FromGlyphToUnManagedMemory (glyphs);
- ptr = FromGlyphToUnManagedMemory (glyphs);
+ NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
- NativeMethods.cairo_glyph_path (state, ptr, glyphs.Length);
+ Marshal.FreeHGlobal (ptr);
- Marshal.FreeHGlobal (ptr);
+ }
- }
+ public FontExtents FontExtents {
+ get {
+ FontExtents f_extents;
+ NativeMethods.cairo_font_extents (handle, out f_extents);
+ return f_extents;
+ }
+ }
- public FontExtents FontExtents {
- get {
- FontExtents f_extents;
- NativeMethods.cairo_font_extents (state, out f_extents);
- return f_extents;
- }
- }
-
public void CopyPage ()
{
- NativeMethods.cairo_copy_page (state);
+ NativeMethods.cairo_copy_page (handle);
}
[Obsolete ("Use SelectFontFace() instead.")]
@@ -850,24 +796,34 @@ namespace Cairo {
SelectFontFace (family, slant, weight);
}
+ [Obsolete("Use GetFontFace/SetFontFace")]
public FontFace ContextFontFace {
get {
- return Cairo.FontFace.Lookup (NativeMethods.cairo_get_font_face (state));
+ return GetContextFontFace ();
}
-
set {
- NativeMethods.cairo_set_font_face (state, value == null ? IntPtr.Zero : value.Handle);
+ 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 (state, family, slant, weight);
+ NativeMethods.cairo_select_font_face (handle, family, slant, weight);
}
public void ShowPage ()
{
- NativeMethods.cairo_show_page (state);
+ NativeMethods.cairo_show_page (handle);
}
private static byte[] TerminateUtf8(byte[] utf8)
@@ -891,35 +847,35 @@ namespace Cairo {
public void ShowText(string str)
{
- NativeMethods.cairo_show_text(state, TerminateUtf8(str));
+ NativeMethods.cairo_show_text (handle, TerminateUtf8(str));
}
public void ShowText(byte[] utf8)
{
- NativeMethods.cairo_show_text(state, TerminateUtf8(utf8));
+ NativeMethods.cairo_show_text (handle, TerminateUtf8(utf8));
}
public void TextPath(string str)
{
- NativeMethods.cairo_text_path(state, TerminateUtf8(str));
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
}
public void TextPath(byte[] utf8)
{
- NativeMethods.cairo_text_path(state, TerminateUtf8(utf8));
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
}
public TextExtents TextExtents(string s)
{
TextExtents extents;
- NativeMethods.cairo_text_extents(state, TerminateUtf8(s), out extents);
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
return extents;
}
public TextExtents TextExtents(byte[] utf8)
{
TextExtents extents;
- NativeMethods.cairo_text_extents(state, TerminateUtf8(utf8), out extents);
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(utf8), out extents);
return extents;
}
@@ -929,11 +885,11 @@ namespace Cairo {
TextExtents extents;
- NativeMethods.cairo_glyph_extents (state, ptr, glyphs.Length, out extents);
+ NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
Marshal.FreeHGlobal (ptr);
return extents;
}
- }
+ }
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
index a2ae169e732..afa57b7dff1 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
@@ -36,11 +36,8 @@ namespace Cairo {
}
public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
+ : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
{
- surface = NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Distance.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Distance.cs
new file mode 100644
index 00000000000..7cba3729cea
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Distance.cs
@@ -0,0 +1,58 @@
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace 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; }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs b/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
index efa479b6d52..19d8163c35f 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
@@ -38,42 +38,48 @@ namespace Cairo
{
IntPtr handle;
- internal static FontFace Lookup (IntPtr handle)
+ internal static FontFace Lookup (IntPtr handle, bool owner)
{
if (handle == IntPtr.Zero)
return null;
-
- NativeMethods.cairo_font_face_reference (handle);
-
- return new FontFace (handle);
+ return new FontFace (handle, owner);
}
~FontFace ()
{
- // Since Cairo is not thread safe, we can not unref the
- // font_face here, the programmer must do this with Dispose
-
- Console.Error.WriteLine ("Programmer forgot to call Dispose on the FontFace");
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
+ GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
- if (disposing)
- NativeMethods.cairo_font_face_destroy (handle);
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<FontFace> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_font_face_destroy (handle);
handle = IntPtr.Zero;
- GC.SuppressFinalize (this);
}
-
- // TODO: make non-public when all entry points are complete in binding
- public FontFace (IntPtr handle)
+
+ [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 {
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs b/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs
index 476910f1b1d..e6770307518 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs
@@ -33,11 +33,9 @@ namespace Cairo
public class FontOptions : IDisposable
{
IntPtr handle;
- bool disposed;
- public FontOptions ()
+ public FontOptions () : this (NativeMethods.cairo_font_options_create ())
{
- handle = NativeMethods.cairo_font_options_create ();
}
~FontOptions ()
@@ -48,6 +46,8 @@ namespace Cairo
internal FontOptions (IntPtr handle)
{
this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
public FontOptions Copy ()
@@ -55,6 +55,7 @@ namespace Cairo
return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
}
+ [Obsolete ("Use Dispose()")]
public void Destroy ()
{
NativeMethods.cairo_font_options_destroy (handle);
@@ -66,13 +67,16 @@ namespace Cairo
GC.SuppressFinalize (this);
}
- private void Dispose (bool disposing)
+ protected virtual void Dispose (bool disposing)
{
- if (!disposed) {
- Destroy ();
- handle = IntPtr.Zero;
- }
- disposed = true;
+ 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)
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/GlitzSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/GlitzSurface.cs
index a8cd700a532..6da1ac6a934 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/GlitzSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/GlitzSurface.cs
@@ -36,11 +36,8 @@ namespace Cairo {
}
public GlitzSurface (IntPtr glitz_surface)
+ : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
{
- surface = NativeMethods.cairo_glitz_surface_create (glitz_surface);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Gradient.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Gradient.cs
index c15980b071c..0fb617e421f 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Gradient.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Gradient.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.Gradient.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -14,10 +14,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,13 +30,14 @@
using System;
namespace Cairo {
-
+
public class Gradient : Pattern
{
- protected Gradient (IntPtr handle) : base (handle)
+ protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
{
}
+ [Obsolete]
protected Gradient ()
{
}
@@ -44,20 +45,20 @@ namespace Cairo {
public int ColorStopCount {
get {
int cnt;
- NativeMethods.cairo_pattern_get_color_stop_count (pattern, out cnt);
+ NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt);
return cnt;
}
}
- public Status AddColorStop (double offset, Cairo.Color c)
+ public Status AddColorStop (double offset, Color c)
{
- NativeMethods.cairo_pattern_add_color_stop_rgba (pattern, offset, c.R, c.G, c.B, c.A);
+ NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R, c.G, c.B, c.A);
return Status;
}
- public Status AddColorStopRgb (double offset, Cairo.Color c)
+ public Status AddColorStopRgb (double offset, Color c)
{
- NativeMethods.cairo_pattern_add_color_stop_rgb (pattern, offset, c.R, c.G, c.B);
+ NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R, c.G, c.B);
return Status;
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
index 659833a7cc4..98143fe8e22 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
@@ -19,10 +19,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -37,60 +37,49 @@ using System.Runtime.InteropServices;
namespace Cairo {
- public class ImageSurface : Surface
- {
+ 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)
{
- surface = NativeMethods.cairo_image_surface_create (format, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
[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 (ref byte[] data, Cairo.Format format, int width, int height, int stride)
+ : this (data, format, width, height, stride)
{
}
- public ImageSurface (byte[] data, Cairo.Format format, int width, int height, int 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)
{
- surface = NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
- public ImageSurface (IntPtr data, Cairo.Format format, int width, int height, int stride)
+ 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)
{
- surface = NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
public ImageSurface (string filename)
+ : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
{
- surface = NativeMethods.cairo_image_surface_create_from_png (filename);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
public int Width {
- get { return NativeMethods.cairo_image_surface_get_width (surface); }
+ get { return NativeMethods.cairo_image_surface_get_width (Handle); }
}
-
+
public int Height {
- get { return NativeMethods.cairo_image_surface_get_height (surface); }
+ get { return NativeMethods.cairo_image_surface_get_height (Handle); }
}
-
+
public byte[] Data {
get {
- IntPtr ptr = NativeMethods.cairo_image_surface_get_data (surface);
+ IntPtr ptr = NativeMethods.cairo_image_surface_get_data (Handle);
int length = Height * Stride;
byte[] data = new byte[length];
Marshal.Copy (ptr, data, 0, length);
@@ -100,16 +89,16 @@ namespace Cairo {
public IntPtr DataPtr {
get {
- return NativeMethods.cairo_image_surface_get_data (surface);
+ return NativeMethods.cairo_image_surface_get_data (Handle);
}
}
public Format Format {
- get { return NativeMethods.cairo_image_surface_get_format (surface); }
+ get { return NativeMethods.cairo_image_surface_get_format (Handle); }
}
public int Stride {
- get { return NativeMethods.cairo_image_surface_get_stride (surface); }
+ get { return NativeMethods.cairo_image_surface_get_stride (Handle); }
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/LinearGradient.cs b/mcs/class/Mono.Cairo/Mono.Cairo/LinearGradient.cs
index 58d8e21ab8a..85fdea84a2c 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/LinearGradient.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/LinearGradient.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.LinearGradient.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -14,10 +14,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,31 +30,30 @@
using System;
namespace Cairo {
-
+
public class LinearGradient : Gradient
{
- internal LinearGradient (IntPtr handle) : base (handle)
+ 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)
{
- pattern = NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1);
}
public PointD[] LinearPoints {
- get {
+ get {
double x0, y0, x1, y1;
PointD[] points = new PointD [2];
- NativeMethods.cairo_pattern_get_linear_points (pattern, out x0, out y0, out x1, out y1);
+ NativeMethods.cairo_pattern_get_linear_points (Handle, out x0, out y0, out x1, out y1);
points[0] = new PointD (x0, y0);
points[1] = new PointD (x1, y1);
return points;
- }
- }
-
+ }
+ }
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Matrix.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Matrix.cs
index 79e1f359e1d..83ffce49d2b 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Matrix.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Matrix.cs
@@ -18,10 +18,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -36,110 +36,110 @@ using System.Runtime.InteropServices;
namespace Cairo {
- [StructLayout(LayoutKind.Sequential)]
- public class Matrix : ICloneable
- {
+ [StructLayout(LayoutKind.Sequential)]
+ public class Matrix : ICloneable
+ {
public double Xx;
public double Yx;
- public double Xy;
+ public double Xy;
public double Yy;
- public double X0;
+ 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 ()
+
+ 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 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)
- {
+
+ 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_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)
- {
+ }
+
+ 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 ()
- {
+ 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)
+
+
+ public void TransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref 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 void TransformPoint (ref double x, ref double y)
+ {
+ NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
}
public override String ToString ()
@@ -148,7 +148,7 @@ namespace Cairo {
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 &&
@@ -158,14 +158,14 @@ namespace Cairo {
lhs.X0 == rhs.X0 &&
lhs.Y0 == rhs.Y0 );
}
-
+
public static bool operator != (Matrix lhs, Matrix rhs)
{
- return !(lhs==rhs);
+ return !(lhs==rhs);
}
-
-
-
+
+
+
public override bool Equals(object o)
{
if (! (o is Matrix))
@@ -173,7 +173,7 @@ namespace Cairo {
else
return (this == (Matrix) o);
}
-
+
public override int GetHashCode()
{
return (int)this.Xx ^ (int)this.Xx>>32 ^
@@ -183,11 +183,11 @@ namespace Cairo {
(int)this.X0 ^ (int)this.X0>>32 ^
(int)this.Y0 ^ (int)this.Y0>>32;
}
-
+
public object Clone()
{
return this.MemberwiseClone ();
}
-
- }
+
+ }
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/NativeMethods.cs b/mcs/class/Mono.Cairo/Mono.Cairo/NativeMethods.cs
index 855c282f6aa..c53f0009c00 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/NativeMethods.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/NativeMethods.cs
@@ -36,8 +36,8 @@ using System.Runtime.InteropServices;
namespace Cairo
{
- // sort these so it is easier to find what is missing
- // http://www.cairographics.org/manual/ix01.html
+ // 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
{
@@ -87,9 +87,6 @@ namespace Cairo
internal static extern IntPtr cairo_create (IntPtr target);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_get_reference_count (IntPtr surface);
-
- [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)]
@@ -241,6 +238,9 @@ namespace Cairo
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)]
@@ -293,9 +293,6 @@ namespace Cairo
internal static extern int cairo_image_surface_get_width (IntPtr surface);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.U1)]
internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
@@ -453,10 +450,10 @@ namespace Cairo
//[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_begin_page_setup (IntPtr surface);
+ 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_begin_setup (IntPtr surface);
+ 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);
@@ -486,6 +483,75 @@ namespace Cairo
internal static extern void cairo_reference (IntPtr cr);
[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 RectangleInt 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 RectangleInt rect);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create_rectangles (RectangleInt[] 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 RectangleInt extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out RectangleInt 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 RectangleInt 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 RectangleInt 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 RectangleInt 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 RectangleInt rectangle);
+
+ [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)]
@@ -668,6 +734,9 @@ namespace Cairo
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)]
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
index 1304be6230a..9d6b73be689 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
@@ -37,31 +37,28 @@ namespace Cairo {
}
public PSSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_ps_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void BeginPageSetup ()
{
- NativeMethods.cairo_ps_surface_begin_page_setup (surface);
+ NativeMethods.cairo_ps_surface_dsc_begin_page_setup (Handle);
}
public void BeginSetup ()
{
- NativeMethods.cairo_ps_surface_begin_setup (surface);
+ NativeMethods.cairo_ps_surface_dsc_begin_setup (Handle);
}
public void DscComment (string comment)
{
- NativeMethods.cairo_ps_surface_dsc_comment (surface, comment);
+ NativeMethods.cairo_ps_surface_dsc_comment (Handle, comment);
}
public void SetSize (double width, double height)
{
- NativeMethods.cairo_ps_surface_set_size (surface, width, height);
+ NativeMethods.cairo_ps_surface_set_size (Handle, width, height);
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Path.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Path.cs
index 97cfb8e2862..184c606cf34 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Path.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Path.cs
@@ -15,10 +15,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -34,13 +34,15 @@ using Cairo;
namespace Cairo {
- public class Path : IDisposable
- {
- internal IntPtr handle = IntPtr.Zero;
-
+ public class Path : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
internal Path (IntPtr handle)
{
this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
~Path ()
@@ -48,25 +50,24 @@ namespace Cairo {
Dispose (false);
}
-
+ public IntPtr Handle { get { return handle; } }
+
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing){
- Console.Error.WriteLine ("Cairo.Context: called from finalization thread, programmer is missing a call to Dispose");
- return;
- }
-
- if (handle == IntPtr.Zero)
+
+ 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);
+ NativeMethods.cairo_path_destroy (handle);
handle = IntPtr.Zero;
- }
- }
+ }
+ }
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
index ebe4b70eaf5..813f1f85a1e 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -32,116 +32,124 @@ using System.Collections;
namespace Cairo {
- public class Pattern : IDisposable
- {
- protected IntPtr pattern = IntPtr.Zero;
+ public class Pattern : IDisposable
+ {
+ [Obsolete]
+ protected IntPtr pattern = IntPtr.Zero;
- internal static Pattern Lookup (IntPtr pattern)
+ public static Pattern Lookup (IntPtr pattern, bool owner)
{
if (pattern == IntPtr.Zero)
return null;
-
- object x = patterns [pattern];
- if (x != null)
- return (Pattern) x;
PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
switch (pt) {
case PatternType.Solid:
- return new SolidPattern (pattern);
+ return new SolidPattern (pattern, owner);
case PatternType.Surface:
- return new SurfacePattern (pattern);
+ return new SurfacePattern (pattern, owner);
case PatternType.Linear:
- return new LinearGradient (pattern);
+ return new LinearGradient (pattern, owner);
case PatternType.Radial:
- return new RadialGradient (pattern);
+ return new RadialGradient (pattern, owner);
default:
- return new Pattern (pattern);
+ return new Pattern (pattern, owner);
}
}
-
- protected Pattern ()
- {
- }
- static Hashtable patterns = new Hashtable ();
+ [Obsolete]
+ protected Pattern ()
+ {
+ }
- internal Pattern (IntPtr ptr)
+ internal Pattern (IntPtr handle, bool owned)
{
- lock (patterns){
- patterns [ptr] = this;
- }
- pattern = ptr;
+ 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)
- {
- pattern = NativeMethods.cairo_pattern_create_for_surface (surface.Handle);
- }
+ [Obsolete ("Use the SurfacePattern constructor")]
+ public Pattern (Surface surface)
+ : this ( NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
+ {
+ }
- protected void Reference ()
- {
- NativeMethods.cairo_pattern_reference (pattern);
- }
+ [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)
- Destroy ();
- GC.SuppressFinalize (this);
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Pattern> (Handle, disposing);
+
+ if (!disposing|| Handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_pattern_destroy (Handle);
+ Handle = IntPtr.Zero;
}
-
- public void Destroy ()
- {
- if (pattern != IntPtr.Zero){
- NativeMethods.cairo_pattern_destroy (pattern);
- pattern = IntPtr.Zero;
- }
- lock (patterns){
- patterns.Remove (this);
- }
- }
-
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy ()
+ {
+ NativeMethods.cairo_pattern_destroy (pattern);
+ }
+
public Status Status
{
- get { return NativeMethods.cairo_pattern_status (pattern); }
+ get { return NativeMethods.cairo_pattern_status (Handle); }
}
public Extend Extend
{
- get { return NativeMethods.cairo_pattern_get_extend (pattern); }
- set { NativeMethods.cairo_pattern_set_extend (pattern, value); }
+ 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 (pattern, value);
+
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_pattern_set_matrix (Handle, value);
}
- get {
+ get {
Matrix m = new Matrix ();
- NativeMethods.cairo_pattern_get_matrix (pattern, m);
+ NativeMethods.cairo_pattern_get_matrix (Handle, m);
return m;
- }
- }
+ }
+ }
- public IntPtr Pointer {
- get { return pattern; }
- }
+#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 (pattern); }
+ get { return NativeMethods.cairo_pattern_get_type (Handle); }
}
- }
+ }
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
index f3a184bb5a7..c980f249ed0 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
@@ -37,16 +37,13 @@ namespace Cairo {
}
public PdfSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_pdf_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void SetSize (double width, double height)
{
- NativeMethods.cairo_pdf_surface_set_size (surface, width, height);
+ NativeMethods.cairo_pdf_surface_set_size (Handle, width, height);
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Point.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Point.cs
new file mode 100644
index 00000000000..e72ca6c529c
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Point.cs
@@ -0,0 +1,57 @@
+//
+// 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; }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PointD.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PointD.cs
new file mode 100644
index 00000000000..c2e3587d1f7
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PointD.cs
@@ -0,0 +1,58 @@
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace 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; }
+ }
+ }
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/RadialGradient.cs b/mcs/class/Mono.Cairo/Mono.Cairo/RadialGradient.cs
index df9c329057d..6422e00d6e4 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/RadialGradient.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/RadialGradient.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -14,10 +14,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,16 +30,16 @@
using System;
namespace Cairo {
-
+
public class RadialGradient : Gradient
{
- internal RadialGradient (IntPtr handle) : base (handle)
+ 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)
{
- pattern = NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1);
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Region.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Region.cs
new file mode 100644
index 00000000000..cd0ba33fde2
--- /dev/null
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Region.cs
@@ -0,0 +1,196 @@
+// 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 RectangleInt {
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+ }
+
+ 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 (RectangleInt rect)
+ {
+ handle = NativeMethods.cairo_region_create_rectangle (ref rect);
+ }
+
+ public Region (RectangleInt[] rects)
+ {
+ handle = NativeMethods.cairo_region_create_rectangles (rects, rects.Length);
+ }
+
+ public Region Copy ()
+ {
+ return new Region (NativeMethods.cairo_region_copy (Handle), true);
+ }
+
+ ~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;
+ }
+
+ 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 RectangleInt Extents {
+ get {
+ RectangleInt result;
+ NativeMethods.cairo_region_get_extents (Handle, out result);
+ return result;
+ }
+ }
+
+ public int NumRectangles {
+ get { return NativeMethods.cairo_region_num_rectangles (Handle); }
+ }
+
+ public RectangleInt GetRectangle (int nth)
+ {
+ RectangleInt 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 ContainsPoint (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle);
+ }
+
+ public bool ContainsPoint (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 (RectangleInt 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 (RectangleInt 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 (RectangleInt 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 (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle);
+ }
+ }
+}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/ScaledFont.cs b/mcs/class/Mono.Cairo/Mono.Cairo/ScaledFont.cs
index 2b0f6cf0c5f..937194607af 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/ScaledFont.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/ScaledFont.cs
@@ -32,14 +32,18 @@ namespace Cairo {
{
protected IntPtr handle = IntPtr.Zero;
- internal ScaledFont (IntPtr handle)
+ 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)
{
- handle = NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle);
}
~ScaledFont ()
@@ -47,19 +51,19 @@ namespace Cairo {
Dispose (false);
}
- public IntPtr Handle {
- get {
- return handle;
- }
- }
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
public FontExtents FontExtents {
- get {
- FontExtents extents;
- NativeMethods.cairo_scaled_font_extents (handle, out extents);
- return extents;
- }
- }
+ get {
+ FontExtents extents;
+ NativeMethods.cairo_scaled_font_extents (handle, out extents);
+ return extents;
+ }
+ }
public Matrix FontMatrix {
get {
@@ -99,16 +103,21 @@ namespace Cairo {
protected virtual void Dispose (bool disposing)
{
- if (disposing) {
- NativeMethods.cairo_scaled_font_destroy (handle);
- handle = IntPtr.Zero;
- }
+ 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);
}
-
- protected void Reference ()
- {
- NativeMethods.cairo_scaled_font_reference (handle);
- }
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SolidPattern.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SolidPattern.cs
index 44dba86a97d..875b3fbf155 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SolidPattern.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SolidPattern.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -14,10 +14,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,44 +30,43 @@
using System;
namespace Cairo {
-
+
public class SolidPattern : Pattern
{
- internal SolidPattern (IntPtr handle) : base (handle)
+ 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)
{
- pattern = NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A);
}
public SolidPattern (double r, double g, double b)
+ : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
{
- pattern = NativeMethods.cairo_pattern_create_rgb (r, g, b);
}
public SolidPattern (double r, double g, double b, double a)
+ : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
{
- NativeMethods.cairo_pattern_create_rgba (r, g, b, a);
}
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)
{
- if (solid)
- pattern = NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B);
- else
- pattern = NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A);
}
public Color Color {
- get {
+ get {
double red, green, blue, alpha;
-
- NativeMethods.cairo_pattern_get_rgba (pattern, out red, out green, out blue, out alpha);
+ NativeMethods.cairo_pattern_get_rgba (Handle, out red, out green, out blue, out alpha);
return new Color (red, green, blue, alpha);
- }
- }
+ }
+ }
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
index 862cbdc606d..dbaf701f46f 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
@@ -20,10 +20,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -38,94 +38,88 @@ using System.Collections;
namespace Cairo {
- public class Surface : IDisposable
- {
+ public class Surface : IDisposable
+ {
+ [Obsolete]
protected static Hashtable surfaces = new Hashtable ();
- internal IntPtr surface = IntPtr.Zero;
+ IntPtr handle = IntPtr.Zero;
+
+ [Obsolete]
protected Surface()
{
}
-
- protected Surface (IntPtr ptr, bool owns)
- {
- surface = ptr;
- lock (surfaces.SyncRoot){
- surfaces [ptr] = this;
- }
- if (!owns)
- NativeMethods.cairo_surface_reference (ptr);
- }
-
- static internal Surface LookupExternalSurface (IntPtr p)
- {
- lock (surfaces.SyncRoot){
- object o = surfaces [p];
- if (o == null){
- return new Surface (p, false);
- }
- return (Surface) o;
- }
- }
- static internal Surface LookupSurface (IntPtr 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, true);
+ return new ImageSurface (surface, owned);
case SurfaceType.Xlib:
- return new XlibSurface (surface, true);
+ return new XlibSurface (surface, owned);
case SurfaceType.Xcb:
- return new XcbSurface (surface, true);
+ return new XcbSurface (surface, owned);
case SurfaceType.Glitz:
- return new GlitzSurface (surface, true);
+ return new GlitzSurface (surface, owned);
case SurfaceType.Win32:
- return new Win32Surface (surface, true);
-
+ return new Win32Surface (surface, owned);
case SurfaceType.Pdf:
- return new PdfSurface (surface, true);
+ return new PdfSurface (surface, owned);
case SurfaceType.PS:
- return new PSSurface (surface, true);
+ return new PSSurface (surface, owned);
case SurfaceType.DirectFB:
- return new DirectFBSurface (surface, true);
+ return new DirectFBSurface (surface, owned);
case SurfaceType.Svg:
- return new SvgSurface (surface, true);
-
+ return new SvgSurface (surface, owned);
default:
- return Surface.LookupExternalSurface (surface);
+ 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);
- }
+ 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);
+ 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);
- }
+ 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);
+ 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);
- }
+ return new Cairo.Surface (p, true);
+ }
~Surface ()
{
@@ -133,9 +127,9 @@ namespace Cairo {
}
//[Obsolete ("Use Context.SetSource() followed by Context.Paint()")]
- public void Show (Context gr, double x, double y)
+ public void Show (Context gr, double x, double y)
{
- NativeMethods.cairo_set_source_surface (gr.Handle, surface, x, y);
+ NativeMethods.cairo_set_source_surface (gr.Handle, handle, x, y);
NativeMethods.cairo_paint (gr.Handle);
}
@@ -147,55 +141,55 @@ namespace Cairo {
protected virtual void Dispose (bool disposing)
{
- if (surface == IntPtr.Zero)
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Surface> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
return;
-
- lock (surfaces.SyncRoot)
- surfaces.Remove (surface);
- NativeMethods.cairo_surface_destroy (surface);
- surface = IntPtr.Zero;
+ NativeMethods.cairo_surface_destroy (handle);
+ handle = IntPtr.Zero;
}
-
+
public Status Finish ()
{
- NativeMethods.cairo_surface_finish (surface);
+ NativeMethods.cairo_surface_finish (handle);
return Status;
}
-
+
public void Flush ()
{
- NativeMethods.cairo_surface_flush (surface);
+ 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 surface;
+
+ public IntPtr Handle {
+ get {
+ return handle;
}
- }
+ }
public PointD DeviceOffset {
get {
double x, y;
- NativeMethods.cairo_surface_get_device_offset (surface, out x, out y);
+ NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
return new PointD (x, y);
}
set {
- NativeMethods.cairo_surface_set_device_offset (surface, value.X, value.Y);
+ NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
}
}
-
+
public void Destroy()
{
Dispose (true);
@@ -203,35 +197,35 @@ namespace Cairo {
public void SetFallbackResolution (double x, double y)
{
- NativeMethods.cairo_surface_set_fallback_resolution (surface, x, y);
+ NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
}
public void WriteToPng (string filename)
{
- NativeMethods.cairo_surface_write_to_png (surface, filename);
+ NativeMethods.cairo_surface_write_to_png (handle, filename);
}
-
+
[Obsolete ("Use Handle instead.")]
- public IntPtr Pointer {
- get {
- return surface;
+ public IntPtr Pointer {
+ get {
+ return handle;
}
- }
-
+ }
+
public Status Status {
- get { return NativeMethods.cairo_surface_status (surface); }
+ get { return NativeMethods.cairo_surface_status (handle); }
}
public Content Content {
- get { return NativeMethods.cairo_surface_get_content (surface); }
+ get { return NativeMethods.cairo_surface_get_content (handle); }
}
public SurfaceType SurfaceType {
- get { return NativeMethods.cairo_surface_get_type (surface); }
+ get { return NativeMethods.cairo_surface_get_type (handle); }
}
public uint ReferenceCount {
- get { return NativeMethods.cairo_surface_get_reference_count (surface); }
+ get { return NativeMethods.cairo_surface_get_reference_count (handle); }
}
- }
+ }
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SurfacePattern.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SurfacePattern.cs
index f4f4298c549..4422b11d41d 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SurfacePattern.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SurfacePattern.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
@@ -14,10 +14,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,26 +30,27 @@
using System;
namespace Cairo {
-
+
public class SurfacePattern : Pattern
{
- internal SurfacePattern (IntPtr handle) : base (handle)
+ internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
{
}
public SurfacePattern (Surface surface)
+ : base (NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
{
- pattern = NativeMethods.cairo_pattern_create_for_surface (surface.Handle);
}
- public Extend Extend {
- set { NativeMethods.cairo_pattern_set_extend (pattern, value); }
- get { return NativeMethods.cairo_pattern_get_extend (pattern); }
+ //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 (pattern, value); }
- get { return NativeMethods.cairo_pattern_get_filter (pattern); }
+ set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_filter (Handle); }
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
index 10da981e0ee..418295011fd 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
@@ -37,16 +37,13 @@ namespace Cairo {
}
public SvgSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_svg_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void RestrictToVersion (SvgVersion version)
{
- NativeMethods.cairo_svg_surface_restrict_to_version (surface, version);
+ NativeMethods.cairo_svg_surface_restrict_to_version (Handle, version);
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Win32Surface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Win32Surface.cs
index fbb22270aca..dd244286dff 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Win32Surface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Win32Surface.cs
@@ -37,12 +37,8 @@ namespace Cairo {
}
public Win32Surface (IntPtr hdc)
+ : base (NativeMethods.cairo_win32_surface_create (hdc), true)
{
- surface = NativeMethods.cairo_win32_surface_create (hdc);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
-
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/XcbSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/XcbSurface.cs
index 97f5f2f6f79..142ebf9e31a 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/XcbSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/XcbSurface.cs
@@ -36,24 +36,19 @@ namespace Cairo {
}
public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
+ : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
{
- surface = NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
{
- IntPtr ptr;
-
- ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, 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 (surface, width, height);
+ NativeMethods.cairo_xcb_surface_set_size (Handle, width, height);
}
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
index ef010feea59..c0003a491e6 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
@@ -39,11 +39,8 @@ 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)
{
- surface = NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
@@ -52,48 +49,46 @@ namespace Cairo {
public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
{
- IntPtr ptr;
-
- ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, 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 (surface, drawable, width, height);
+ NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height);
}
public void SetSize (int width, int height)
{
- NativeMethods.cairo_xlib_surface_set_size (surface, width, height);
+ NativeMethods.cairo_xlib_surface_set_size (Handle, width, height);
}
public int Depth {
- get { return NativeMethods.cairo_xlib_surface_get_depth (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_depth (Handle); }
}
public IntPtr Display {
- get { return NativeMethods.cairo_xlib_surface_get_display (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_display (Handle); }
}
public IntPtr Drawable {
- get { return NativeMethods.cairo_xlib_surface_get_drawable (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_drawable (Handle); }
}
public int Height {
- get { return NativeMethods.cairo_xlib_surface_get_height (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_height (Handle); }
}
public IntPtr Screen {
- get { return NativeMethods.cairo_xlib_surface_get_screen (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_screen (Handle); }
}
public IntPtr Visual {
- get { return NativeMethods.cairo_xlib_surface_get_visual (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_visual (Handle); }
}
public int Width {
- get { return NativeMethods.cairo_xlib_surface_get_width (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_width (Handle); }
}
}