Allow non-chained directories in writer
This is just the implementation details. In the DirectoryEncoder we did not differentiate between different directories that should go into the main image chain and other directories. This is now possible by storing the prior offset as an explicit Option<NonZeroU64>. Additionally, the whole encoder did not allow any intermediate data between its last directory and new directories on the chain. The offset of the relevant `next` field was not stored explicitly but derived from the current stream position at the moment of starting the directory. This would not allow any padding data or data written outside the returned `DirectoryEncoder` object. This relaxed both requirements by turning the offsets into attributes.
This commit is contained in:
1 parent
9b0c9ca84c
commit
54f733eaa3
2 files changed
+58
-23
No files matched your search
@@ -69,6 +69,10 @@ impl<W: Write> TiffWriter<W> {
|
||||
self.offset
|
||||
}
|
||||
|
||||
pub(crate) fn previous_ifd_pointer<K: super::TiffKind>(&self) -> u64 {
|
||||
self.offset() - core::mem::size_of::<K::OffsetType>() as u64
|
||||
}
|
||||
|
||||
pub fn last_written(&self) -> u64 {
|
||||
self.byte_count
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user