Skip to main content

Decoded

Struct Decoded 

Source
pub struct Decoded { /* private fields */ }
Expand description

One level’s texels in f32, their transfer applied: a 2D level (depth 1) or a volume, row by row and slice by slice.

Implementations§

Source§

impl Decoded

Source

pub fn from_texels( width: u32, height: u32, texels: Vec<[f32; 4]>, ) -> Result<Decoded>

A 2D level of width x height float texels, row 0 first, as the caller holds them (no transfer: the values are filtered as they are). No texel, or a count other than the size’s, is refused.

Source

pub fn volume( width: u32, height: u32, depth: u32, texels: Vec<[f32; 4]>, ) -> Result<Decoded>

A volume of width x height x depth float texels, slice 0 first and each slice row 0 first. No texel, or a count other than the size’s, is refused.

Source

pub fn dimensions(&self) -> [usize; 2]

The level’s [width, height] in texels.

Source

pub fn depth(&self) -> usize

The slices of a volume: 1 for a 2D level.

Source

pub fn decoded_bytes(&self) -> usize

The memory the decoded texels take, in bytes (16 a texel).

Source

pub fn texel(&self, x: i64, y: i64, z: i64) -> Option<[f32; 4]>

The texel at (x, y, z), if the level holds one there: no addressing, a load’s view of the level.

Source

pub fn bilinear( &self, uv: [f32; 2], address: impl Into<Addressing<2>>, ) -> Result<[f32; 4]>

Bilinear at uv, in f32 (the coordinate, the weights (1 - t) and t per axis, and the sum over the four texels row by row), a texel outside a border axis the border colour; a coordinate that isn’t finite or past an i32’s range is refused, as is a border axis with no colour.

Source

pub fn bilinear_at( &self, uv: [f32; 2], address: impl Into<Addressing<2>>, subtexel: Subtexel, ) -> Result<[f32; 4]>

Decoded::bilinear with the texel coordinate resolved to subtexel precision before the weights are taken.

Source

pub fn point( &self, uv: [f32; 2], address: impl Into<Addressing<2>>, ) -> Result<[f32; 4]>

The texel uv falls in (texel i covering [i, i + 1) after scaling by the size), addressed, in f32: point filtering; outside a border axis, the border colour. A coordinate that isn’t finite or past an i32’s range is refused, as is a border axis with no colour.

Source

pub fn point_3d( &self, uvw: [f32; 3], address: impl Into<Addressing<3>>, ) -> Result<[f32; 4]>

The texel of a volume (or a 2D level, one slice) that uvw falls in, addressed along each axis, in f32; outside a border axis, the border colour.

Source

pub fn linear_3d( &self, uvw: [f32; 3], address: impl Into<Addressing<3>>, subtexel: Subtexel, ) -> Result<[f32; 4]>

Linear between the eight texels about uvw in a volume, in f32: the coordinate per axis (scaled by the size, minus a half, resolved to subtexel precision), the weights (1 - t) and t per axis multiplied x, then y, then z, and the sum over the texels slice by slice, row by row. A coordinate that isn’t finite or past an i32’s range is refused.

Trait Implementations§

Source§

impl Clone for Decoded

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 Debug for Decoded

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.