pub struct RandomAccessDecoder<D: ScanlineDecoder> { /* private fields */ }Expand description
Random-access scanline decoder wrapper.
Wraps any ScanlineDecoder and adds get_scanline(line) support with
caching and rewind logic. Ported from upstream PDFium’s
ScanlineDecoder::GetScanline(int line).
Implementations§
Source§impl<D: ScanlineDecoder> RandomAccessDecoder<D>
impl<D: ScanlineDecoder> RandomAccessDecoder<D>
Sourcepub fn skip_to_scanline(&mut self, target: usize)
pub fn skip_to_scanline(&mut self, target: usize)
Skip to scanline target by warming the cache via scanline().
Overrides the sequential decode-and-discard loop from ScanlineDecoder
with the random-access cache path. Mirrors PDFium’s
ScanlineDecoder::SkipToScanline().
This is a Tier-1 primary: the body calls another rpdfium function
(scanline()) and discards its Result return value, so it is not a
pure Tier-2 delegation and must not carry #[inline].
Sourcepub fn scanline(&mut self, line: usize) -> Result<Option<&[u8]>, DecodeError>
pub fn scanline(&mut self, line: usize) -> Result<Option<&[u8]>, DecodeError>
Get a specific scanline by line index (0-based).
If the requested line is the one just decoded, returns a cached copy. If the requested line is before the current position, rewinds and re-reads sequentially. Matches upstream PDFium’s caching pattern.
Primary name; get_scanline is the
upstream-style alias. Mirrors PDFium’s ScanlineDecoder::GetScanline().
Sourcepub fn get_scanline(
&mut self,
line: usize,
) -> Result<Option<&[u8]>, DecodeError>
pub fn get_scanline( &mut self, line: usize, ) -> Result<Option<&[u8]>, DecodeError>
Upstream alias for scanline(). Mirrors PDFium’s GetScanline().
Sourcepub fn get_height(&self) -> u32
pub fn get_height(&self) -> u32
Upstream alias for height(). Mirrors PDFium’s GetHeight().
Sourcepub fn comps_count(&self) -> u8
pub fn comps_count(&self) -> u8
Number of color components per pixel. Mirrors PDFium’s CountComps().
Sourcepub fn count_comps(&self) -> u8
pub fn count_comps(&self) -> u8
Upstream alias for comps_count(). Mirrors PDFium’s CountComps().
Sourcepub fn row_stride(&self) -> usize
pub fn row_stride(&self) -> usize
Number of bytes per row.