pub struct RefEnc { /* private fields */ }Expand description
Reference single-image encoder. Supports one-shot encode and incremental
push_rows + finish; declines the pull path (encode_from).
After begin the header is written at once and each
pushed row is appended to the output, which
pending_output exposes: the streaming
encoder pattern. Without begin, rows accumulate and the file is built
at finish.
Trait Implementations§
Source§impl Encoder for RefEnc
impl Encoder for RefEnc
Source§fn reject(op: UnsupportedOperation) -> RefError
fn reject(op: UnsupportedOperation) -> RefError
Convert an
UnsupportedOperation into this
encoder’s error type. Read moreSource§fn preferred_strip_height(&self) -> u32
fn preferred_strip_height(&self) -> u32
Suggested strip height for optimal row-level encoding. Read more
Source§fn encode(self, pixels: PixelSlice<'_>) -> Result<EncodeOutput, RefError>
fn encode(self, pixels: PixelSlice<'_>) -> Result<EncodeOutput, RefError>
Encode a complete image at once (consumes self).
Source§fn begin(
&mut self,
width: u32,
height: u32,
desc: PixelDescriptor,
) -> Result<OutputTiming, RefError>
fn begin( &mut self, width: u32, height: u32, desc: PixelDescriptor, ) -> Result<OutputTiming, RefError>
Source§fn push_rows(&mut self, rows: PixelSlice<'_>) -> Result<(), RefError>
fn push_rows(&mut self, rows: PixelSlice<'_>) -> Result<(), RefError>
Push scanline rows incrementally. Read more
Source§fn consume_output(&mut self, n: usize)
fn consume_output(&mut self, n: usize)
Mark the first
n bytes of pending_output
as sent. An n larger than the pending length marks all of it.
Default: no-op.Source§fn take_output(&mut self, into: &mut Vec<u8>)
fn take_output(&mut self, into: &mut Vec<u8>)
Append every pending byte to
into and consume it: the same as
copying pending_output and calling
consume_output with its length. Read moreSource§fn finish(self) -> Result<EncodeOutput, RefError>
fn finish(self) -> Result<EncodeOutput, RefError>
Finalize after push_rows. Returns encoded output. Read more
Source§fn encode_srgba8(
self,
data: &mut [u8],
make_opaque: bool,
width: u32,
height: u32,
stride_pixels: u32,
) -> Result<EncodeOutput, Self::Error>
fn encode_srgba8( self, data: &mut [u8], make_opaque: bool, width: u32, height: u32, stride_pixels: u32, ) -> Result<EncodeOutput, Self::Error>
Encode from sRGB(A) 8-bit pixels provided as raw bytes. Read more
Source§fn begin_declared(
&mut self,
_declaration: &EncodeDeclaration<'_>,
) -> Result<EncodePlan, Self::Error>
fn begin_declared( &mut self, _declaration: &EncodeDeclaration<'_>, ) -> Result<EncodePlan, Self::Error>
Start with the same complete declaration admitted during job planning. Read more
Source§fn pull_rows(
&mut self,
_rows: &mut dyn EncodeRows,
_pulse: Option<&dyn Pulse>,
) -> Result<PullProgress, Self::Error>
fn pull_rows( &mut self, _rows: &mut dyn EncodeRows, _pulse: Option<&dyn Pulse>, ) -> Result<PullProgress, Self::Error>
Advance an admitted encoder-driven row plan by at most one source fill. Read more
Source§fn begin_output(
&mut self,
width: u32,
height: u32,
descriptor: PixelDescriptor,
access: OutputAccess,
) -> Result<OutputTiming, Self::Error>
fn begin_output( &mut self, width: u32, height: u32, descriptor: PixelDescriptor, access: OutputAccess, ) -> Result<OutputTiming, Self::Error>
Prepare row encoding for actual destination access. The default uses
the existing forward-only begin path without changing configuration.
A patching implementation must refuse Forward before exposing bytes,
report
OutputTiming::with_patches, and complete with finish_output.
Legacy begin/finish must never silently discard required patches.
Access permits framing choices, never implicit quality/metadata changes.Source§fn finish_output(self) -> Result<OutputFinish<EncodeOutput>, Self::Error>
fn finish_output(self) -> Result<OutputFinish<EncodeOutput>, Self::Error>
Complete negotiated output, retaining ordered patches for the driver.
The default transfers the legacy finish allocation without copying.
The tail retains EncodeOutput format, MIME and extension/statistics data.
Source§fn encode_from(
self,
_source: &mut dyn FnMut(u32, PixelSliceMut<'_>) -> usize,
) -> Result<EncodeOutput, Self::Error>
fn encode_from( self, _source: &mut dyn FnMut(u32, PixelSliceMut<'_>) -> usize, ) -> Result<EncodeOutput, Self::Error>
Encode by pulling rows from a source callback. Read more
Auto Trait Implementations§
impl Freeze for RefEnc
impl RefUnwindSafe for RefEnc
impl Send for RefEnc
impl Sync for RefEnc
impl Unpin for RefEnc
impl UnsafeUnpin for RefEnc
impl UnwindSafe for RefEnc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more