Make a copy of the old ZipLib
[mono.git] / mcs / class / Mono.Cairo / Mono.Cairo / Surface.cs
index 25c4eae083b2caf5a37a862f6d9d55cbc84c270c..5ed1d081ac3e49ebca003e28310b624b2f1ce5fd 100644 (file)
@@ -39,6 +39,21 @@ namespace Cairo {
 
         public class ImageSurface : Surface
         {
+               public ImageSurface (Format format, int width, int height)
+               {
+                       surface = CairoAPI.cairo_image_surface_create (format, width, height);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
+
+               public ImageSurface (string data, Cairo.Format format, int width, int height, int stride)
+               {
+                       surface = CairoAPI.cairo_image_surface_create_for_data (data, format, width, height, stride);
+                       lock (surfaces.SyncRoot){
+                               surfaces [surface] = this;
+                       }
+               }
                
                public ImageSurface (string filename)
                {
@@ -140,7 +155,9 @@ namespace Cairo {
                 internal IntPtr surface = IntPtr.Zero;
 
                protected Surface()
-               {}
+               {
+                       Console.WriteLine (Environment.StackTrace);
+               }
                
                 private Surface (IntPtr ptr, bool owns)
                 {
@@ -163,6 +180,7 @@ namespace Cairo {
                        }
                }               
                
+               [Obsolete ("Use an ImageSurface constructor instead.")]
                 public static Cairo.Surface CreateForImage (
                         string data, Cairo.Format format, int width, int height, int stride)
                 {
@@ -172,6 +190,7 @@ namespace Cairo {
                         return new Cairo.Surface (p, true);
                 }
 
+               [Obsolete ("Use an ImageSurface constructor instead.")]
                 public static Cairo.Surface CreateForImage (
                         Cairo.Format format, int width, int height)
                 {
@@ -212,9 +231,10 @@ namespace Cairo {
                {
                        if (surface == (IntPtr) 0)
                                return;
-                       lock (surfaces.SyncRoot){
+                       
+                       lock (surfaces.SyncRoot)
                                surfaces.Remove (surface);
-                       }
+
                        CairoAPI.cairo_surface_destroy (surface);
                        surface = (IntPtr) 0;
                }
@@ -225,13 +245,14 @@ namespace Cairo {
                }
                
                 public IntPtr Handle {
-                        get { return surface; }
+                        get {
+                               return surface;
+                       }
                 }
 
                public PointD DeviceOffset {
-                       set { CairoAPI.cairo_surface_set_device_offset (surface,
-                                                                   value.X,
-                                                                   value.Y);
+                       set {
+                               CairoAPI.cairo_surface_set_device_offset (surface, value.X, value.Y);
                        }
                }
                
@@ -246,12 +267,14 @@ namespace Cairo {
                }
                
                 public IntPtr Pointer {
-                        get { return surface; }
+                        get {
+                               return surface;
+                       }
                 }
-
-                               public Status Status {
-                                       get { return CairoAPI.cairo_surface_status (surface); }
-                               }
+               
+               public Status Status {
+                       get { return CairoAPI.cairo_surface_status (surface); }
+               }
 
         }
 }