pub struct StreamWriter<'a, W: Write> { /* private fields */ }
Expand description
Implementations§
Source§impl<'a, W: Write> StreamWriter<'a, W>
impl<'a, W: Write> StreamWriter<'a, W>
Sourcepub fn set_filter(&mut self, filter: Filter)
pub fn set_filter(&mut self, filter: Filter)
Set the used filter type.
The default filter is Filter::Adaptive
which automatically selects the best filter
for each row of the image.
You should only change this if you are after very fast compression, and either don’t care about compression ratio or know exactly what works best for your images.
Sourcepub fn set_frame_delay(
&mut self,
numerator: u16,
denominator: u16,
) -> Result<(), EncodingError>
pub fn set_frame_delay( &mut self, numerator: u16, denominator: u16, ) -> Result<(), EncodingError>
Set the fraction of time the following frames are going to be displayed, in seconds
If the denominator is 0, it is to be treated as if it were 100 (that is, the numerator then specifies 1/100ths of a second). If the value of the numerator is 0 the decoder should render the next frame as quickly as possible, though viewers may impose a reasonable lower bound.
This method will return an error if the image is not animated.
Sourcepub fn set_frame_dimension(
&mut self,
width: u32,
height: u32,
) -> Result<(), EncodingError>
pub fn set_frame_dimension( &mut self, width: u32, height: u32, ) -> Result<(), EncodingError>
Set the dimension of the following frames.
This function will return an error when:
-
The image is not an animated;
-
The selected dimension, considering also the current frame position, goes outside the image boundaries;
-
One or both the width and height are 0;
Sourcepub fn set_frame_position(
&mut self,
x: u32,
y: u32,
) -> Result<(), EncodingError>
pub fn set_frame_position( &mut self, x: u32, y: u32, ) -> Result<(), EncodingError>
Set the position of the following frames.
An error will be returned if:
-
The image is not animated;
-
The selected position, considering also the current frame dimension, goes outside the image boundaries;
Sourcepub fn reset_frame_dimension(&mut self) -> Result<(), EncodingError>
pub fn reset_frame_dimension(&mut self) -> Result<(), EncodingError>
Set the frame dimension to occupy all the image, starting from the current position.
To reset the frame to the full image size reset_frame_position
should be called first.
This method will return an error if the image is not animated.
Sourcepub fn reset_frame_position(&mut self) -> Result<(), EncodingError>
pub fn reset_frame_position(&mut self) -> Result<(), EncodingError>
Set the frame position to (0, 0).
Equivalent to calling set_frame_position(0, 0)
.
This method will return an error if the image is not animated.
Sourcepub fn set_blend_op(&mut self, op: BlendOp) -> Result<(), EncodingError>
pub fn set_blend_op(&mut self, op: BlendOp) -> Result<(), EncodingError>
Set the blend operation for the following frames.
The blend operation specifies whether the frame is to be alpha blended into the current output buffer content, or whether it should completely replace its region in the output buffer.
See the BlendOp
documentation for the possible values and their effects.
Note that for the first frame the two blend modes are functionally equivalent due to the clearing of the output buffer at the beginning of each play.
This method will return an error if the image is not animated.
Sourcepub fn set_dispose_op(&mut self, op: DisposeOp) -> Result<(), EncodingError>
pub fn set_dispose_op(&mut self, op: DisposeOp) -> Result<(), EncodingError>
Set the dispose operation for the following frames.
The dispose operation specifies how the output buffer should be changed at the end of the delay (before rendering the next frame)
See the DisposeOp
documentation for the possible values and their effects.
Note that if the first frame uses DisposeOp::Previous
it will be treated as DisposeOp::Background
.
This method will return an error if the image is not animated.
Sourcepub fn finish(self) -> Result<(), EncodingError>
pub fn finish(self) -> Result<(), EncodingError>
Consume the stream writer with validation.
Unlike a simple drop this ensures that the all data was written correctly. When other
validation options (chunk sequencing) had been turned on in the configuration of inner
Writer
, then it will also do a check on their correctness. Differently from
Writer::finish
, this just flush
es, returns error if some data is abandoned.
Trait Implementations§
Source§impl<W: Write> Drop for StreamWriter<'_, W>
impl<W: Write> Drop for StreamWriter<'_, W>
Source§impl<'a, W: Write> Write for StreamWriter<'a, W>
impl<'a, W: Write> Write for StreamWriter<'a, W>
Source§fn write(&mut self, data: &[u8]) -> Result<usize>
fn write(&mut self, data: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)