Пример #1
0
 public void ReadOnlyStream()
 {
     using (var stream = File.OpenRead(Path.Combine(PathToImages, "baboon.png")))
         using (var nonSeekable = new NonSeekableReadOnlyStream(stream))
             using (var bitmap = SKBitmap.Decode(nonSeekable))
                 Assert.NotNull(bitmap);
 }
        private Stream CreateNonSeekableReadOnlyStream(Stream stream, int bufferSize)
        {
            var nonSeekable = new NonSeekableReadOnlyStream(stream);
            var buffered    = new SKFrontBufferedStream(nonSeekable, bufferSize);

            return(buffered);
        }
Пример #3
0
        public void CanCreateFromNonSeekable()
        {
            using var stream      = File.OpenRead(Path.Combine(PathToImages, "baboon.png"));
            using var nonSeekable = new NonSeekableReadOnlyStream(stream);
            using var data        = SKData.Create(nonSeekable);

            Assert.NotNull(data);
        }
Пример #4
0
 public void CanReadNonSeekableStream()
 {
     using (var stream = File.OpenRead(Path.Combine(PathToFonts, "Distortable.ttf")))
         using (var nonSeekable = new NonSeekableReadOnlyStream(stream))
             using (var typeface = SKTypeface.FromStream(nonSeekable))
             {
                 Assert.NotNull(typeface);
             }
 }
Пример #5
0
        public void DownloadedStream()
        {
            var httpClient = new HttpClient();

            using (var stream = httpClient.GetStreamAsync(new Uri("http://www.gstatic.com/webp/gallery/2.webp")).Result)
                using (var nonSeekable = new NonSeekableReadOnlyStream(stream))
                    using (var bitmap = SKBitmap.Decode(nonSeekable))
                        Assert.NotNull(bitmap);
        }
Пример #6
0
        public void CanReadNonSeekableStream()
        {
            var fonts = SKFontManager.Default;

            using (var stream = File.OpenRead(Path.Combine(PathToFonts, "Distortable.ttf")))
                using (var nonSeekable = new NonSeekableReadOnlyStream(stream))
                    using (var typeface = fonts.CreateTypeface(nonSeekable))
                    {
                        Assert.NotNull(typeface);
                    }
        }