#[non_exhaustive]#[repr(u8)]pub enum Orientation {
Normal = 1,
FlipHorizontal = 2,
Rotate180 = 3,
FlipVertical = 4,
Transpose = 5,
Rotate90 = 6,
Transverse = 7,
Rotate270 = 8,
}Expand description
EXIF orientation tag values.
Describes how the stored pixels should be transformed for display. Values match the EXIF Orientation tag (TIFF tag 274).
When a codec applies orientation during decode, it sets orientation to
Normal in the returned ImageInfo.
When orientation is not applied, the caller is responsible for transforming
the pixel data according to this value.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Normal = 1
No rotation or flip needed.
FlipHorizontal = 2
Flip horizontally (mirror left-right).
Rotate180 = 3
Rotate 180 degrees.
FlipVertical = 4
Flip vertically (mirror top-bottom).
Transpose = 5
Transpose (rotate 90 CW then flip horizontally).
Rotate90 = 6
Rotate 90 degrees clockwise.
Transverse = 7
Transverse (rotate 90 CCW then flip horizontally).
Rotate270 = 8
Rotate 270 degrees clockwise (= 90 CCW).
Implementations§
Source§impl Orientation
impl Orientation
Sourcepub fn from_exif(value: u16) -> Self
pub fn from_exif(value: u16) -> Self
Create from EXIF orientation value (1-8).
Returns Normal for out-of-range values.
Sourcepub fn exif_value(self) -> u16
pub fn exif_value(self) -> u16
EXIF tag value (1-8).
Sourcepub fn swaps_dimensions(self) -> bool
pub fn swaps_dimensions(self) -> bool
Whether this orientation swaps width and height.
True for orientations involving a 90 or 270 degree rotation (values 5-8).
Sourcepub fn display_dimensions(
self,
stored_width: u32,
stored_height: u32,
) -> (u32, u32)
pub fn display_dimensions( self, stored_width: u32, stored_height: u32, ) -> (u32, u32)
Compute display dimensions for the given stored dimensions.
If orientation swaps dimensions (90/270 rotation), width and height are exchanged.
Sourcepub fn is_identity(self) -> bool
pub fn is_identity(self) -> bool
Whether any transformation is needed.
Trait Implementations§
Source§impl Clone for Orientation
impl Clone for Orientation
Source§fn clone(&self) -> Orientation
fn clone(&self) -> Orientation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more