#[non_exhaustive]pub enum AlphaMode {
Keep,
Discard,
}Expand description
Whether a PNG or WebP image has an alpha channel.
This enum is marked #[non_exhaustive] so that modes can be added without
a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Keep
Keep the source’s alpha, converted to the image’s depth. PNG and lossless WebP use RGBA for a source with alpha and RGB otherwise. Lossy WebP’s encoder takes RGBA, using opaque alpha for an opaque source. Colors are treated as straight (not premultiplied by alpha), and PNG and WebP store straight alpha. The SDK frame-type reference documents this for BGRA and RGBA. It does not specify the convention for UYVA, PA16, NB48 or NB4G; this encoder assumes straight color for them too.
Discard
Write RGB, dropping any alpha.
Trait Implementations§
impl Copy for AlphaMode
impl Eq for AlphaMode
impl StructuralPartialEq for AlphaMode
Auto Trait Implementations§
impl Freeze for AlphaMode
impl RefUnwindSafe for AlphaMode
impl Send for AlphaMode
impl Sync for AlphaMode
impl Unpin for AlphaMode
impl UnsafeUnpin for AlphaMode
impl UnwindSafe for AlphaMode
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