2 files changed
+7
-2
No files matched your search
+4
-2
@@ -124,7 +124,7 @@ fn rev_hpredict(image: DecodingResult, size: (u32, u32), color_type: ColorType)
|
|||||||
let samples = match color_type {
|
let samples = match color_type {
|
||||||
ColorType::Gray(8) | ColorType::Gray(16) => 1,
|
ColorType::Gray(8) | ColorType::Gray(16) => 1,
|
||||||
ColorType::RGB(8) | ColorType::RGB(16) => 3,
|
ColorType::RGB(8) | ColorType::RGB(16) => 3,
|
||||||
ColorType::RGBA(8) | ColorType::RGBA(16) => 4,
|
ColorType::RGBA(8) | ColorType::RGBA(16) | ColorType::CMYK(8) => 4,
|
||||||
_ => return Err(TiffError::UnsupportedError(format!(
|
_ => return Err(TiffError::UnsupportedError(format!(
|
||||||
"Horizontal predictor for {:?} is unsupported.", color_type
|
"Horizontal predictor for {:?} is unsupported.", color_type
|
||||||
)))
|
)))
|
||||||
@@ -167,6 +167,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
PhotometricInterpretation::RGB if self.bits_per_sample == [8, 8, 8] => Ok(ColorType::RGB(8)),
|
PhotometricInterpretation::RGB if self.bits_per_sample == [8, 8, 8] => Ok(ColorType::RGB(8)),
|
||||||
PhotometricInterpretation::RGB if self.bits_per_sample == [16, 16, 16, 16] => Ok(ColorType::RGBA(16)),
|
PhotometricInterpretation::RGB if self.bits_per_sample == [16, 16, 16, 16] => Ok(ColorType::RGBA(16)),
|
||||||
PhotometricInterpretation::RGB if self.bits_per_sample == [16, 16, 16] => Ok(ColorType::RGB(16)),
|
PhotometricInterpretation::RGB if self.bits_per_sample == [16, 16, 16] => Ok(ColorType::RGB(16)),
|
||||||
|
PhotometricInterpretation::CMYK if self.bits_per_sample == [8, 8, 8, 8] => Ok(ColorType::CMYK(8)),
|
||||||
PhotometricInterpretation::BlackIsZero | PhotometricInterpretation::WhiteIsZero
|
PhotometricInterpretation::BlackIsZero | PhotometricInterpretation::WhiteIsZero
|
||||||
if self.bits_per_sample.len() == 1 => Ok(ColorType::Gray(self.bits_per_sample[0])),
|
if self.bits_per_sample.len() == 1 => Ok(ColorType::Gray(self.bits_per_sample[0])),
|
||||||
|
|
||||||
@@ -419,7 +420,8 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
};
|
};
|
||||||
Ok(match (color_type, buffer) {
|
Ok(match (color_type, buffer) {
|
||||||
(ColorType:: RGB(8), DecodingBuffer::U8(ref mut buffer)) |
|
(ColorType:: RGB(8), DecodingBuffer::U8(ref mut buffer)) |
|
||||||
(ColorType::RGBA(8), DecodingBuffer::U8(ref mut buffer)) => {
|
(ColorType::RGBA(8), DecodingBuffer::U8(ref mut buffer)) |
|
||||||
|
(ColorType::CMYK(8), DecodingBuffer::U8(ref mut buffer)) => {
|
||||||
try!(reader.read(&mut buffer[..bytes]))
|
try!(reader.read(&mut buffer[..bytes]))
|
||||||
}
|
}
|
||||||
(ColorType::RGBA(16), DecodingBuffer::U16(ref mut buffer)) |
|
(ColorType::RGBA(16), DecodingBuffer::U16(ref mut buffer)) |
|
||||||
|
|||||||
@@ -33,4 +33,7 @@ pub enum ColorType {
|
|||||||
|
|
||||||
/// Pixel is RGB with an alpha channel
|
/// Pixel is RGB with an alpha channel
|
||||||
RGBA(u8),
|
RGBA(u8),
|
||||||
|
|
||||||
|
/// Pixel is CMYK
|
||||||
|
CMYK(u8),
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user