Skip to main content

FlateScanlineDecoder

Struct FlateScanlineDecoder 

Source
pub struct FlateScanlineDecoder { /* private fields */ }
Expand description

Scanline decoder for FlateDecode (zlib/deflate) data.

Decompresses the full data internally on construction, then yields row_stride bytes per decode_scanline call.

Implementations§

Source§

impl FlateScanlineDecoder

Source

pub fn new( compressed: &[u8], width: u32, height: u32, comps: u8, bpc: u8, ) -> Result<Self, DecodeError>

Create a new scanline decoder from compressed Flate data.

The row stride is computed automatically as (width * comps * bpc + 7) / 8, matching PDFium’s pitch formula.

Source

pub fn from_decoded( data: Vec<u8>, width: u32, height: u32, comps: u8, bpc: u8, ) -> Self

Create from already-decompressed pixel data.

Trait Implementations§

Source§

impl ScanlineDecoder for FlateScanlineDecoder

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 count_comps(&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 * count_comps * bpc + 7) / 8.
Source§

fn decode_scanline(&mut self) -> Result<Option<&[u8]>, DecodeError>

Decode and return the next scanline. Read more
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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.