Author: jluke
Date: 2006-07-06 23:01:30 -0400 (Thu, 06 Jul 2006)
New Revision: 62335

Modified:
   trunk/mcs/class/Mono.Cairo/ChangeLog
   trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
   trunk/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
Log:
2006-07-06  John Luke  <[EMAIL PROTECTED]>

        * Mono.Cairo/Cairo.cs:
        * Mono.Cairo/ImageSurface.cs: Marshal data correctly



Modified: trunk/mcs/class/Mono.Cairo/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Cairo/ChangeLog        2006-07-07 02:24:23 UTC (rev 
62334)
+++ trunk/mcs/class/Mono.Cairo/ChangeLog        2006-07-07 03:01:30 UTC (rev 
62335)
@@ -1,3 +1,8 @@
+2006-07-06  John Luke  <[EMAIL PROTECTED]>
+
+       * Mono.Cairo/Cairo.cs:
+       * Mono.Cairo/ImageSurface.cs: Marshal data correctly
+
 2006-07-01  John Luke  <[EMAIL PROTECTED]>
 
        * Mono.Cairo/Context.cs:

Modified: trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs      2006-07-07 02:24:23 UTC 
(rev 62334)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs      2006-07-07 03:01:30 UTC 
(rev 62335)
@@ -263,7 +263,7 @@
                //internal static extern IntPtr 
cairo_image_surface_create_from_png_stream  (string filename);
 
                [DllImport (cairo)]
-               internal static extern byte[] cairo_image_surface_get_data 
(IntPtr surface);
+               internal static extern IntPtr cairo_image_surface_get_data 
(IntPtr surface);
 
                [DllImport (cairo)]
                internal static extern Format cairo_image_surface_get_format 
(IntPtr surface);

Modified: trunk/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs       2006-07-07 
02:24:23 UTC (rev 62334)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs       2006-07-07 
03:01:30 UTC (rev 62335)
@@ -33,6 +33,7 @@
 //
 
 using System;
+using System.Runtime.InteropServices;
 
 namespace Cairo {
 
@@ -76,7 +77,13 @@
                
 #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 {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to