Fix message
[mono.git] / mcs / class / Mono.Cairo / Mono.Cairo / ImageSurface.cs
index dce4e0fc43e6648f67334a7c5b68370c0068fcde..0fe99a600898925f920fb484bf85f1151dc2b4cd 100644 (file)
@@ -33,6 +33,7 @@
 //
 
 using System;
+using System.Runtime.InteropServices;
 
 namespace Cairo {
 
@@ -76,7 +77,13 @@ namespace Cairo {
                
 #if CAIRO_1_2
                public byte[] Data {
-                       get { return CairoAPI.cairo_image_surface_get_data (surface); }
+                       get {
+                               IntPtr ptr = CairoAPI.cairo_image_surface_get_data (surface);
+                               int length = Height * Stride;
+                               byte[] data = new byte[length];
+                               Marshal.Copy (ptr, data, 0, length);
+                               return data;
+                       }
                }
 
                public Format Format {