.NET5^ support image ReadOnlySpan<byte>

This commit is contained in:
Wei Lin 2024-05-16 22:17:49 +08:00
parent ae4e68fbf8
commit 361fb964f4
4 changed files with 8 additions and 4 deletions

View File

@ -22,6 +22,8 @@
--- ---
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
### 1.32.0 ### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -25,7 +25,8 @@
--- ---
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
### 1.32.0 ### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -24,7 +24,8 @@
--- ---
### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
### 1.32.0 ### 1.32.0
- [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak)

View File

@ -1,5 +1,6 @@
namespace MiniExcelLibs.Utils namespace MiniExcelLibs.Utils
{ {
using System;
internal class ImageHelper internal class ImageHelper
{ {
public enum ImageFormat public enum ImageFormat
@ -47,8 +48,7 @@
return ImageFormat.unknown; return ImageFormat.unknown;
} }
#endif #endif
#if NET5_0_OR_GREATER
#if NET5_0
public static ImageFormat GetImageFormat(ReadOnlySpan<byte> bytes) public static ImageFormat GetImageFormat(ReadOnlySpan<byte> bytes)
{ {
ReadOnlySpan<byte> bmp = stackalloc byte[] { (byte)'B', (byte)'M' }; // BMP ReadOnlySpan<byte> bmp = stackalloc byte[] { (byte)'B', (byte)'M' }; // BMP