예제 #1
0
        /// <summary>
        /// This method doesn't actually do anything but serves an important purpose...
        /// If you are running ImageSharp on iOS and try to call SaveAsGif, it will throw an exception:
        /// "Attempting to JIT compile method... OctreeFrameQuantizer.ConstructPalette... while running in aot-only mode."
        /// The reason this happens is the SaveAsGif method makes heavy use of generics, which are too confusing for the AoT
        /// compiler used on Xamarin.iOS. It spins up the JIT compiler to try and figure it out, but that is an illegal op on
        /// iOS so it bombs out.
        /// If you are getting the above error, you need to call this method, which will pre-seed the AoT compiler with the
        /// necessary methods to complete the SaveAsGif call. That's it, otherwise you should NEVER need this method!!!
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        private static void AotCompileOctreeQuantizer <TPixel>()
            where TPixel : struct, IPixel <TPixel>
        {
            var test = new OctreeFrameQuantizer <TPixel>(new OctreeQuantizer(false));

            test.AotGetPalette();
        }
예제 #2
0
 /// <summary>
 /// This method doesn't actually do anything but serves an important purpose...
 /// If you are running ImageSharp on iOS and try to call SaveAsGif, it will throw an exception:
 /// "Attempting to JIT compile method... OctreeFrameQuantizer.ConstructPalette... while running in aot-only mode."
 /// The reason this happens is the SaveAsGif method makes heavy use of generics, which are too confusing for the AoT
 /// compiler used on Xamarin.iOS. It spins up the JIT compiler to try and figure it out, but that is an illegal op on
 /// iOS so it bombs out.
 /// If you are getting the above error, you need to call this method, which will pre-seed the AoT compiler with the
 /// necessary methods to complete the SaveAsGif call. That's it, otherwise you should NEVER need this method!!!
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 private static void AotCompileOctreeQuantizer <TPixel>()
     where TPixel : struct, IPixel <TPixel>
 {
     using (var test = new OctreeFrameQuantizer <TPixel>(Configuration.Default, new OctreeQuantizer(false)))
     {
         test.AotGetPalette();
     }
 }