pub trait RasterBackend {
type Device: RenderDevice;
// Required methods
fn new_target(&self, w: u32, h: u32, clear: Color) -> Self::Device;
fn new_target_with_backdrop(&self, base: &Pixmap) -> Self::Device;
fn snapshot(&self, d: &Self::Device) -> Pixmap;
fn finish(&self, d: Self::Device) -> Pixmap;
}Expand description
The factory that lets the engine rasterize offscreen: soft masks, transparency groups, pattern cells and the fill+stroke knockout buffer all need a second target.
Required Associated Types§
Sourcetype Device: RenderDevice
type Device: RenderDevice
The device this backend produces.
Required Methods§
Sourcefn new_target(&self, w: u32, h: u32, clear: Color) -> Self::Device
fn new_target(&self, w: u32, h: u32, clear: Color) -> Self::Device
A fresh target of the given size, every pixel set to clear.
Both axes must be at most MAX_TARGET_DIMENSION: vello_cpu sizes
its scenes, pixmaps and masks with u16. The engine enforces the
bound before calling.
Sourcefn new_target_with_backdrop(&self, base: &Pixmap) -> Self::Device
fn new_target_with_backdrop(&self, base: &Pixmap) -> Self::Device
A fresh target seeded with base’s pixels.
This is a non-isolated transparency group’s backdrop (ISO 32000 §11.4.6) and the fill+stroke knockout buffer’s saved destination.
Sourcefn snapshot(&self, d: &Self::Device) -> Pixmap
fn snapshot(&self, d: &Self::Device) -> Pixmap
The device’s current pixels, without consuming it.
Only valid with every RenderDevice::push_layer matched by a
RenderDevice::pop — vello_cpu asserts it. On a retained-scene
backend this costs a full rasterization of the scene so far, not a
rectangle copy, which is why the engine renders each group into its
own target rather than snapshotting sub-rectangles of a shared one.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".