Esempio n. 1
0
        public void LinearTosRGB_RoundTrip_Success(float value)
        {
            int i         = CoreBlurHashEncoder.LinearTosRGB(value);
            var roundtrip = CoreBlurHashEncoder._sRGBToLinearLookup[i];

            Assert.Equal(value, roundtrip, 9);
        }
Esempio n. 2
0
        internal static unsafe string EncodeInternal(int xComponent, int yComponent, Bitmap bitmap, PixelFormat pixelFormat)
        {
            var width  = bitmap.Width;
            var height = bitmap.Height;

            // Lock the bitmap's bits.
            var bmpData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, bitmap.PixelFormat);

            // Get the address of the first line.
            var ptr = bmpData.Scan0;

            // Declare an array to hold the bytes of the bitmap.
            var bytes = Math.Abs(bmpData.Stride) * height;

            var hash = CoreBlurHashEncoder.Encode(xComponent, yComponent, width, height, new ReadOnlySpan <byte>(ptr.ToPointer(), bytes), bmpData.Stride, pixelFormat);

            bitmap.UnlockBits(bmpData);
            return(hash);
        }
Esempio n. 3
0
 public float MaxFAvx() => CoreBlurHashEncoder.MaxFAvx(_data);
Esempio n. 4
0
 internal static string EncodeInternal(int xComponent, int yComponent, SKBitmap bitmap)
 => CoreBlurHashEncoder.Encode(xComponent, yComponent, bitmap.Width, bitmap.Height, bitmap.GetPixelSpan(), bitmap.RowBytes, PixelFormat.RGB888x);
Esempio n. 5
0
 public void SignSqrtF_Success(float value, float excpected)
 {
     Assert.Equal(excpected, CoreBlurHashEncoder.SignSqrtF(value), 9);
 }