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
impl Decoded
Sourcepub fn from_texels(
width: u32,
height: u32,
texels: Vec<[f32; 4]>,
) -> Result<Decoded>
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.
Sourcepub fn volume(
width: u32,
height: u32,
depth: u32,
texels: Vec<[f32; 4]>,
) -> Result<Decoded>
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.
Sourcepub fn dimensions(&self) -> [usize; 2]
pub fn dimensions(&self) -> [usize; 2]
The level’s [width, height] in texels.
Sourcepub fn decoded_bytes(&self) -> usize
pub fn decoded_bytes(&self) -> usize
The memory the decoded texels take, in bytes (16 a texel).
Sourcepub fn texel(&self, x: i64, y: i64, z: i64) -> Option<[f32; 4]>
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.
Sourcepub fn bilinear(
&self,
uv: [f32; 2],
address: impl Into<Addressing<2>>,
) -> Result<[f32; 4]>
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.
Sourcepub fn bilinear_at(
&self,
uv: [f32; 2],
address: impl Into<Addressing<2>>,
subtexel: Subtexel,
) -> Result<[f32; 4]>
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.
Sourcepub fn point(
&self,
uv: [f32; 2],
address: impl Into<Addressing<2>>,
) -> Result<[f32; 4]>
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.
Sourcepub fn point_3d(
&self,
uvw: [f32; 3],
address: impl Into<Addressing<3>>,
) -> Result<[f32; 4]>
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.
Sourcepub fn linear_3d(
&self,
uvw: [f32; 3],
address: impl Into<Addressing<3>>,
subtexel: Subtexel,
) -> Result<[f32; 4]>
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.