Struct gif::reader::converter::PixelConverter
source · pub(crate) struct PixelConverter {
memory_limit: MemoryLimit,
color_output: ColorOutput,
buffer: Vec<u8>,
global_palette: Option<Vec<u8>>,
}
Expand description
Deinterlaces and expands to RGBA if needed
Fields§
§memory_limit: MemoryLimit
§color_output: ColorOutput
§buffer: Vec<u8>
§global_palette: Option<Vec<u8>>
Implementations§
source§impl PixelConverter
impl PixelConverter
pub(crate) fn new(color_output: ColorOutput, memory_limit: MemoryLimit) -> Self
pub(crate) fn check_buffer_size( &mut self, frame: &Frame<'_>, ) -> Result<usize, DecodingError>
pub(crate) fn read_frame( &mut self, frame: &mut Frame<'_>, data_callback: &'_ mut dyn FnMut(&mut OutputBuffer<'_>) -> Result<usize, DecodingError>, ) -> Result<(), DecodingError>
pub(crate) fn buffer_size(&self, frame: &Frame<'_>) -> Option<usize>
pub(crate) fn line_length(&self, frame: &Frame<'_>) -> usize
sourcepub(crate) fn fill_buffer(
&mut self,
current_frame: &Frame<'_>,
buf: &mut [u8],
data_callback: &'_ mut dyn FnMut(&mut OutputBuffer<'_>) -> Result<usize, DecodingError>,
) -> Result<bool, DecodingError>
pub(crate) fn fill_buffer( &mut self, current_frame: &Frame<'_>, buf: &mut [u8], data_callback: &'_ mut dyn FnMut(&mut OutputBuffer<'_>) -> Result<usize, DecodingError>, ) -> Result<bool, DecodingError>
Use read_into_buffer
to deinterlace
pub(crate) fn global_palette(&self) -> Option<&[u8]>
pub(crate) fn set_global_palette(&mut self, palette: Vec<u8>)
sourcepub(crate) fn read_into_buffer(
&mut self,
frame: &Frame<'_>,
buf: &mut [u8],
data_callback: &'_ mut dyn FnMut(&mut OutputBuffer<'_>) -> Result<usize, DecodingError>,
) -> Result<(), DecodingError>
pub(crate) fn read_into_buffer( &mut self, frame: &Frame<'_>, buf: &mut [u8], data_callback: &'_ mut dyn FnMut(&mut OutputBuffer<'_>) -> Result<usize, DecodingError>, ) -> Result<(), DecodingError>
Applies deinterlacing
Set frame.interlaced = false
afterwards if you’re putting the buffer back into the Frame
Auto Trait Implementations§
impl Freeze for PixelConverter
impl RefUnwindSafe for PixelConverter
impl Send for PixelConverter
impl Sync for PixelConverter
impl Unpin for PixelConverter
impl UnwindSafe for PixelConverter
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