pub struct SoftBackend { /* private fields */ }Expand description
CPU framebuffer backend implementing oxiui_core::paint::RenderBackend.
Replays a oxiui_core::paint::DrawList onto a Framebuffer via a Canvas
(clip-correct). All commands share one clip stack for the duration of
the oxiui_core::paint::RenderBackend::execute call.
When the text feature is enabled, a cached oxiui_text::TextPipeline
is held on the backend so that DrawText commands are fully shaped and
rasterised rather than silently ignored.
Implementations§
Source§impl SoftBackend
impl SoftBackend
Sourcepub fn with_background(width: u32, height: u32, bg: Color) -> Self
pub fn with_background(width: u32, height: u32, bg: Color) -> Self
Create a backend pre-filled with a solid background colour.
Sourcepub fn set_quality(&mut self, quality: SoftRenderQuality)
pub fn set_quality(&mut self, quality: SoftRenderQuality)
Set the quality preset, influencing AA mode and shadow strategy.
Sourcepub fn quality(&self) -> &SoftRenderQuality
pub fn quality(&self) -> &SoftRenderQuality
Return the current quality preset.
Sourcepub fn frame(&self) -> &Framebuffer
pub fn frame(&self) -> &Framebuffer
Borrow the underlying framebuffer.
Sourcepub fn into_framebuffer(self) -> Framebuffer
pub fn into_framebuffer(self) -> Framebuffer
Consume the backend, returning the underlying framebuffer.
Sourcepub fn to_bytes(&self, format: PixelFormat) -> Vec<u8> ⓘ
pub fn to_bytes(&self, format: PixelFormat) -> Vec<u8> ⓘ
Export the framebuffer as a flat byte vector in the requested pixel format.
The native internal format is 0xAARRGGBB (one u32 per pixel).
This method reinterprets and reorders channels for the target format.
| Format | Bytes/pixel | Channel order |
|---|---|---|
Argb32 | 4 | A, R, G, B |
Bgra8 | 4 | B, G, R, A |
Rgb565 | 2 | 5R·6G·5B, big-endian |
Source§impl SoftBackend
impl SoftBackend
Sourcepub fn with_quality(width: u32, height: u32, quality: SoftRenderQuality) -> Self
pub fn with_quality(width: u32, height: u32, quality: SoftRenderQuality) -> Self
Create a backend pre-configured with a SoftRenderQuality preset.
The quality is stored and used to drive AA mode selection during
subsequent execute calls.
AaMode::Supersampling / AaMode::Msaa4x enables the vertical-
supersample coverage path in the scanline polygon rasterizer.
AaMode::None disables AA (faster, aliased edges).
ShadowQuality::Off skips Gaussian convolution for box-shadow commands.
ShadowQuality::Low and ShadowQuality::High use the existing
GaussianCache with a small or full kernel radius respectively.
Trait Implementations§
Source§impl RenderBackend for SoftBackend
impl RenderBackend for SoftBackend
Source§fn surface_size(&self) -> Size
fn surface_size(&self) -> Size
Source§fn supports_blur(&self) -> bool
fn supports_blur(&self) -> bool
true if this backend can render blur effects (e.g. box shadows).Source§fn supports_gradients(&self) -> bool
fn supports_gradients(&self) -> bool
true if this backend can render gradient fills.Source§fn supports_paths(&self) -> bool
fn supports_paths(&self) -> bool
true if this backend can render arbitrary vector paths.Source§fn supports_images(&self) -> bool
fn supports_images(&self) -> bool
true if this backend can blit ImageData.Source§fn supports_text(&self) -> bool
fn supports_text(&self) -> bool
true if this backend can render text via DrawCommand::DrawText.Source§fn supports_blend_modes(&self) -> bool
fn supports_blend_modes(&self) -> bool
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
true if this backend can apply a backdrop blur via
DrawCommand::BackdropBlur.Auto Trait Implementations§
impl !Freeze for SoftBackend
impl !RefUnwindSafe for SoftBackend
impl !UnwindSafe for SoftBackend
impl Send for SoftBackend
impl Sync for SoftBackend
impl Unpin for SoftBackend
impl UnsafeUnpin for SoftBackend
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
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>
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>
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