pub struct WgpuBackend { /* private fields */ }Expand description
Headless GPU backend implementing RenderBackend.
Implementations§
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn headless(width: u32, height: u32) -> Result<Self, UiError>
pub fn headless(width: u32, height: u32) -> Result<Self, UiError>
Initialise a headless backend with an offscreen target of
width × height physical pixels.
§Errors
Returns UiError::Unsupported when no GPU adapter is available (so
the caller can skip on a machine without a usable GPU), or
UiError::Backend when device creation fails.
Sourcepub fn set_clear_color(&mut self, color: Color)
pub fn set_clear_color(&mut self, color: Color)
Set the colour the offscreen target is cleared to before each frame.
Sourcepub fn clear_color(&self) -> Color
pub fn clear_color(&self) -> Color
Return the current clear colour.
Sourcepub fn readback_rgba(&self) -> Result<Vec<u8>, UiError>
pub fn readback_rgba(&self) -> Result<Vec<u8>, UiError>
Read the offscreen colour target back into a tightly packed
width * height * 4 RGBA byte vector (row padding stripped).
§Errors
Returns UiError::Render if the GPU poll or buffer mapping fails.
Trait Implementations§
Source§impl RenderBackend for WgpuBackend
impl RenderBackend for WgpuBackend
Source§fn surface_size(&self) -> Size
fn surface_size(&self) -> Size
Return the target surface dimensions in physical pixels.
Source§fn supports_gradients(&self) -> bool
fn supports_gradients(&self) -> bool
Return
true if this backend can render gradient fills.Source§fn supports_paths(&self) -> bool
fn supports_paths(&self) -> bool
Return
true if this backend can render arbitrary vector paths.Source§fn supports_blur(&self) -> bool
fn supports_blur(&self) -> bool
Return
true if this backend can render blur effects (e.g. box shadows).Source§fn supports_images(&self) -> bool
fn supports_images(&self) -> bool
Return
true if this backend can blit ImageData.Source§fn supports_text(&self) -> bool
fn supports_text(&self) -> bool
Return
true if this backend can render text via DrawCommand::DrawText.Auto Trait Implementations§
impl Freeze for WgpuBackend
impl !RefUnwindSafe for WgpuBackend
impl Send for WgpuBackend
impl Sync for WgpuBackend
impl Unpin for WgpuBackend
impl UnsafeUnpin for WgpuBackend
impl !UnwindSafe for WgpuBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more