Пример #1
0
        public void FromDataProviderTest()
        {
            var file = NSBundle.MainBundle.PathForResource("xamarin2", "png");

#if MONOMAC
            using (var dp = new CGDataProvider(file)) {
#else
            using (var dp = new CGDataProvider(filename)) {
#endif
                using (var img = CGImageSource.FromDataProvider(dp)) {
                    Assert.NotNull(img, "#a1");
                }
            }

#if MONOMAC
            using (var dp = new CGDataProvider(file)) {
#else
            using (var dp = new CGDataProvider(filename)) {
#endif
                using (var img = CGImageSource.FromDataProvider(dp, new CGImageOptions())) {
                    Assert.NotNull(img, "#b1");
                }
            }

#if MONOMAC
            using (var dp = new CGDataProvider(file)) {
#else
            using (var dp = new CGDataProvider(filename)) {
#endif
                using (var img = CGImageSource.FromDataProvider(dp, null)) {
                    Assert.NotNull(img, "#c1");
                }
            }
        }
Пример #2
0
        public Bitmap(string filename)
        {
            // Use Image IO
            CGDataProvider prov = new CGDataProvider(filename);
            var            cg   = CGImageSource.FromDataProvider(prov).CreateImage(0, null);

            InitWithCGImage(cg);
        }
Пример #3
0
        public void FromDataProviderTest()
        {
            using (var dp = new CGDataProvider(filename)) {
                using (var img = CGImageSource.FromDataProvider(dp)) {
                    Assert.NotNull(img, "#a1");
                }
            }

            using (var dp = new CGDataProvider(filename)) {
                using (var img = CGImageSource.FromDataProvider(dp, new CGImageOptions())) {
                    Assert.NotNull(img, "#b1");
                }
            }

            using (var dp = new CGDataProvider(filename)) {
                using (var img = CGImageSource.FromDataProvider(dp, null)) {
                    Assert.NotNull(img, "#c1");
                }
            }
        }