Skip to main content

DynBackend

Enum DynBackend 

Source
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

Source

pub fn soft(width: u32, height: u32) -> Self

Wrap a SoftBackend as the CPU path.

Source

pub fn kind(&self) -> BackendKind

Return the active BackendKind.

Source

pub fn is_soft(&self) -> bool

Return true if the active backend is the CPU soft rasteriser.

Source

pub fn as_soft(&self) -> Option<&SoftBackend>

Borrow the inner SoftBackend, or None if the GPU path is active.

Source

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

Source§

fn execute(&mut self, list: &DrawList) -> Result<(), UiError>

Replay an entire DrawList onto the backend’s surface. Read more
Source§

fn surface_size(&self) -> Size

Return the target surface dimensions in physical pixels.
Source§

fn supports_blur(&self) -> bool

Return true if this backend can render blur effects (e.g. box shadows).
Source§

fn supports_gradients(&self) -> bool

Return true if this backend can render gradient fills.
Source§

fn supports_paths(&self) -> bool

Return true if this backend can render arbitrary vector paths.
Source§

fn supports_images(&self) -> bool

Return true if this backend can blit ImageData.
Source§

fn supports_text(&self) -> bool

Return true if this backend can render text via DrawCommand::DrawText.
Source§

fn supports_blend_modes(&self) -> bool

Return true if this backend honours DrawCommand::SetBlendMode commands (non-Normal blend modes). Read more
Source§

fn supports_backdrop_blur(&self) -> bool

Return true if this backend can apply a backdrop blur via DrawCommand::BackdropBlur.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.