[mono/maccore] [3 commits] 2cd6d157: implements CGDataConsumer

"Aaron Bockover ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141c7352b20-502fa4dd-9a59-427a-8809-4d68627b0c0a-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/maccore
  Compare: https://github.com/mono/maccore/compare/c56ff209497c...a250c4d9f2d6

   Commit: 2cd6d15716d282b7e1d6f5a589b217961d0fbe28
   Author: Ademar Gonzalez <[email protected]> (ademar)
     Date: 2013-08-15 19:42:30 GMT
      URL: https://github.com/mono/maccore/commit/2cd6d15716d282b7e1d6f5a589b217961d0fbe28

implements CGDataConsumer

Added paths:
  A src/CoreGraphics/CGDataConsumer.cs

Added: src/CoreGraphics/CGDataConsumer.cs
===================================================================
@@ -0,0 +1,98 @@
+// 
+// CGDataConsumer.cs: Implements the managed CGDataConsumer
+//
+// Authors: Ademar Gonzalez
+//     
+// Copyright 2009 Novell, Inc
+// Copyright 2011, 2012 Xamarin Inc
+//
+// 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.Drawing;
+using System.Runtime.InteropServices;
+
+using MonoMac.ObjCRuntime;
+using MonoMac.Foundation;
+
+namespace MonoMac.CoreGraphics {
+
+	public partial class CGDataConsumer : INativeObject, IDisposable {
+		internal IntPtr handle;
+		IntPtr buffer;
+		byte [] reference;
+		
+		// invoked by marshallers
+		public CGDataConsumer (IntPtr handle)
+			: this (handle, false)
+		{
+			this.handle = handle;
+		}
+
+		[Preserve (Conditional=true)]
+		internal CGDataConsumer (IntPtr handle, bool owns)
+		{
+			this.handle = handle;
+			if (!owns)
+				CGDataConsumerRetain (handle);
+		}
+		
+		~CGDataConsumer ()
+		{
+			Dispose (false);
+		}
+		
+		public void Dispose ()
+		{
+			Dispose (true);
+			GC.SuppressFinalize (this);
+		}
+
+		public IntPtr Handle {
+			get { return handle; }
+		}
+	
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static void CGDataConsumerRelease (IntPtr handle);
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static void CGDataConsumerRetain (IntPtr handle);
+		
+		protected virtual void Dispose (bool disposing)
+		{
+			if (handle != IntPtr.Zero){
+				if (buffer != IntPtr.Zero)
+					Marshal.FreeHGlobal (buffer);
+				buffer = IntPtr.Zero;
+				CGDataConsumerRelease (handle);
+				handle = IntPtr.Zero;
+			}
+			reference = null;
+		}
+
+
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static IntPtr CGDataConsumerCreateWithCFData (IntPtr data);
+		
+		public CGDataConsumer(NSMutableData data){
+			handle = CGDataConsumerCreateWithCFData(data.Handle);
+		}
+
+	}
+}

   Commit: 56ac86613f979f2348e3e2bcff202837ab5f3e30
   Author: Ademar Gonzalez <[email protected]> (ademar)
     Date: 2013-08-15 19:43:45 GMT
      URL: https://github.com/mono/maccore/commit/56ac86613f979f2348e3e2bcff202837ab5f3e30

missing constructor

create CGContextPDF instance with a CGDataConsumer

Changed paths:
  M src/CoreGraphics/CGContextPDF.cs

Modified: src/CoreGraphics/CGContextPDF.cs
===================================================================
@@ -192,6 +192,18 @@ public class CGContextPDF : CGContext {
 		[DllImport (Constants.CoreGraphicsLibrary)]
 		extern static IntPtr CGPDFContextCreateWithURL (IntPtr url, IntPtr rect, IntPtr dictionary);
 
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static IntPtr CGPDFContextCreate (IntPtr dataConsumer, ref RectangleF rect, IntPtr dictionary);
+		
+		
+		public CGContextPDF (CGDataConsumer dataConsumer, RectangleF mediaBox, CGPDFInfo info)
+		{
+			if (dataConsumer == null)
+				throw new ArgumentNullException ("dataConsumer");
+				
+			handle = CGPDFContextCreate (dataConsumer.Handle, ref mediaBox, info == null ? IntPtr.Zero : info.ToDictionary ().Handle);
+		}
+
 		public CGContextPDF (NSUrl url, RectangleF mediaBox, CGPDFInfo info)
 		{
 			if (url == null)

   Commit: a250c4d9f2d670e2d2f89dfc95b143b25fc15dd1
   Author: Aaron Bockover <[email protected]> (abock)
     Date: 2013-10-17 16:14:27 GMT
      URL: https://github.com/mono/maccore/commit/a250c4d9f2d670e2d2f89dfc95b143b25fc15dd1

Merge pull request #56 from ademar/master

implements CGDataConsumer and missing constructor in CGContextPDF

Changed paths:
  M src/CoreGraphics/CGContextPDF.cs
Added paths:
  A src/CoreGraphics/CGDataConsumer.cs

Modified: src/CoreGraphics/CGContextPDF.cs
===================================================================
@@ -192,6 +192,18 @@ public class CGContextPDF : CGContext {
 		[DllImport (Constants.CoreGraphicsLibrary)]
 		extern static IntPtr CGPDFContextCreateWithURL (IntPtr url, IntPtr rect, IntPtr dictionary);
 
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static IntPtr CGPDFContextCreate (IntPtr dataConsumer, ref RectangleF rect, IntPtr dictionary);
+		
+		
+		public CGContextPDF (CGDataConsumer dataConsumer, RectangleF mediaBox, CGPDFInfo info)
+		{
+			if (dataConsumer == null)
+				throw new ArgumentNullException ("dataConsumer");
+				
+			handle = CGPDFContextCreate (dataConsumer.Handle, ref mediaBox, info == null ? IntPtr.Zero : info.ToDictionary ().Handle);
+		}
+
 		public CGContextPDF (NSUrl url, RectangleF mediaBox, CGPDFInfo info)
 		{
 			if (url == null)

Added: src/CoreGraphics/CGDataConsumer.cs
===================================================================
@@ -0,0 +1,98 @@
+// 
+// CGDataConsumer.cs: Implements the managed CGDataConsumer
+//
+// Authors: Ademar Gonzalez
+//     
+// Copyright 2009 Novell, Inc
+// Copyright 2011, 2012 Xamarin Inc
+//
+// 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.Drawing;
+using System.Runtime.InteropServices;
+
+using MonoMac.ObjCRuntime;
+using MonoMac.Foundation;
+
+namespace MonoMac.CoreGraphics {
+
+	public partial class CGDataConsumer : INativeObject, IDisposable {
+		internal IntPtr handle;
+		IntPtr buffer;
+		byte [] reference;
+		
+		// invoked by marshallers
+		public CGDataConsumer (IntPtr handle)
+			: this (handle, false)
+		{
+			this.handle = handle;
+		}
+
+		[Preserve (Conditional=true)]
+		internal CGDataConsumer (IntPtr handle, bool owns)
+		{
+			this.handle = handle;
+			if (!owns)
+				CGDataConsumerRetain (handle);
+		}
+		
+		~CGDataConsumer ()
+		{
+			Dispose (false);
+		}
+		
+		public void Dispose ()
+		{
+			Dispose (true);
+			GC.SuppressFinalize (this);
+		}
+
+		public IntPtr Handle {
+			get { return handle; }
+		}
+	
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static void CGDataConsumerRelease (IntPtr handle);
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static void CGDataConsumerRetain (IntPtr handle);
+		
+		protected virtual void Dispose (bool disposing)
+		{
+			if (handle != IntPtr.Zero){
+				if (buffer != IntPtr.Zero)
+					Marshal.FreeHGlobal (buffer);
+				buffer = IntPtr.Zero;
+				CGDataConsumerRelease (handle);
+				handle = IntPtr.Zero;
+			}
+			reference = null;
+		}
+
+
+		[DllImport (Constants.CoreGraphicsLibrary)]
+		extern static IntPtr CGDataConsumerCreateWithCFData (IntPtr data);
+		
+		public CGDataConsumer(NSMutableData data){
+			handle = CGDataConsumerCreateWithCFData(data.Handle);
+		}
+
+	}
+}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.