|
|
@ -239,10 +239,7 @@ pub enum ShutterSound { |
|
|
|
pub enum Trimming { |
|
|
|
pub enum Trimming { |
|
|
|
/// Trimming configuration relatively to the center of the image.
|
|
|
|
/// Trimming configuration relatively to the center of the image.
|
|
|
|
#[allow(missing_docs)] |
|
|
|
#[allow(missing_docs)] |
|
|
|
Centered{ |
|
|
|
Centered { width: i16, height: i16 }, |
|
|
|
width: i16, |
|
|
|
|
|
|
|
height: i16, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/// Trimming disabled.
|
|
|
|
/// Trimming disabled.
|
|
|
|
Off, |
|
|
|
Off, |
|
|
|
} |
|
|
|
} |
|
|
@ -660,7 +657,7 @@ pub trait Camera: private::ConfigurableCamera { |
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
fn final_view_size(&self) -> (i16, i16) { |
|
|
|
fn final_view_size(&self) -> (i16, i16) { |
|
|
|
match self.trimming() { |
|
|
|
match self.trimming() { |
|
|
|
Trimming::Centered{width, height} => (width, height), |
|
|
|
Trimming::Centered { width, height } => (width, height), |
|
|
|
Trimming::Off => self.view_size().into(), |
|
|
|
Trimming::Off => self.view_size().into(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -681,7 +678,7 @@ pub trait Camera: private::ConfigurableCamera { |
|
|
|
#[doc(alias = "CAMU_SetTrimming")] |
|
|
|
#[doc(alias = "CAMU_SetTrimming")] |
|
|
|
fn set_trimming(&mut self, trimming: Trimming) -> crate::Result<()> { |
|
|
|
fn set_trimming(&mut self, trimming: Trimming) -> crate::Result<()> { |
|
|
|
match trimming { |
|
|
|
match trimming { |
|
|
|
Trimming::Centered{width, height} => unsafe { |
|
|
|
Trimming::Centered { width, height } => unsafe { |
|
|
|
let view_size: (i16, i16) = self.view_size().into(); |
|
|
|
let view_size: (i16, i16) = self.view_size().into(); |
|
|
|
let mut trim_size: (i16, i16) = (width, height); |
|
|
|
let mut trim_size: (i16, i16) = (width, height); |
|
|
|
|
|
|
|
|
|
|
@ -1110,10 +1107,7 @@ impl Trimming { |
|
|
|
// Pixel area must be a multiple of 128.
|
|
|
|
// Pixel area must be a multiple of 128.
|
|
|
|
assert!((width * height) % 128 == 0); |
|
|
|
assert!((width * height) % 128 == 0); |
|
|
|
|
|
|
|
|
|
|
|
Self::Centered { |
|
|
|
Self::Centered { width, height } |
|
|
|
width, |
|
|
|
|
|
|
|
height, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Create a new [`Trimming`] configuration using a standard view size centered to the original image.
|
|
|
|
/// Create a new [`Trimming`] configuration using a standard view size centered to the original image.
|
|
|
|