Пример #1
0
        public TValue[] ObjectsForKeys(TKey[] keys, TValue marker)
        {
            if (keys == null)
            {
                throw new ArgumentNullException(nameof(keys));
            }

            if (marker == null)
            {
                throw new ArgumentNullException(nameof(marker));
            }

            if (keys.Length == 0)
            {
                return new TValue [] {}
            }
            ;

            using (var pool = new NSAutoreleasePool())
                return(NSArray.ArrayFromHandle <TValue> (_ObjectsForKeys(NSArray.From <TKey> (keys).Handle, marker.Handle)));
        }
Пример #2
0
        // Private Callback function for CVDisplayLink
        private CVReturn MyDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            //CVReturn result = GetFrameForTime (inOutputTime);
            CVReturn result = CVReturn.Error;

            // There is no autorelease pool when this method is called because it will be called from a background thread
            // It's important to create one or you will leak objects
            using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
                // Update the animation
                BeginInvokeOnMainThread (RenderScene);
                result = CVReturn.Success;
            }

            return result;
        }
Пример #3
0
 public NSData AsPNG()
 {
     using (var pool = new NSAutoreleasePool ())
         return (NSData) Runtime.GetNSObject (UIImagePNGRepresentation (Handle));
 }
Пример #4
0
 public static UIImage GetImageFromCurrentImageContext()
 {
     using (var pool = new NSAutoreleasePool ()) {
         var handle = UIGraphicsGetImageFromCurrentImageContext ();
         return (UIImage) Runtime.GetNSObject (handle);
     }
 }
Пример #5
0
 public NSData AsJPEG(nfloat compressionQuality)
 {
     using (var pool = new NSAutoreleasePool ())
         return (NSData) Runtime.GetNSObject (UIImageJPEGRepresentation (Handle, compressionQuality));
 }