pub enum DynBackend {
Soft(Box<SoftBackend>),
}Expand description
A runtime-polymorphic render backend that implements RenderBackend.
Wraps either SoftBackend or WgpuBackend (behind wgpu-compat feature)
and forwards all RenderBackend method calls to the active variant.
The CPU and GPU paths share the same DrawList command format (defined in
oxiui_core), so callers do not need to change anything when the active
backend changes.
Construct via DynBackend::soft or — when the wgpu-compat feature is
active — via DynBackend::wgpu.
Variants§
Soft(Box<SoftBackend>)
CPU software rasteriser.
Implementations§
Source§impl DynBackend
impl DynBackend
Sourcepub fn soft(width: u32, height: u32) -> Self
pub fn soft(width: u32, height: u32) -> Self
Wrap a SoftBackend as the CPU path.
Sourcepub fn kind(&self) -> BackendKind
pub fn kind(&self) -> BackendKind
Return the active BackendKind.
Sourcepub fn as_soft(&self) -> Option<&SoftBackend>
pub fn as_soft(&self) -> Option<&SoftBackend>
Borrow the inner SoftBackend, or None if the GPU path is active.
Sourcepub fn as_soft_mut(&mut self) -> Option<&mut SoftBackend>
pub fn as_soft_mut(&mut self) -> Option<&mut SoftBackend>
Mutably borrow the inner SoftBackend, or None if the GPU path is active.
Trait Implementations§
Source§impl RenderBackend for DynBackend
impl RenderBackend for DynBackend
Source§fn surface_size(&self) -> Size
fn surface_size(&self) -> Size
Return the target surface dimensions in physical pixels.
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_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_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.Source§fn supports_blend_modes(&self) -> bool
fn supports_blend_modes(&self) -> bool
Return
true if this backend honours DrawCommand::SetBlendMode
commands (non-Normal blend modes). Read moreSource§fn supports_backdrop_blur(&self) -> bool
fn supports_backdrop_blur(&self) -> bool
Return
true if this backend can apply a backdrop blur via
DrawCommand::BackdropBlur.Auto Trait Implementations§
impl !RefUnwindSafe for DynBackend
impl !UnwindSafe for DynBackend
impl Freeze for DynBackend
impl Send for DynBackend
impl Sync for DynBackend
impl Unpin for DynBackend
impl UnsafeUnpin for DynBackend
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more