pub trait ScanlineDecoder {
Show 15 methods
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn comps_count(&self) -> u8;
fn bpc(&self) -> u8;
fn row_stride(&self) -> usize;
fn decode_scanline(&mut self) -> Result<Option<&[u8]>, DecodeError>;
fn reset(&mut self) -> Result<(), DecodeError>;
fn current_line(&self) -> Option<usize>;
// Provided methods
fn get_width(&self) -> u32 { ... }
fn get_height(&self) -> u32 { ... }
fn count_comps(&self) -> u8 { ... }
fn get_bpc(&self) -> u8 { ... }
fn skip_to_scanline(&mut self, target: usize) { ... }
fn src_offset(&self) -> Option<usize> { ... }
fn get_src_offset(&self) -> Option<usize> { ... }
}Expand description
A scanline-based image decoder that yields one row of pixels at a time.
After construction, call decode_scanline
repeatedly to get each row. Returns Ok(None) after the last row.
Call reset to restart from the first row.
Mirrors PDFium’s ScanlineDecoder base class interface, including the
image-geometry accessors GetWidth(), GetHeight(), CountComps(),
and GetBPC().
Required Methods§
Sourcefn comps_count(&self) -> u8
fn comps_count(&self) -> u8
Number of color components per pixel (e.g. 1 for gray, 3 for RGB, 4
for CMYK). Mirrors PDFium’s CountComps().
Sourcefn row_stride(&self) -> usize
fn row_stride(&self) -> usize
Number of bytes per row: (width * comps_count * bpc + 7) / 8.
Sourcefn decode_scanline(&mut self) -> Result<Option<&[u8]>, DecodeError>
fn decode_scanline(&mut self) -> Result<Option<&[u8]>, DecodeError>
Decode and return the next scanline.
Returns Ok(Some(data)) for each row, Ok(None) when all rows are
done.
Sourcefn reset(&mut self) -> Result<(), DecodeError>
fn reset(&mut self) -> Result<(), DecodeError>
Reset the decoder to the first scanline.
Sourcefn current_line(&self) -> Option<usize>
fn current_line(&self) -> Option<usize>
Current line index (0-based), or None if no lines have been read yet.
Provided Methods§
Sourcefn get_height(&self) -> u32
fn get_height(&self) -> u32
Upstream alias for height(). Mirrors PDFium’s GetHeight().
Sourcefn count_comps(&self) -> u8
fn count_comps(&self) -> u8
Upstream alias for comps_count(). Mirrors PDFium’s CountComps().
Sourcefn skip_to_scanline(&mut self, target: usize)
fn skip_to_scanline(&mut self, target: usize)
Skip ahead to scanline target by decoding and discarding intermediate lines.
After this call, current_line() will be >= Some(target) if the decoder
has at least target + 1 scanlines available.
The upstream SkipToScanline() accepted a PauseIndicatorIface pause parameter;
rpdfium omits pause/resume since the library is synchronous.
Sourcefn src_offset(&self) -> Option<usize>
fn src_offset(&self) -> Option<usize>
Returns the byte offset of the current source position in the compressed stream, if available.
Upstream GetSrcOffset() is used for progressive decode bookkeeping not needed in rpdfium’s
synchronous model.
Sourcefn get_src_offset(&self) -> Option<usize>
fn get_src_offset(&self) -> Option<usize>
Upstream alias for src_offset(). Mirrors PDFium’s GetSrcOffset().