diff --git a/src/decoder/image.rs b/src/decoder/image.rs index afe6334..6d82d7f 100644 --- a/src/decoder/image.rs +++ b/src/decoder/image.rs @@ -358,7 +358,6 @@ impl Image { PhotometricInterpretation::BlackIsZero => { decoder.set_color_transform(jpeg::ColorTransform::None) } - PhotometricInterpretation::RGBPalette => todo!(), PhotometricInterpretation::TransparencyMask => { decoder.set_color_transform(jpeg::ColorTransform::None) } @@ -368,8 +367,13 @@ impl Image { PhotometricInterpretation::YCbCr => { decoder.set_color_transform(jpeg::ColorTransform::YCbCr) } - PhotometricInterpretation::CIELab => todo!(), - _ => todo!(), + photometric_interpretation => { + return Err(TiffError::UnsupportedError( + TiffUnsupportedError::UnsupportedInterpretation( + photometric_interpretation, + ), + )); + } } let data = decoder.decode()?; diff --git a/src/error.rs b/src/error.rs index 0f979bb..d191295 100644 --- a/src/error.rs +++ b/src/error.rs @@ -148,10 +148,8 @@ pub enum TiffUnsupportedError { UnsupportedBitsPerChannel(u8), UnsupportedPlanarConfig(Option), UnsupportedDataType, + UnsupportedInterpretation(PhotometricInterpretation), UnsupportedJpegFeature(UnsupportedFeature), - #[doc(hidden)] - /// Do not match against this variant. It may get removed. - __NonExhaustive, } impl fmt::Display for TiffUnsupportedError { @@ -197,10 +195,16 @@ impl fmt::Display for TiffUnsupportedError { write!(fmt, "Unsupported planar configuration “{:?}”.", config) } UnsupportedDataType => write!(fmt, "Unsupported data type."), + UnsupportedInterpretation(interpretation) => { + write!( + fmt, + "Unsupported photometric interpretation \"{:?}\".", + interpretation + ) + } UnsupportedJpegFeature(ref unsupported_feature) => { write!(fmt, "Unsupported JPEG feature {:?}", unsupported_feature) } - __NonExhaustive => unreachable!(), } } }