[−][src]Struct pixels::PixelsBuilder
A builder to help create customized pixel buffers.
Implementations
impl<'req> PixelsBuilder<'req>
[src]
pub fn new(
width: u32,
height: u32,
surface_texture: SurfaceTexture
) -> PixelsBuilder<'req>
[src]
width: u32,
height: u32,
surface_texture: SurfaceTexture
) -> PixelsBuilder<'req>
Create a builder that can be finalized into a Pixels
pixel buffer.
Examples
let mut pixels = PixelsBuilder::new(256, 240, surface_texture) .request_adapter_options(wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::HighPerformance, compatible_surface: None, }) .enable_vsync(false) .build()?;
Panics
Panics when width
or height
are 0.
pub const fn request_adapter_options(
self,
request_adapter_options: RequestAdapterOptions<'req>
) -> PixelsBuilder
[src]
self,
request_adapter_options: RequestAdapterOptions<'req>
) -> PixelsBuilder
Add options for requesting a wgpu::Adapter
.
pub const fn device_descriptor(
self,
device_descriptor: DeviceDescriptor
) -> PixelsBuilder<'req>
[src]
self,
device_descriptor: DeviceDescriptor
) -> PixelsBuilder<'req>
Add options for requesting a wgpu::Device
.
pub const fn wgpu_backend(self, backend: BackendBit) -> PixelsBuilder<'req>
[src]
Set which backends wgpu will attempt to use.
The default value of this is [wgpu::BackendBit::PRIMARY
], which enables
the well supported backends for wgpu.
pub fn enable_vsync(self, enable_vsync: bool) -> PixelsBuilder<'req>
[src]
Enable or disable Vsync.
Vsync is enabled by default.
The wgpu
present mode will be set to Fifo
when Vsync is enabled, or Immediate
when
Vsync is disabled. To set the present mode to Mailbox
or another value, use the
PixelsBuilder::present_mode
method.
pub fn present_mode(self, present_mode: PresentMode) -> PixelsBuilder<'req>
[src]
Set the wgpu
present mode.
This differs from PixelsBuilder::enable_vsync
by allowing the present mode to be set to
any value.
pub const fn texture_format(
self,
texture_format: TextureFormat
) -> PixelsBuilder<'req>
[src]
self,
texture_format: TextureFormat
) -> PixelsBuilder<'req>
Set the texture format.
The default value is [wgpu::TextureFormat::Rgba8UnormSrgb
], which is 4 unsigned bytes in
RGBA
order using the SRGB color space. This is typically what you want when you are
working with color values from popular image editing tools or web apps.
pub fn build(self) -> Result<Pixels, Error>
[src]
Create a pixel buffer from the options builder.
Errors
Returns an error when a wgpu::Adapter
cannot be found.
Auto Trait Implementations
impl<'req> RefUnwindSafe for PixelsBuilder<'req>
impl<'req> Send for PixelsBuilder<'req>
impl<'req> Sync for PixelsBuilder<'req>
impl<'req> Unpin for PixelsBuilder<'req>
impl<'req> UnwindSafe for PixelsBuilder<'req>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,