mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using CPF.Mac.CoreFoundation;
|
|
using CPF.Mac.Foundation;
|
|
using CPF.Mac.ObjCRuntime;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace CPF.Mac.CoreGraphics
|
|
{
|
|
public class CGPDFStream : INativeObject
|
|
{
|
|
internal IntPtr handle;
|
|
|
|
public IntPtr Handle => handle;
|
|
|
|
public CGPDFDictionary Dictionary => new CGPDFDictionary(CGPDFStreamGetDictionary(handle));
|
|
|
|
public NSData Data
|
|
{
|
|
get
|
|
{
|
|
int format;
|
|
IntPtr obj = CGPDFStreamCopyData(handle, out format);
|
|
NSData result = new NSData(obj);
|
|
CFObject.CFRelease(obj);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
internal CGPDFStream(IntPtr handle)
|
|
{
|
|
this.handle = handle;
|
|
}
|
|
|
|
[DllImport("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/CoreGraphics")]
|
|
private static extern IntPtr CGPDFStreamGetDictionary(IntPtr handle);
|
|
|
|
[DllImport("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/CoreGraphics")]
|
|
private static extern IntPtr CGPDFStreamCopyData(IntPtr handle, out int format);
|
|
}
|
|
}
|