Struct libheif_rs::HeifContext
source · [−]pub struct HeifContext { /* private fields */ }Implementations
sourceimpl HeifContext
impl HeifContext
sourcepub fn new() -> Result<HeifContext>
pub fn new() -> Result<HeifContext>
Create a new empty context.
sourcepub fn read_from_bytes(bytes: &[u8]) -> Result<HeifContext>
pub fn read_from_bytes(bytes: &[u8]) -> Result<HeifContext>
Create a new context from bytes.
sourcepub fn read_from_file(name: &str) -> Result<HeifContext>
pub fn read_from_file(name: &str) -> Result<HeifContext>
Create a new context from file.
sourcepub fn read_from_reader(reader: Box<dyn Reader>) -> Result<HeifContext>
pub fn read_from_reader(reader: Box<dyn Reader>) -> Result<HeifContext>
Create a new context from reader.
pub fn write_to_bytes(&self) -> Result<Vec<u8>>
pub fn write_to_file(&self, name: &str) -> Result<()>
pub fn number_of_top_level_images(&self) -> usize
pub fn top_level_image_ids(&self, item_ids: &mut [ItemId]) -> usize
pub fn image_handle(&self, item_id: ItemId) -> Result<ImageHandle<'_>>
pub fn primary_image_handle(&self) -> Result<ImageHandle<'_>>
pub fn encoder_for_format(&self, format: CompressionFormat) -> Result<Encoder>
sourcepub fn encode_image(
&mut self,
image: &Image,
encoder: &mut Encoder,
encoding_options: Option<EncodingOptions>
) -> Result<ImageHandle<'_>>
pub fn encode_image(
&mut self,
image: &Image,
encoder: &mut Encoder,
encoding_options: Option<EncodingOptions>
) -> Result<ImageHandle<'_>>
Compress the input image.
The first image added to the context is also automatically set the primary image, but
you can change the primary image later with [set_primary_image] method.
[set_primary_image]: #method.set_primary_image
pub fn set_primary_image(
&mut self,
image_handle: &mut ImageHandle<'_>
) -> Result<()>
Trait Implementations
sourceimpl Drop for HeifContext
impl Drop for HeifContext
impl Send for HeifContext
Auto Trait Implementations
impl !RefUnwindSafe for HeifContext
impl !Sync for HeifContext
impl Unpin for HeifContext
impl !UnwindSafe for HeifContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more