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,
    },
}
Expand description

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

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

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);

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Builds a pointer to this type from a raw pointer.

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

Returns the size of an individual element.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.