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
Dim2d
Dim3d
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 level
th 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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for ImageDimensions
impl Send for ImageDimensions
impl Sync for ImageDimensions
impl Unpin for ImageDimensions
impl UnwindSafe for ImageDimensions
Blanket Implementations
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.