11// Copyright (c) Team CharLS.
22// SPDX-License-Identifier: BSD-3-Clause
33
4- using System . Diagnostics . CodeAnalysis ;
54using System . Drawing ;
65using System . Drawing . Imaging ;
76using CharLS . Managed ;
8483// chose for the in-memory representation of the bitmap data.
8584// PNG 8bits/grayscale is loaded as PixelFormat32bppARGB
8685// JPG/TIFF 8bits/grayscale are loaded as PixelFormat8bppIndexed
87- bool TryGetFrameInfoAndPixelFormat ( Image sourceImage , [ NotNullWhen ( true ) ] out FrameInfo frameInfo , out PixelFormat filePixelFormat )
86+ static bool TryGetFrameInfoAndPixelFormat ( Image sourceImage , out FrameInfo frameInfo , out PixelFormat filePixelFormat )
8887{
8988 var pixelFormat = sourceImage . PixelFormat ;
9089 var flags = sourceImage . Flags ;
@@ -117,18 +116,18 @@ bool TryGetFrameInfoAndPixelFormat(Image sourceImage, [NotNullWhen(true)] out Fr
117116 return filePixelFormat != default ;
118117}
119118
120- string GetOutputPath ( string inputPathArg )
119+ static string GetOutputPath ( string inputPathArg )
121120{
122121 return Path . ChangeExtension ( inputPathArg , ".jls" ) ;
123122}
124123
125- void Save ( string path , ReadOnlySpan < byte > encodedData )
124+ static void Save ( string path , ReadOnlySpan < byte > encodedData )
126125{
127126 using FileStream output = new ( path , FileMode . OpenOrCreate ) ;
128127 output . Write ( encodedData ) ;
129128}
130129
131- bool TryParseArguments ( IReadOnlyList < string > args , out string inputPathArg )
130+ static bool TryParseArguments ( IReadOnlyList < string > args , out string inputPathArg )
132131{
133132 if ( args . Count != 1 )
134133 {
@@ -140,7 +139,7 @@ bool TryParseArguments(IReadOnlyList<string> args, out string inputPathArg)
140139 return true ;
141140}
142141
143- void ConvertBgrToRgb ( Span < byte > pixels , int width , int height , int stride )
142+ static void ConvertBgrToRgb ( Span < byte > pixels , int width , int height , int stride )
144143{
145144 const int bytesPerRgbPixel = 3 ;
146145
@@ -158,7 +157,7 @@ void ConvertBgrToRgb(Span<byte> pixels, int width, int height, int stride)
158157 }
159158}
160159
161- SpiffColorSpace MapComponentCountToSpiffColorSpace ( int componentCount )
160+ static SpiffColorSpace MapComponentCountToSpiffColorSpace ( int componentCount )
162161{
163162 return componentCount switch
164163 {
0 commit comments