public void ArrayFromHandleFuncTest_bool_false() { var handle = CFArray.Create(TestArray); var a = CFArray.ArrayFromHandleFunc <string> (handle, (v) => CFString.FromHandle(v), false); VerifyArray(a); Assert.AreEqual((nint)1, CFGetRetainCount(handle), "RC"); CFRelease(handle); }
public CTFontDescriptor [] GetMatchingFontDescriptors(CTFontCollectionOptions?options) { var cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsWithOptions(Handle, options.GetHandle()); if (cfArrayRef == IntPtr.Zero) { return(Array.Empty <CTFontDescriptor> ()); } return(CFArray.ArrayFromHandleFunc(cfArrayRef, fd => new CTFontDescriptor(fd, false), true) !); }
public CTFontDescriptor[] GetMatchingFontDescriptors(NSSet?mandatoryAttributes) { var cfArrayRef = CTFontDescriptorCreateMatchingFontDescriptors(Handle, mandatoryAttributes.GetHandle()); if (cfArrayRef == IntPtr.Zero) { return(Array.Empty <CTFontDescriptor> ()); } return(CFArray.ArrayFromHandleFunc(cfArrayRef, fd => new CTFontDescriptor(cfArrayRef, false), true) !); }
public static PMStatusCode CreatePrinterList(out PMPrinter []?printerList) { var code = PMServerCreatePrinterList(IntPtr.Zero /* ServerLocal */, out var arr); if (code != PMStatusCode.Ok) { printerList = null; return(code); } printerList = CFArray.ArrayFromHandleFunc <PMPrinter> (arr, (handle) => new PMPrinter(handle, false), true); return(PMStatusCode.Ok); }
public PMStatusCode TryGetPaperList(out PMPaper []?paperList) { var code = PMPrinterGetPaperList(Handle, out var m); if (code != PMStatusCode.Ok) { paperList = null; return(code); } paperList = (PMPaper [])CFArray.ArrayFromHandleFunc <PMPaper> (m, (handle) => new PMPaper(handle, false)) !; return(PMStatusCode.Ok); }
public CTFontDescriptor?[]? GetMatchingFontDescriptors(Comparison <CTFontDescriptor> comparer) { GCHandle comparison = GCHandle.Alloc(comparer); try { var cfArrayRef = CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback( Handle, new CTFontCollectionSortDescriptorsCallback(CompareDescriptors), GCHandle.ToIntPtr(comparison)); if (cfArrayRef == IntPtr.Zero) { return(Array.Empty <CTFontDescriptor> ()); } return(CFArray.ArrayFromHandleFunc(cfArrayRef, fd => new CTFontDescriptor(fd, false), true) !); } finally { comparison.Free(); } }
public CGImageMetadataTag []? GetTags() { var result = CGImageMetadataCopyTags(Handle); return(CFArray.ArrayFromHandleFunc(result, (handle) => new CGImageMetadataTag(handle, false), true)); }
public CGPDFStream?[]? GetStreams() { var rv = CGPDFContentStreamGetStreams(Handle); return(CFArray.ArrayFromHandleFunc(rv, (handle) => new CGPDFStream(handle))); }