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); }
internal static string EncodeInternal(int xComponent, int yComponent, SKBitmap bitmap) => CoreBlurHashEncoder.Encode(xComponent, yComponent, bitmap.Width, bitmap.Height, bitmap.GetPixelSpan(), bitmap.RowBytes, PixelFormat.RGB888x);