@ -14,6 +14,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
MemoryAllocator memoryAllocator ,
MemoryAllocator memoryAllocator ,
TiffColorType colorType ,
TiffColorType colorType ,
TiffBitsPerSample bitsPerSample ,
TiffBitsPerSample bitsPerSample ,
TiffExtraSampleType ? extraSampleType ,
ushort [ ] colorMap ,
ushort [ ] colorMap ,
Rational [ ] referenceBlackAndWhite ,
Rational [ ] referenceBlackAndWhite ,
Rational [ ] ycbcrCoefficients ,
Rational [ ] ycbcrCoefficients ,
@ -125,7 +126,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 2 ,
& & bitsPerSample . Channel0 = = 2 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb333 :
case TiffColorType . Rgb333 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -146,7 +147,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 3 ,
& & bitsPerSample . Channel0 = = 3 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb444 :
case TiffColorType . Rgb444 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -167,7 +168,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 4 ,
& & bitsPerSample . Channel0 = = 4 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb555 :
case TiffColorType . Rgb555 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -188,7 +189,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 5 ,
& & bitsPerSample . Channel0 = = 5 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb666 :
case TiffColorType . Rgb666 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -209,7 +210,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 6 ,
& & bitsPerSample . Channel0 = = 6 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb888 :
case TiffColorType . Rgb888 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -230,7 +231,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 8 ,
& & bitsPerSample . Channel0 = = 8 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba8888TiffColor < TPixel > ( configuration ) ;
return new Rgba8888TiffColor < TPixel > ( configuration , memoryAllocator , extraSampleType ) ;
case TiffColorType . Rgb101010 :
case TiffColorType . Rgb101010 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -251,7 +252,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 1 0 ,
& & bitsPerSample . Channel0 = = 1 0 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb121212 :
case TiffColorType . Rgb121212 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -272,7 +273,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 1 2 ,
& & bitsPerSample . Channel0 = = 1 2 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb141414 :
case TiffColorType . Rgb141414 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -293,7 +294,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 1 4 ,
& & bitsPerSample . Channel0 = = 1 4 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . Rgb161616 :
case TiffColorType . Rgb161616 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -314,7 +315,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 1 6 ,
& & bitsPerSample . Channel0 = = 1 6 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba16161616TiffColor < TPixel > ( configuration , isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba16161616TiffColor < TPixel > ( configuration , memoryAllocator , extraSampleType , isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
case TiffColorType . Rgb242424 :
case TiffColorType . Rgb242424 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -335,7 +336,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 2 4 ,
& & bitsPerSample . Channel0 = = 2 4 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba24242424TiffColor < TPixel > ( isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba24242424TiffColor < TPixel > ( extraSampleType , isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
case TiffColorType . Rgb323232 :
case TiffColorType . Rgb323232 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -356,7 +357,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
& & bitsPerSample . Channel0 = = 3 2 ,
& & bitsPerSample . Channel0 = = 3 2 ,
"bitsPerSample" ) ;
"bitsPerSample" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba32323232TiffColor < TPixel > ( isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba32323232TiffColor < TPixel > ( extraSampleType , isBigEndian : byteOrder = = ByteOrder . BigEndian ) ;
case TiffColorType . RgbFloat323232 :
case TiffColorType . RgbFloat323232 :
DebugGuard . IsTrue (
DebugGuard . IsTrue (
@ -394,6 +395,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
public static TiffBasePlanarColorDecoder < TPixel > CreatePlanar (
public static TiffBasePlanarColorDecoder < TPixel > CreatePlanar (
TiffColorType colorType ,
TiffColorType colorType ,
TiffBitsPerSample bitsPerSample ,
TiffBitsPerSample bitsPerSample ,
TiffExtraSampleType ? extraSampleType ,
ushort [ ] colorMap ,
ushort [ ] colorMap ,
Rational [ ] referenceBlackAndWhite ,
Rational [ ] referenceBlackAndWhite ,
Rational [ ] ycbcrCoefficients ,
Rational [ ] ycbcrCoefficients ,
@ -408,7 +410,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
case TiffColorType . Rgba8888Planar :
case TiffColorType . Rgba8888Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new RgbaPlanarTiffColor < TPixel > ( bitsPerSample ) ;
return new RgbaPlanarTiffColor < TPixel > ( extraSampleType , bitsPerSample ) ;
case TiffColorType . YCbCrPlanar :
case TiffColorType . YCbCrPlanar :
return new YCbCrPlanarTiffColor < TPixel > ( referenceBlackAndWhite , ycbcrCoefficients , ycbcrSubSampling ) ;
return new YCbCrPlanarTiffColor < TPixel > ( referenceBlackAndWhite , ycbcrCoefficients , ycbcrSubSampling ) ;
@ -419,7 +421,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
case TiffColorType . Rgba16161616Planar :
case TiffColorType . Rgba16161616Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba16PlanarTiffColor < TPixel > ( byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba16PlanarTiffColor < TPixel > ( extraSampleType , byteOrder = = ByteOrder . BigEndian ) ;
case TiffColorType . Rgb242424Planar :
case TiffColorType . Rgb242424Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
@ -427,7 +429,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
case TiffColorType . Rgba24242424Planar :
case TiffColorType . Rgba24242424Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba24PlanarTiffColor < TPixel > ( byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba24PlanarTiffColor < TPixel > ( extraSampleType , byteOrder = = ByteOrder . BigEndian ) ;
case TiffColorType . Rgb323232Planar :
case TiffColorType . Rgb323232Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
@ -435,7 +437,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
case TiffColorType . Rgba32323232Planar :
case TiffColorType . Rgba32323232Planar :
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
DebugGuard . IsTrue ( colorMap = = null , "colorMap" ) ;
return new Rgba32PlanarTiffColor < TPixel > ( byteOrder = = ByteOrder . BigEndian ) ;
return new Rgba32PlanarTiffColor < TPixel > ( extraSampleType , byteOrder = = ByteOrder . BigEndian ) ;
default :
default :
throw TiffThrowHelper . InvalidColorType ( colorType . ToString ( ) ) ;
throw TiffThrowHelper . InvalidColorType ( colorType . ToString ( ) ) ;