Skip to main content

Halation

Struct Halation 

Source
pub struct Halation {
    pub pixel_um: f64,
    pub scatter: Halo,
    pub reflection: Halo,
}
Expand description

Both halation components for one image, with its scale on the film.

Fields§

§pixel_um: f64

Size of one pixel on the film, in micrometres across.

§scatter: Halo

Diffusion inside the emulsion: short, and almost colour-neutral.

§reflection: Halo

Reflection off the base: long, and red by the time it returns.

Implementations§

Source§

impl Halation

Source

pub const BASE_THICKNESS_MM: f64 = 0.135

Thickness of the film base, in millimetres.

The halo’s size follows from it and from nothing else that varies: a photographic base is 0.125–0.135 mm across every manufacturer’s sheet, and 0.135 is the thick end.

Source

pub const FILM_INDEX: f64 = 1.5

Refractive index of the base, which is what bends the returning cone.

Source

pub fn reflection_radius_um(f_number: f64) -> f64

How far the reflection halo reaches on the film, at a given aperture.

The light that comes back travelled down through the base and up again, so its cone is the lens’s, refracted into the base and stretched over twice 135 µm. The marginal ray outside is atan(1/2N); inside it is asin(sin(θ)/n); the radius at the emulsion is 2B·tan of that.

There is no free parameter here, which is the point: the sigma was the one number in this file that could be derived instead of guessed.

Source

pub fn for_aperture(pixel_um: f64, f_number: f64) -> Self

Both components for an exposure made at a particular aperture.

pixel_um is the film-plane size of one pixel, so the kernels are expressed in micrometres and do not change when the scan resolution does.

The reflection halo’s width now comes from the geometry; its strength, and both of the scatter term’s numbers, are still placeholders — see the module documentation. A Gaussian of radius / 2 carries the same second moment as a disc of that radius, which is as much as a geometry can say about the shape.

Source

pub fn typical(pixel_um: f64) -> Self

The same, at a normal shooting aperture.

f/4 rather than f/1.4: the old fixed 30 µm was the wide-open case for a 135 µm base, which is where a lens that vignettes its corners stops being a lens. The placeholder was not wrong so much as always wide open.

Source

pub fn is_noop(&self) -> bool

Whether either component would change anything.

Source

pub fn apply(&self, log_e: &mut [[f64; 3]], width: usize, height: usize)

Apply halation to a buffer of log10 exposures, in place.

width * height is read from the buffer; a buffer that is shorter than the declared rectangle is processed only as far as it goes.

Trait Implementations§

Source§

impl Clone for Halation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Halation

Source§

impl Debug for Halation

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.