@@ -131,7 +131,7 @@ public BmpDecoderCore(Configuration configuration, IBmpDecoderOptions options)
131131 /// </exception>
132132 /// <returns>The decoded image.</returns>
133133 public Image < TPixel > Decode < TPixel > ( Stream stream )
134- where TPixel : struct , IPixel < TPixel >
134+ where TPixel : unmanaged , IPixel < TPixel >
135135 {
136136 try
137137 {
@@ -256,7 +256,7 @@ private static int CalculatePadding(int width, int componentCount)
256256 /// <param name="pixels">The output pixel buffer containing the decoded image.</param>
257257 /// <param name="inverted">Whether the bitmap is inverted.</param>
258258 private void ReadBitFields < TPixel > ( Buffer2D < TPixel > pixels , bool inverted )
259- where TPixel : struct , IPixel < TPixel >
259+ where TPixel : unmanaged , IPixel < TPixel >
260260 {
261261 if ( this . infoHeader . BitsPerPixel == 16 )
262262 {
@@ -296,7 +296,7 @@ private void ReadBitFields<TPixel>(Buffer2D<TPixel> pixels, bool inverted)
296296 /// <param name="height">The height of the bitmap.</param>
297297 /// <param name="inverted">Whether the bitmap is inverted.</param>
298298 private void ReadRle < TPixel > ( BmpCompression compression , Buffer2D < TPixel > pixels , byte [ ] colors , int width , int height , bool inverted )
299- where TPixel : struct , IPixel < TPixel >
299+ where TPixel : unmanaged , IPixel < TPixel >
300300 {
301301 TPixel color = default ;
302302 using ( IMemoryOwner < byte > buffer = this . memoryAllocator . Allocate < byte > ( width * height , AllocationOptions . Clean ) )
@@ -376,7 +376,7 @@ private void ReadRle<TPixel>(BmpCompression compression, Buffer2D<TPixel> pixels
376376 /// <param name="height">The height of the bitmap.</param>
377377 /// <param name="inverted">Whether the bitmap is inverted.</param>
378378 private void ReadRle24 < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted )
379- where TPixel : struct , IPixel < TPixel >
379+ where TPixel : unmanaged , IPixel < TPixel >
380380 {
381381 TPixel color = default ;
382382 using ( IMemoryOwner < byte > buffer = this . memoryAllocator . Allocate < byte > ( width * height * 3 , AllocationOptions . Clean ) )
@@ -814,7 +814,7 @@ private static int RleSkipDelta(
814814 /// the bytes per color palette entry's can be 3 bytes instead of 4.</param>
815815 /// <param name="inverted">Whether the bitmap is inverted.</param>
816816 private void ReadRgbPalette < TPixel > ( Buffer2D < TPixel > pixels , byte [ ] colors , int width , int height , int bitsPerPixel , int bytesPerColorMapEntry , bool inverted )
817- where TPixel : struct , IPixel < TPixel >
817+ where TPixel : unmanaged , IPixel < TPixel >
818818 {
819819 // Pixels per byte (bits per pixel).
820820 int ppb = 8 / bitsPerPixel ;
@@ -872,7 +872,7 @@ private void ReadRgbPalette<TPixel>(Buffer2D<TPixel> pixels, byte[] colors, int
872872 /// <param name="greenMask">The bitmask for the green channel.</param>
873873 /// <param name="blueMask">The bitmask for the blue channel.</param>
874874 private void ReadRgb16 < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted , int redMask = DefaultRgb16RMask , int greenMask = DefaultRgb16GMask , int blueMask = DefaultRgb16BMask )
875- where TPixel : struct , IPixel < TPixel >
875+ where TPixel : unmanaged , IPixel < TPixel >
876876 {
877877 int padding = CalculatePadding ( width , 2 ) ;
878878 int stride = ( width * 2 ) + padding ;
@@ -939,7 +939,7 @@ private void ReadRgb16<TPixel>(Buffer2D<TPixel> pixels, int width, int height, b
939939 /// <param name="height">The height of the bitmap.</param>
940940 /// <param name="inverted">Whether the bitmap is inverted.</param>
941941 private void ReadRgb24 < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted )
942- where TPixel : struct , IPixel < TPixel >
942+ where TPixel : unmanaged , IPixel < TPixel >
943943 {
944944 int padding = CalculatePadding ( width , 3 ) ;
945945
@@ -968,7 +968,7 @@ private void ReadRgb24<TPixel>(Buffer2D<TPixel> pixels, int width, int height, b
968968 /// <param name="height">The height of the bitmap.</param>
969969 /// <param name="inverted">Whether the bitmap is inverted.</param>
970970 private void ReadRgb32Fast < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted )
971- where TPixel : struct , IPixel < TPixel >
971+ where TPixel : unmanaged , IPixel < TPixel >
972972 {
973973 int padding = CalculatePadding ( width , 4 ) ;
974974
@@ -998,7 +998,7 @@ private void ReadRgb32Fast<TPixel>(Buffer2D<TPixel> pixels, int width, int heigh
998998 /// <param name="height">The height of the bitmap.</param>
999999 /// <param name="inverted">Whether the bitmap is inverted.</param>
10001000 private void ReadRgb32Slow < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted )
1001- where TPixel : struct , IPixel < TPixel >
1001+ where TPixel : unmanaged , IPixel < TPixel >
10021002 {
10031003 int padding = CalculatePadding ( width , 4 ) ;
10041004
@@ -1099,7 +1099,7 @@ private void ReadRgb32Slow<TPixel>(Buffer2D<TPixel> pixels, int width, int heigh
10991099 /// <param name="blueMask">The bitmask for the blue channel.</param>
11001100 /// <param name="alphaMask">The bitmask for the alpha channel.</param>
11011101 private void ReadRgb32BitFields < TPixel > ( Buffer2D < TPixel > pixels , int width , int height , bool inverted , int redMask , int greenMask , int blueMask , int alphaMask )
1102- where TPixel : struct , IPixel < TPixel >
1102+ where TPixel : unmanaged , IPixel < TPixel >
11031103 {
11041104 TPixel color = default ;
11051105 int padding = CalculatePadding ( width , 4 ) ;
0 commit comments