コード例 #1
0
        public void CanEncodeBitmap(string source, int compX, int compY, string expected)
        {
            using var img = SKBitmap.Decode(Path.Combine("images", source));

            var result = SKBlurHash.Serialize(img, compX, compY);

            Assert.Equal(expected, result);
        }
コード例 #2
0
        public void CanEncodeAndDecode()
        {
            using var img = SKBitmap.Decode(Path.Combine("images", "img1.jpg"));

            var encoded = SKBlurHash.Serialize(img, 4, 3);

            Assert.NotNull(encoded);
            Assert.True(encoded.Length > 6);

            var decoded = SKBlurHash.DeserializeBitmap(encoded, 12, 10);

            Assert.NotNull(decoded);
        }
コード例 #3
0
 public void NullEncodeThrows()
 {
     Assert.Throws <ArgumentNullException>(() => SKBlurHash.Serialize((SKBitmap)null, 4, 3));
 }