Enum vulkano::image::ImageDimensions
[−]
[src]
pub enum ImageDimensions { Dim1d { width: u32, array_layers: u32, }, Dim2d { width: u32, height: u32, array_layers: u32, cubemap_compatible: bool, }, Dim3d { width: u32, height: u32, depth: u32, }, }
Variants
Dim1d
Fields of Dim1d
width: u32 | |
array_layers: u32 |
Dim2d
Fields of Dim2d
width: u32 | |
height: u32 | |
array_layers: u32 | |
cubemap_compatible: bool |
Dim3d
Fields of Dim3d
width: u32 | |
height: u32 | |
depth: u32 |
Methods
impl ImageDimensions
[src]
fn width(&self) -> u32
[src]
fn height(&self) -> u32
[src]
fn width_height(&self) -> [u32; 2]
[src]
fn depth(&self) -> u32
[src]
fn width_height_depth(&self) -> [u32; 3]
[src]
fn array_layers(&self) -> u32
[src]
fn num_texels(&self) -> u32
[src]
Returns the total number of texels for an image of these dimensions.
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, cubemap_compatible: false, array_layers: 1, }; assert_eq!(dims.max_mipmaps(), 7);
Panic
May panic if the dimensions are 0.
fn mipmap_dimensions(&self, level: u32) -> Option<ImageDimensions>
[src]
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, cubemap_compatible: false, array_layers: 1, }; assert_eq!(dims.mipmap_dimensions(0), Some(dims)); assert_eq!(dims.mipmap_dimensions(1), Some(ImageDimensions::Dim2d { width: 512, height: 128, cubemap_compatible: false, array_layers: 1, })); assert_eq!(dims.mipmap_dimensions(6), Some(ImageDimensions::Dim2d { width: 16, height: 4, cubemap_compatible: false, array_layers: 1, })); assert_eq!(dims.mipmap_dimensions(9), Some(ImageDimensions::Dim2d { width: 2, height: 1, cubemap_compatible: false, array_layers: 1, })); assert_eq!(dims.mipmap_dimensions(11), None);
Panic
In debug mode, panicks if width
, height
or depth
is equal to 0. In release, returns
an unspecified value.
Trait Implementations
impl Copy for ImageDimensions
[src]
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]
impl PartialEq for ImageDimensions
[src]
fn eq(&self, __arg_0: &ImageDimensions) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ImageDimensions) -> bool
[src]
This method tests for !=
.