Enum vulkano::image::ImageDimensions[][src]

pub enum ImageDimensions {
    Dim1d {
        width: u32,
        array_layers: u32,
    },
    Dim2d {
        width: u32,
        height: u32,
        array_layers: u32,
    },
    Dim3d {
        width: u32,
        height: u32,
        depth: u32,
    },
}

The dimensions of an image.

Variants

Dim1d
Show fields

Fields of Dim1d

width: u32array_layers: u32
Dim2d
Show fields

Fields of Dim2d

width: u32height: u32array_layers: u32
Dim3d
Show fields

Fields of Dim3d

width: u32height: u32depth: u32

Implementations

impl ImageDimensions[src]

pub fn width(&self) -> u32[src]

pub fn height(&self) -> u32[src]

pub fn width_height(&self) -> [u32; 2][src]

pub fn depth(&self) -> u32[src]

pub fn width_height_depth(&self) -> [u32; 3][src]

pub fn array_layers(&self) -> u32[src]

pub fn num_texels(&self) -> u32[src]

Returns the total number of texels for an image of these dimensions.

pub fn max_mipmaps(&self) -> u32[src]

Returns the maximum number of mipmaps for these image dimensions.

The returned value is always at least superior or equal to 1.

Example

use vulkano::image::ImageDimensions;

let dims = ImageDimensions::Dim2d {
    width: 32,
    height: 50,
    array_layers: 1,
};

assert_eq!(dims.max_mipmaps(), 6);

pub fn mipmap_dimensions(&self, level: u32) -> Option<ImageDimensions>[src]

Returns the dimensions of the levelth mipmap level. If level is 0, then the dimensions are left unchanged.

Returns None if level is superior or equal to max_mipmaps().

Example

use vulkano::image::ImageDimensions;

let dims = ImageDimensions::Dim2d {
    width: 963,
    height: 256,
    array_layers: 1,
};

assert_eq!(dims.mipmap_dimensions(0), Some(dims));
assert_eq!(dims.mipmap_dimensions(1), Some(ImageDimensions::Dim2d {
    width: 481,
    height: 128,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(6), Some(ImageDimensions::Dim2d {
    width: 15,
    height: 4,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(9), Some(ImageDimensions::Dim2d {
    width: 1,
    height: 1,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(11), None);

Panic

In debug mode, Panics if width, height or depth is equal to 0. In release, returns an unspecified value.

Trait Implementations

impl Clone for ImageDimensions[src]

fn clone(&self) -> ImageDimensions[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ImageDimensions[src]

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

Formats the value using the given formatter. Read more

impl PartialEq<ImageDimensions> for ImageDimensions[src]

fn eq(&self, other: &ImageDimensions) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ImageDimensions) -> bool[src]

This method tests for !=.

impl Copy for ImageDimensions[src]

impl Eq for ImageDimensions[src]

impl StructuralEq for ImageDimensions[src]

impl StructuralPartialEq for ImageDimensions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Content for T[src]

pub fn ref_from_ptr(*mut c_void, usize) -> Option<*mut T>[src]

Builds a pointer to this type from a raw pointer.

pub fn is_size_suitable(usize) -> bool[src]

Returns true if the size is suitable to store a type like this.

pub fn indiv_size() -> usize[src]

Returns the size of an individual element.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.