예제 #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));
 }