Struct windows_capture::encoder::ImageEncoder
source ยท pub struct ImageEncoder { /* private fields */ }Expand description
The ImageEncoder struct represents an image encoder that can be used to encode image buffers to image bytes with a specified format and color format.
Implementationsยง
sourceยงimpl ImageEncoder
impl ImageEncoder
sourcepub const fn new(format: ImageFormat, color_format: ColorFormat) -> Self
pub const fn new(format: ImageFormat, color_format: ColorFormat) -> Self
sourcepub fn encode(
&self,
image_buffer: &[u8],
width: u32,
height: u32
) -> Result<Vec<u8>, ImageEncoderError>
pub fn encode( &self, image_buffer: &[u8], width: u32, height: u32 ) -> Result<Vec<u8>, ImageEncoderError>
Encode the image buffer to image bytes with the specified format.
ยงArguments
image_buffer- The image buffer to encode.width- The width of the image.height- The height of the image.
ยงReturns
The encoded image bytes as a Vec<u8>.
ยงErrors
Returns an Error if the encoding fails or if the color format is unsupported.
Auto Trait Implementationsยง
impl Freeze for ImageEncoder
impl RefUnwindSafe for ImageEncoder
impl Send for ImageEncoder
impl Sync for ImageEncoder
impl Unpin for ImageEncoder
impl UnwindSafe for ImageEncoder
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
sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more