Aperture

Struct Aperture 

Source
pub struct Aperture(/* private fields */);
Expand description

Aperture (f-number)

Implementations§

Source§

impl Aperture

Source

pub fn new(f_number: f32) -> Result<Self, String>

Examples found in repository?
examples/create_test_vsf.rs (line 34)
9fn main() {
10    // Create a simple 8x8 test image
11    let samples: Vec<u64> = (0..64).map(|i| i * 4).collect(); // 0, 4, 8, 12, ..., 252
12    let image = BitPackedTensor::pack(8, vec![8, 8], &samples);
13
14    // Create metadata
15    let metadata = RawMetadata {
16        cfa_pattern: Some(CfaPattern::new(vec![b'R', b'G', b'G', b'B']).unwrap()), // RGGB Bayer pattern
17        black_level: Some(BlackLevel::new(64.0).unwrap()),
18        white_level: Some(WhiteLevel::new(255.0).unwrap()),
19        dark_frame_hash: None,
20        flat_field_hash: None,
21        bias_frame_hash: None,
22        vignette_correction_hash: None,
23        distortion_correction_hash: None,
24        magic_9: None,
25    };
26
27    // Create camera settings
28    let camera = CameraSettings {
29        make: None,
30        model: None,
31        serial_number: None,
32        iso_speed: Some(IsoSpeed::new(800.0).unwrap()),
33        shutter_time_s: Some(ShutterTime::new(1.0 / 60.0).unwrap()), // 1/60 second
34        aperture_f_number: Some(Aperture::new(2.8).unwrap()),
35        focal_length_m: Some(FocalLength::new(0.050).unwrap()), // 50mm
36        exposure_compensation: None,
37        focus_distance_m: Some(FocusDistance::new(3.5).unwrap()),
38        flash_fired: Some(FlashFired::new(false).unwrap()),
39        metering_mode: Some(MeteringMode::new("matrix".to_string()).unwrap()),
40    };
41
42    // Build the VSF file
43    let bytes = build_raw_image(image, Some(metadata), Some(camera), None)
44        .expect("Failed to build VSF file");
45
46    // Write to file
47    std::fs::write("test_sample.vsf", &bytes).expect("Failed to write file");
48
49    println!("Created test_sample.vsf ({} bytes)", bytes.len());
50}
Source

pub fn to_vsf_type(self) -> VsfType

Source

pub fn from_vsf_type(vsf: VsfType) -> Result<Self, String>

Trait Implementations§

Source§

impl Clone for Aperture

Source§

fn clone(&self) -> Aperture

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Aperture

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.