diff --git a/Cargo.toml b/Cargo.toml index affd254..c61633b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,8 @@ exclude = ["tests/images/*", "tests/fuzz_images/*"] half = { version = "2.4.1" } quick-error = "2.0.1" -fax = { version = "0.2.4", optional = true } +# Rename to avoid confusion with the feature name. +fax34 = { package = "fax", version = "0.2.4", optional = true } flate2 = { version = "1.0.20", optional = true } weezl = { version = "0.1.10", optional = true } zstd = { version = "0.13", optional = true } @@ -36,6 +37,7 @@ default = ["deflate", "jpeg", "lzw"] # Compression algorithms deflate = ["dep:flate2"] +fax = ["dep:fax34"] jpeg = ["dep:zune-jpeg"] lzw = ["dep:weezl"] zstd = ["dep:zstd"] diff --git a/src/decoder/stream.rs b/src/decoder/stream.rs index 6de9a37..d0b05a5 100644 --- a/src/decoder/stream.rs +++ b/src/decoder/stream.rs @@ -277,7 +277,7 @@ impl Read for PackBitsReader { #[cfg(feature = "fax")] pub struct Group4Reader { - decoder: fax::decoder::Group4Decoder>>>, + decoder: fax34::decoder::Group4Decoder>>>, line_buf: io::Cursor>, height: u16, width: u16, @@ -295,7 +295,7 @@ impl Group4Reader { let height = u16::try_from(dimensions.1)?; Ok(Self { - decoder: fax::decoder::Group4Decoder::new( + decoder: fax34::decoder::Group4Decoder::new( io::BufReader::new(reader.take(compressed_length)).bytes(), width, )?, @@ -317,12 +317,12 @@ impl Read for Group4Reader { let next = self.decoder.advance().map_err(std::io::Error::other)?; match next { - fax::decoder::DecodeStatus::End => (), - fax::decoder::DecodeStatus::Incomplete => { + fax34::decoder::DecodeStatus::End => (), + fax34::decoder::DecodeStatus::Incomplete => { self.y += 1; // We known `transitions` yields exactly `self.width` items (per doc). - let transitions = fax::decoder::pels(self.decoder.transition(), self.width); + let transitions = fax34::decoder::pels(self.decoder.transition(), self.width); let buffer = self.line_buf.get_mut(); buffer.resize(usize::from(self.width).div_ceil(8), 0u8); @@ -330,8 +330,8 @@ impl Read for Group4Reader { let target = &mut buffer[..]; let mut bits = transitions.map(|c| match c { - fax::Color::Black => true, - fax::Color::White => false, + fax34::Color::Black => true, + fax34::Color::White => false, }); // Assemble bits in MSB as per our library representation for buffer.