Fix capitalization case of sample format enum
This commit is contained in:
1 parent
8d4bdce7aa
commit
ae4ae9c36e
3 files changed
+22
-22
No files matched your search
+3
-3
@@ -306,7 +306,7 @@ impl<R: Read + Seek> Decoder<R> {
|
||||
height: 0,
|
||||
bits_per_sample: vec![1],
|
||||
samples: 1,
|
||||
sample_format: vec![SampleFormat::UINT],
|
||||
sample_format: vec![SampleFormat::Uint],
|
||||
photometric_interpretation: PhotometricInterpretation::BlackIsZero,
|
||||
compression_method: CompressionMethod::None,
|
||||
strip_decoder: None,
|
||||
@@ -884,8 +884,8 @@ impl<R: Read + Seek> Decoder<R> {
|
||||
let buffer_size = usize::try_from(self.width)? * height * self.bits_per_sample.len();
|
||||
|
||||
let max_sample_bits = self.bits_per_sample.iter().cloned().max().unwrap_or(8);
|
||||
match self.sample_format.first().unwrap_or(&SampleFormat::UINT) {
|
||||
SampleFormat::UINT => match max_sample_bits {
|
||||
match self.sample_format.first().unwrap_or(&SampleFormat::Uint) {
|
||||
SampleFormat::Uint => match max_sample_bits {
|
||||
n if n <= 8 => DecodingResult::new_u8(buffer_size, &self.limits),
|
||||
n if n <= 16 => DecodingResult::new_u16(buffer_size, &self.limits),
|
||||
n if n <= 32 => DecodingResult::new_u32(buffer_size, &self.limits),
|
||||
|
||||
+16
-16
@@ -17,7 +17,7 @@ impl ColorType for Gray8 {
|
||||
type Inner = u8;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::BlackIsZero;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[8];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint];
|
||||
}
|
||||
|
||||
pub struct Gray16;
|
||||
@@ -25,7 +25,7 @@ impl ColorType for Gray16 {
|
||||
type Inner = u16;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::BlackIsZero;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[16];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint];
|
||||
}
|
||||
|
||||
pub struct Gray32;
|
||||
@@ -33,7 +33,7 @@ impl ColorType for Gray32 {
|
||||
type Inner = u32;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::BlackIsZero;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[32];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint];
|
||||
}
|
||||
|
||||
pub struct Gray32Float;
|
||||
@@ -49,7 +49,7 @@ impl ColorType for Gray64 {
|
||||
type Inner = u64;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::BlackIsZero;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[64];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint];
|
||||
}
|
||||
|
||||
pub struct Gray64Float;
|
||||
@@ -65,7 +65,7 @@ impl ColorType for RGB8 {
|
||||
type Inner = u8;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[8, 8, 8];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 3];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 3];
|
||||
}
|
||||
|
||||
pub struct RGB16;
|
||||
@@ -73,7 +73,7 @@ impl ColorType for RGB16 {
|
||||
type Inner = u16;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[16, 16, 16];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 3];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 3];
|
||||
}
|
||||
|
||||
pub struct RGB32;
|
||||
@@ -81,7 +81,7 @@ impl ColorType for RGB32 {
|
||||
type Inner = u32;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[32, 32, 32];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 3];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 3];
|
||||
}
|
||||
|
||||
pub struct RGB32Float;
|
||||
@@ -97,7 +97,7 @@ impl ColorType for RGB64 {
|
||||
type Inner = u64;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[64, 64, 64];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 3];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 3];
|
||||
}
|
||||
|
||||
pub struct RGB64Float;
|
||||
@@ -113,7 +113,7 @@ impl ColorType for RGBA8 {
|
||||
type Inner = u8;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[8, 8, 8, 8];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct RGBA16;
|
||||
@@ -121,7 +121,7 @@ impl ColorType for RGBA16 {
|
||||
type Inner = u16;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[16, 16, 16, 16];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct RGBA32;
|
||||
@@ -129,7 +129,7 @@ impl ColorType for RGBA32 {
|
||||
type Inner = u32;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[32, 32, 32, 32];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct RGBA32Float;
|
||||
@@ -145,7 +145,7 @@ impl ColorType for RGBA64 {
|
||||
type Inner = u64;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::RGB;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[64, 64, 64, 64];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct RGBA64Float;
|
||||
@@ -161,7 +161,7 @@ impl ColorType for CMYK8 {
|
||||
type Inner = u8;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[8, 8, 8, 8];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct CMYK16;
|
||||
@@ -169,7 +169,7 @@ impl ColorType for CMYK16 {
|
||||
type Inner = u16;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[16, 16, 16, 16];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct CMYK32;
|
||||
@@ -177,7 +177,7 @@ impl ColorType for CMYK32 {
|
||||
type Inner = u32;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[32, 32, 32, 32];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct CMYK32Float;
|
||||
@@ -193,7 +193,7 @@ impl ColorType for CMYK64 {
|
||||
type Inner = u64;
|
||||
const TIFF_VALUE: PhotometricInterpretation = PhotometricInterpretation::CMYK;
|
||||
const BITS_PER_SAMPLE: &'static [u16] = &[64, 64, 64, 64];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::UINT; 4];
|
||||
const SAMPLE_FORMAT: &'static [SampleFormat] = &[SampleFormat::Uint; 4];
|
||||
}
|
||||
|
||||
pub struct CMYK64Float;
|
||||
|
||||
+3
-3
@@ -187,9 +187,9 @@ pub enum ResolutionUnit(u16) {
|
||||
|
||||
tags! {
|
||||
pub enum SampleFormat(u16) {
|
||||
UINT = 1,
|
||||
INT = 2,
|
||||
Uint = 1,
|
||||
Int = 2,
|
||||
IEEEFP = 3,
|
||||
VOID = 4,
|
||||
Void = 4,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user