Skip to main content

ScanlineDecoder

Trait ScanlineDecoder 

Source
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§

Source

fn width(&self) -> u32

Image width in pixels. Mirrors PDFium’s GetWidth().

Source

fn height(&self) -> u32

Image height in pixels. Mirrors PDFium’s GetHeight().

Source

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().

Source

fn bpc(&self) -> u8

Bits per color component (e.g. 1, 8, 16). Mirrors PDFium’s GetBPC().

Source

fn row_stride(&self) -> usize

Number of bytes per row: (width * comps_count * bpc + 7) / 8.

Source

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.

Source

fn reset(&mut self) -> Result<(), DecodeError>

Reset the decoder to the first scanline.

Source

fn current_line(&self) -> Option<usize>

Current line index (0-based), or None if no lines have been read yet.

Provided Methods§

Source

fn get_width(&self) -> u32

Upstream alias for width(). Mirrors PDFium’s GetWidth().

Source

fn get_height(&self) -> u32

Upstream alias for height(). Mirrors PDFium’s GetHeight().

Source

fn count_comps(&self) -> u8

Upstream alias for comps_count(). Mirrors PDFium’s CountComps().

Source

fn get_bpc(&self) -> u8

Upstream alias for bpc(). Mirrors PDFium’s GetBPC().

Source

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.

Source

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.

Source

fn get_src_offset(&self) -> Option<usize>

Upstream alias for src_offset(). Mirrors PDFium’s GetSrcOffset().

Implementors§