@@ -19,25 +19,25 @@ internal static class AlphaEncoder
1919 /// Data is either compressed as lossless webp image or uncompressed.
2020 /// </summary>
2121 /// <typeparam name="TPixel">The pixel format.</typeparam>
22- /// <param name="image ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
22+ /// <param name="frame ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
2323 /// <param name="configuration">The global configuration.</param>
2424 /// <param name="memoryAllocator">The memory manager.</param>
2525 /// <param name="skipMetadata">Whether to skip metadata encoding.</param>
2626 /// <param name="compress">Indicates, if the data should be compressed with the lossless webp compression.</param>
2727 /// <param name="size">The size in bytes of the alpha data.</param>
2828 /// <returns>The encoded alpha data.</returns>
2929 public static IMemoryOwner < byte > EncodeAlpha < TPixel > (
30- Image < TPixel > image ,
30+ ImageFrame < TPixel > frame ,
3131 Configuration configuration ,
3232 MemoryAllocator memoryAllocator ,
3333 bool skipMetadata ,
3434 bool compress ,
3535 out int size )
3636 where TPixel : unmanaged, IPixel < TPixel >
3737 {
38- int width = image . Width ;
39- int height = image . Height ;
40- IMemoryOwner < byte > alphaData = ExtractAlphaChannel ( image , configuration , memoryAllocator ) ;
38+ int width = frame . Width ;
39+ int height = frame . Height ;
40+ IMemoryOwner < byte > alphaData = ExtractAlphaChannel ( frame , configuration , memoryAllocator ) ;
4141
4242 if ( compress )
4343 {
@@ -58,9 +58,9 @@ public static IMemoryOwner<byte> EncodeAlpha<TPixel>(
5858 // The transparency information will be stored in the green channel of the ARGB quadruplet.
5959 // The green channel is allowed extra transformation steps in the specification -- unlike the other channels,
6060 // that can improve compression.
61- using Image < Rgba32 > alphaAsImage = DispatchAlphaToGreen ( image , alphaData . GetSpan ( ) ) ;
61+ using ImageFrame < Rgba32 > alphaAsFrame = DispatchAlphaToGreen ( frame , alphaData . GetSpan ( ) ) ;
6262
63- size = lossLessEncoder . EncodeAlphaImageData ( alphaAsImage , alphaData ) ;
63+ size = lossLessEncoder . EncodeAlphaImageData ( alphaAsFrame , alphaData ) ;
6464
6565 return alphaData ;
6666 }
@@ -73,19 +73,19 @@ public static IMemoryOwner<byte> EncodeAlpha<TPixel>(
7373 /// Store the transparency in the green channel.
7474 /// </summary>
7575 /// <typeparam name="TPixel">The pixel format.</typeparam>
76- /// <param name="image ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
76+ /// <param name="frame ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
7777 /// <param name="alphaData">A byte sequence of length width * height, containing all the 8-bit transparency values in scan order.</param>
78- /// <returns>The transparency image .</returns>
79- private static Image < Rgba32 > DispatchAlphaToGreen < TPixel > ( Image < TPixel > image , Span < byte > alphaData )
78+ /// <returns>The transparency frame .</returns>
79+ private static ImageFrame < Rgba32 > DispatchAlphaToGreen < TPixel > ( ImageFrame < TPixel > frame , Span < byte > alphaData )
8080 where TPixel : unmanaged, IPixel < TPixel >
8181 {
82- int width = image . Width ;
83- int height = image . Height ;
84- Image < Rgba32 > alphaAsImage = new ( width , height ) ;
82+ int width = frame . Width ;
83+ int height = frame . Height ;
84+ ImageFrame < Rgba32 > alphaAsFrame = new ImageFrame < Rgba32 > ( Configuration . Default , width , height ) ;
8585
8686 for ( int y = 0 ; y < height ; y ++ )
8787 {
88- Memory < Rgba32 > rowBuffer = alphaAsImage . DangerousGetPixelRowMemory ( y ) ;
88+ Memory < Rgba32 > rowBuffer = alphaAsFrame . DangerousGetPixelRowMemory ( y ) ;
8989 Span < Rgba32 > pixelRow = rowBuffer . Span ;
9090 Span < byte > alphaRow = alphaData . Slice ( y * width , width ) ;
9191 for ( int x = 0 ; x < width ; x ++ )
@@ -95,23 +95,23 @@ private static Image<Rgba32> DispatchAlphaToGreen<TPixel>(Image<TPixel> image, S
9595 }
9696 }
9797
98- return alphaAsImage ;
98+ return alphaAsFrame ;
9999 }
100100
101101 /// <summary>
102102 /// Extract the alpha data of the image.
103103 /// </summary>
104104 /// <typeparam name="TPixel">The pixel format.</typeparam>
105- /// <param name="image ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
105+ /// <param name="frame ">The <see cref="ImageFrame{TPixel}"/> to encode from.</param>
106106 /// <param name="configuration">The global configuration.</param>
107107 /// <param name="memoryAllocator">The memory manager.</param>
108108 /// <returns>A byte sequence of length width * height, containing all the 8-bit transparency values in scan order.</returns>
109- private static IMemoryOwner < byte > ExtractAlphaChannel < TPixel > ( Image < TPixel > image , Configuration configuration , MemoryAllocator memoryAllocator )
109+ private static IMemoryOwner < byte > ExtractAlphaChannel < TPixel > ( ImageFrame < TPixel > frame , Configuration configuration , MemoryAllocator memoryAllocator )
110110 where TPixel : unmanaged, IPixel < TPixel >
111111 {
112- Buffer2D < TPixel > imageBuffer = image . Frames . RootFrame . PixelBuffer ;
113- int height = image . Height ;
114- int width = image . Width ;
112+ Buffer2D < TPixel > imageBuffer = frame . PixelBuffer ;
113+ int height = frame . Height ;
114+ int width = frame . Width ;
115115 IMemoryOwner < byte > alphaDataBuffer = memoryAllocator . Allocate < byte > ( width * height ) ;
116116 Span < byte > alphaData = alphaDataBuffer . GetSpan ( ) ;
117117
0 commit comments