### Initialize wgpu and render a Vello scene to a texture Source: https://docs.rs/vello/latest/vello/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows the minimal integration of Vello with wgpu: create a Renderer with RendererOptions, build a Scene with fills and layers, then render to a wgpu Texture via render_to_texture. Requires a GPU with compute shader support and a wgpu context. The example uses AaSupport::all() and AaConfig::Msaa16; the final texture can be blitted to the surface with wgpu::util::TextureBlitter. ```rust // Initialize wgpu and get handles let (width, height) = ...; let device: wgpu::Device = ...; let queue: wgpu::Queue = ...; let mut renderer = Renderer::new( &device, RendererOptions { use_cpu: false, antialiasing_support: vello::AaSupport::all(), num_init_threads: NonZeroUsize::new(1), }, ).expect("Failed to create renderer"); // Create scene and draw stuff in it let mut scene = vello::Scene::new(); scene.fill( vello::peniko::Fill::NonZero, vello::Affine::IDENTITY, vello::Color::from_rgb8(242, 140, 168), None, &vello::Circle::new((420.0, 200.0), 120.0), ); // Draw more stuff scene.push_layer(...); scene.fill(...); scene.stroke(...); scene.pop_layer(...); let texture = device.create_texture(&...); // Render to a wgpu Texture renderer .render_to_texture( &device, &queue, &scene, &texture, &vello::RenderParams { base_color: palette::css::BLACK, // Background color width, height, antialiasing_method: AaConfig::Msaa16, }, ) .expect("Failed to render to a texture"); // Do things with surface texture, such as blitting it to the Surface using // wgpu::util::TextureBlitter. ``` -------------------------------- ### Render::bump_buf Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search= Gets the bump buffer. ```APIDOC ## Render::bump_buf ### Description Gets the bump buffer. ### Method bump_buf ### Signature pub fn bump_buf(&self) -> BufferProxy ### Parameters None ### Returns - **BufferProxy** - The bump buffer. ``` -------------------------------- ### Scene::new Source: https://docs.rs/vello/latest/vello/struct.Scene.html?search= Creates a new empty Scene. ```APIDOC ## Scene::new ### Description Creates a new scene. ### Method `pub fn new() -> Self` ### Parameters None. ### Returns A new `Scene` instance. ``` -------------------------------- ### Render::out_image Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search= Gets the output image. This is going away, as the caller will add the output image to the bind map. ```APIDOC ## Render::out_image ### Description Gets the output image. This is going away, as the caller will add the output image to the bind map. ### Method out_image ### Signature pub fn out_image(&self) -> ImageProxy ### Parameters None ### Returns - **ImageProxy** - The output image. ``` -------------------------------- ### Scene::pop_layer Source: https://docs.rs/vello/latest/vello/index.html Pops the current layer from the scene's layer stack. This ends the grouping started by push_layer. ```APIDOC ## Scene::pop_layer ### Description Pops the current layer from the scene's layer stack. This ends the grouping started by push_layer. ### Method Method ### Parameters None ### Returns - `()` - Nothing. ### Example ```rust scene.pop_layer(); ``` ``` -------------------------------- ### Renderer::new Source: https://docs.rs/vello/latest/vello/index.html Creates a new Renderer instance with the specified options. This is the first step in using Vello to render scenes. ```APIDOC ## Renderer::new ### Description Creates a new Renderer with the given device and options. This initializes the renderer for subsequent rendering operations. ### Method Constructor ### Parameters - **device** (`&wgpu::Device`) - Required - The wgpu device to use for rendering. - **options** (`RendererOptions`) - Required - Configuration options for the renderer, including CPU usage, anti-aliasing support, and number of initialization threads. ### Returns - `Result` - A new Renderer instance or an error if creation fails. ### Example ```rust let mut renderer = Renderer::new( &device, RendererOptions { use_cpu: false, antialiasing_support: vello::AaSupport::all(), num_init_threads: NonZeroUsize::new(1), }, ).expect("Failed to create renderer"); ``` ``` -------------------------------- ### RenderContext::new Source: https://docs.rs/vello/latest/vello/util/struct.RenderContext.html?search=u32+-%3E+bool Creates a new RenderContext instance. ```APIDOC ## RenderContext::new ### Description Creates a new RenderContext instance. ### Method new ### Signature pub fn new() -> Self ### Parameters None ### Returns Self - A new RenderContext instance. ``` -------------------------------- ### ImageProxy::new Source: https://docs.rs/vello/latest/vello/low_level/struct.ImageProxy.html?search=std%3A%3Avec Creates a new ImageProxy instance with the specified width, height, and image format. ```APIDOC ## ImageProxy::new ### Description Creates a new ImageProxy instance with the given dimensions and image format. ### Method new ### Parameters - **width** (u32) - Required - The width of the image - **height** (u32) - Required - The height of the image - **format** (ImageFormat) - Required - The format of the image ### Returns - **Self** - A new ImageProxy instance ### Example ```rust let proxy = ImageProxy::new(1920, 1080, ImageFormat::Rgba8); ``` ``` -------------------------------- ### Recording::download Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search= Prepare a buffer for downloading. Currently this copies to a download buffer. The original buffer can be freed immediately after. ```APIDOC ## Recording::download ### Description Prepare a buffer for downloading. Currently this copies to a download buffer. The original buffer can be freed immediately after. ### Method download ### Parameters - **buf** (BufferProxy) - Required - The buffer to prepare for download. ### Returns - (void) - No return value. ``` -------------------------------- ### Renderer::new Source: https://docs.rs/vello/latest/vello/struct.Renderer.html Creates a new renderer for the specified device. ```APIDOC ## Renderer::new ### Description Creates a new renderer for the specified device. ### Method new ### Signature pub fn new(device: &Device, options: RendererOptions) -> Result ### Parameters - **device** (&Device) - Required - The device to create the renderer for. - **options** (RendererOptions) - Required - Configuration options for the renderer. ### Returns Result - The newly created renderer, or an error if creation fails. ``` -------------------------------- ### Scene::new Source: https://docs.rs/vello/latest/vello/index.html Creates a new empty Scene, which is the main datatype for rendering graphics. Use this to build a scene before rendering. ```APIDOC ## Scene::new ### Description Creates a new empty Scene. The Scene is the main datatype for rendering graphics and can be filled with shapes, layers, and strokes. ### Method Constructor ### Parameters None ### Returns - `Scene` - A new empty Scene. ### Example ```rust let mut scene = vello::Scene::new(); ``` ``` -------------------------------- ### Renderer::new Source: https://docs.rs/vello/latest/vello/index.html?search= Creates a new Renderer instance with the specified options. This is the entry point for creating a renderer that can draw scenes to textures or surfaces. ```APIDOC ## [CONSTRUCTOR] Renderer::new ### Description Creates a new Renderer with the given options. This is the entry point for rendering scenes. ### Method new ### Parameters #### Parameters - **device** (&wgpu::Device) - Required - The wgpu device to use for rendering. - **options** (RendererOptions) - Required - Options set at renderer creation time. ### Request Example ```rust let mut renderer = Renderer::new( &device, RendererOptions { use_cpu: false, antialiasing_support: vello::AaSupport::all(), num_init_threads: NonZeroUsize::new(1), }, ).expect("Failed to create renderer"); ``` ``` -------------------------------- ### BufferProxy::new Source: https://docs.rs/vello/latest/vello/low_level/struct.BufferProxy.html?search= Constructs a new BufferProxy with a specified size and name. ```APIDOC ## BufferProxy::new ### Description Creates a new BufferProxy with the given size and name. ### Signature ```rust pub fn new(size: u64, name: &'static str) -> Self ``` ### Parameters - **size** (u64) - Required - The size of the buffer. - **name** (&'static str) - Required - The name of the buffer. ### Returns - **Self** - A new BufferProxy instance. ``` -------------------------------- ### Recording::into_commands Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search= Returns a Vec containing all the Commands in order. ```APIDOC ## Recording::into_commands ### Description Returns a `Vec` containing all the `Command`s in order. ### Method into_commands ### Parameters - **self** (Recording) - Required - The recording to consume. ### Returns - **Vec** - The list of commands in order. ``` -------------------------------- ### Render::record_fine Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search= Runs fine rasterization assuming the coarse phase succeeded. ```APIDOC ## Render::record_fine ### Description Runs fine rasterization assuming the coarse phase succeeded. ### Method record_fine ### Signature pub fn record_fine(&mut self, shaders: &FullShaders, recording: &mut Recording) ### Parameters - **shaders** (&FullShaders) - Required - The full set of shaders to use. - **recording** (&mut Recording) - Required - The recording to update with fine rasterization commands. ### Returns None ``` -------------------------------- ### RenderContext::configure_surface Source: https://docs.rs/vello/latest/vello/util/struct.RenderContext.html?search=u32+-%3E+bool Configures the surface. ```APIDOC ## RenderContext::configure_surface ### Description Configures the surface. ### Method configure_surface ### Signature pub fn configure_surface(&self, surface: &RenderSurface<'_>) ### Parameters - **surface** (&RenderSurface<'_>) - Required - The surface to configure. ``` -------------------------------- ### Render::new Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search= Creates a new Render instance for a render in progress. ```APIDOC ## Render::new ### Description Creates a new Render instance for a render in progress. ### Method new ### Signature pub fn new() -> Self ### Parameters None ### Returns - **Self** - A new Render instance. ``` -------------------------------- ### FontEmbolden::new Source: https://docs.rs/vello/latest/vello/struct.FontEmbolden.html?search=std%3A%3Avec Creates synthetic embolden settings with default expansion controls. ```APIDOC ## FontEmbolden::new ### Description Creates synthetic embolden settings with default expansion controls. ### Method `pub fn new(amount: Diagonal2) -> FontEmbolden` ### Parameters - **amount** (Diagonal2) - Required - Synthetic embolden amount. ### Returns - **FontEmbolden** - The new FontEmbolden instance. ``` -------------------------------- ### RenderContext::device Source: https://docs.rs/vello/latest/vello/util/struct.RenderContext.html?search=u32+-%3E+bool Finds or creates a compatible device handle id. ```APIDOC ## RenderContext::device ### Description Finds or creates a compatible device handle id. ### Method device ### Signature pub async fn device( &mut self, compatible_surface: Option<&Surface<'_>>, ) -> Option ### Parameters - **compatible_surface** (Option<&Surface<'_>>) - Optional - A surface that the device must be compatible with. ### Returns Option - The device handle id if found or created, otherwise None. ``` -------------------------------- ### RenderContext::create_surface Source: https://docs.rs/vello/latest/vello/util/struct.RenderContext.html?search=u32+-%3E+bool Creates a new surface for the specified window and dimensions. ```APIDOC ## RenderContext::create_surface ### Description Creates a new surface for the specified window and dimensions. ### Method create_surface ### Signature pub async fn create_surface<'w>( &mut self, window: impl Into>, width: u32, height: u32, present_mode: PresentMode, ) -> Result, Error> ### Parameters - **window** (impl Into>) - Required - The window target for the surface. - **width** (u32) - Required - The width of the surface. - **height** (u32) - Required - The height of the surface. - **present_mode** (PresentMode) - Required - The presentation mode for the surface. ### Returns Result, Error> - The created render surface or an error. ``` -------------------------------- ### ResourceProxy::new_buf Source: https://docs.rs/vello/latest/vello/low_level/enum.ResourceProxy.html?search=std%3A%3Avec Creates a new ResourceProxy representing a buffer with the given size and name. ```APIDOC ## ResourceProxy::new_buf ### Description Creates a new ResourceProxy that wraps a buffer proxy with the specified size and name. ### Method `pub fn new_buf(size: u64, name: &'static str) -> Self` ### Parameters - `size` (u64) - Required - The size of the buffer in bytes. - `name` (&'static str) - Required - A static string name for the buffer. ### Returns - `Self` - A ResourceProxy instance representing the buffer. ``` -------------------------------- ### ImageFormat::from_wgpu Source: https://docs.rs/vello/latest/vello/low_level/enum.ImageFormat.html?search= Attempts to convert a wgpu TextureFormat to an ImageFormat. Returns None if the format is not supported. Available only when the wgpu feature is enabled. ```APIDOC ## ImageFormat::from_wgpu ### Description Attempts to convert a wgpu TextureFormat to an ImageFormat. Returns None if the format is not supported. Available only when the wgpu feature is enabled. ### Method pub fn from_wgpu(format: TextureFormat) -> Option ### Parameters - **format** (TextureFormat) - Required - The wgpu texture format to convert. ### Returns - **Option** - The corresponding ImageFormat, or None if the format is not supported. ### Availability - Requires crate feature `wgpu`. ``` -------------------------------- ### AaSupport::all Source: https://docs.rs/vello/latest/vello/struct.AaSupport.html Creates an AaSupport value that supports every anti-aliasing method. This might increase startup time as more shader variations must be compiled. ```APIDOC ## AaSupport::all ### Description Support every anti-aliasing method. This might increase startup time, as more shader variations must be compiled. ### Method Associated function ### Signature ```rust pub fn all() -> Self ``` ### Returns - **Self** - An `AaSupport` value with all anti-aliasing methods enabled. ``` -------------------------------- ### Render Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Documentation for the Render struct in the vello low_level module, including its methods and trait implementations. ```APIDOC ## Struct Render ### Description State for a render in progress. ### Methods #### new ```rust pub fn new() -> Self ``` Creates a new `Render` instance. #### render_encoding_coarse ```rust pub fn render_encoding_coarse( &mut self, encoding: &Encoding, resolver: &mut Resolver, shaders: &FullShaders, persistent_image_atlas: &mut Option, params: &RenderParams, robust: bool, ) -> Recording ``` Prepare a recording for the coarse rasterization phase. The `robust` parameter controls whether we're preparing for readback of the atomic bump buffer, for robust dynamic memory. #### record_fine ```rust pub fn record_fine(&mut self, shaders: &FullShaders, recording: &mut Recording) ``` Run fine rasterization assuming the coarse phase succeeded. #### out_image ```rust pub fn out_image(&self) -> ImageProxy ``` Get the output image. This is going away, as the caller will add the output image to the bind map. #### bump_buf ```rust pub fn bump_buf(&self) -> BufferProxy ``` Returns the bump buffer proxy. #### take_captured_buffers ```rust pub fn take_captured_buffers(&mut self) -> Option ``` Available on crate feature `debug_layers` only. Takes the captured buffers. ### Trait Implementations - `Default` for `Render` - `Drop` for `Render` (available on crate feature `debug_layers` only) ### Auto Trait Implementations - `Freeze`, `RefUnwindSafe`, `Send`, `Sync`, `Unpin`, `UnsafeUnpin`, `UnwindSafe` ### Blanket Implementations - `Any`, `Borrow`, `BorrowMut`, `Downcast`, `From`, `Into`, `TryFrom`, `TryInto`, `Upcast`, `WasmNotSend`, `WasmNotSendSync`, `WasmNotSync` ``` -------------------------------- ### Recording::upload Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search= Commands to upload the given data to a new buffer with the given name. Returns a BufferProxy to the buffer. ```APIDOC ## Recording::upload ### Description Commands to upload the given data to a new buffer with the given name. Returns a `BufferProxy` to the buffer. ### Method upload ### Parameters - **name** (&'static str) - Required - The name of the buffer. - **data** (impl Into>) - Required - The data to upload. ### Returns - **BufferProxy** - A proxy to the uploaded buffer. ``` -------------------------------- ### RenderContext::create_render_surface Source: https://docs.rs/vello/latest/vello/util/struct.RenderContext.html?search=u32+-%3E+bool Creates a new render surface for the specified window and dimensions. ```APIDOC ## RenderContext::create_render_surface ### Description Creates a new render surface for the specified window and dimensions. ### Method create_render_surface ### Signature pub async fn create_render_surface<'w>( &mut self, surface: Surface<'w>, width: u32, height: u32, present_mode: PresentMode, ) -> Result, Error> ### Parameters - **surface** (Surface<'w>) - Required - The surface to create a render surface for. - **width** (u32) - Required - The width of the render surface. - **height** (u32) - Required - The height of the render surface. - **present_mode** (PresentMode) - Required - The presentation mode for the render surface. ### Returns Result, Error> - The created render surface or an error. ``` -------------------------------- ### upload Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search=std%3A%3Avec Uploads data to a new buffer with the given name and returns a BufferProxy. ```APIDOC ## upload(&mut self, name: &'static str, data: impl Into>) -> BufferProxy ### Description Commands to upload the given data to a new buffer with the given name. Returns a `BufferProxy` to the buffer. ### Method upload ### Parameters - **name** (&'static str) - Required - The name of the buffer. - **data** (impl Into>) - Required - The data to upload. ### Returns - **BufferProxy** - A proxy to the uploaded buffer. ``` -------------------------------- ### RendererOptions Source: https://docs.rs/vello/latest/vello/struct.RendererOptions.html?search= Options which are set at renderer creation time, used in Renderer::new. This struct is available on crate feature 'wgpu' only. ```APIDOC ## Struct RendererOptions ### Description Options which are set at renderer creation time, used in `Renderer::new`. Available on crate feature `wgpu` only. ### Fields - **use_cpu** (bool) - If true, run all stages up to fine rasterization on the CPU. This is not a recommended configuration as it is expected to have poor performance, but it can be useful for debugging. - **antialiasing_support** (AaSupport) - Represents the enabled set of AA configurations. This will be used to determine which pipeline permutations should be compiled at startup. By default this will be all modes, to support the widest range of. It is recommended that most users configure this. - **num_init_threads** (Option) - How many threads to use for initialisation of shaders. Use `Some(1)` to use a single thread. This is recommended when on macOS (see https://github.com/bevyengine/bevy/pull/10812#discussion_r1496138004). Set to `None` to use a heuristic which will use many but not all threads. Has no effect on WebAssembly. Will default to `None` on most platforms, `Some(1)` on macOS. - **pipeline_cache** (Option) - The pipeline cache to use when creating the shaders. For much more discussion of expected usage patterns, see the documentation on that type. ### Trait Implementations - **Default** - Provides a default value for the struct. ``` -------------------------------- ### Recording::push Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search= Appends a Command to the back of the Recording. ```APIDOC ## Recording::push ### Description Appends a `Command` to the back of the `Recording`. ### Method push ### Parameters - **cmd** (Command) - Required - The command to append. ### Returns - (void) - No return value. ``` -------------------------------- ### ImageFormat::to_wgpu Source: https://docs.rs/vello/latest/vello/low_level/enum.ImageFormat.html?search= Converts the ImageFormat to a wgpu TextureFormat. Available only when the wgpu feature is enabled. ```APIDOC ## ImageFormat::to_wgpu ### Description Converts the ImageFormat to a wgpu TextureFormat. Available only when the wgpu feature is enabled. ### Method pub fn to_wgpu(self) -> TextureFormat ### Parameters - **self** (ImageFormat) - Required - The image format to convert. ### Returns - **TextureFormat** - The corresponding wgpu texture format. ### Availability - Requires crate feature `wgpu`. ``` -------------------------------- ### Render Methods Source: https://docs.rs/vello/latest/vello/low_level/struct.Render.html?search=std%3A%3Avec Methods for the Render struct in the vello low-level API. ```APIDOC ## Render::new ### Description Creates a new `Render` instance to manage state for a render in progress. ### Method `pub fn new() -> Self` ### Parameters None. ### Returns - `Self` - A new `Render` instance. ``` ```APIDOC ## Render::render_encoding_coarse ### Description Prepares a recording for the coarse rasterization phase. The `robust` parameter controls whether we're preparing for readback of the atomic bump buffer, for robust dynamic memory. ### Method `pub fn render_encoding_coarse(&mut self, encoding: &Encoding, resolver: &mut Resolver, shaders: &FullShaders, persistent_image_atlas: &mut Option, params: &RenderParams, robust: bool) -> Recording` ### Parameters - `encoding` (`&Encoding`) - Required - The encoding to render. - `resolver` (`&mut Resolver`) - Required - The resolver for resources. - `shaders` (`&FullShaders`) - Required - The shaders to use. - `persistent_image_atlas` (`&mut Option`) - Required - The persistent image atlas. - `params` (`&RenderParams`) - Required - The render parameters. - `robust` (`bool`) - Required - Whether to prepare for robust dynamic memory readback. ### Returns - `Recording` - A recording for the coarse rasterization phase. ``` ```APIDOC ## Render::record_fine ### Description Runs fine rasterization assuming the coarse phase succeeded. ### Method `pub fn record_fine(&mut self, shaders: &FullShaders, recording: &mut Recording)` ### Parameters - `shaders` (`&FullShaders`) - Required - The shaders to use. - `recording` (`&mut Recording`) - Required - The recording to update. ### Returns None. ``` ```APIDOC ## Render::out_image ### Description Gets the output image. This is going away, as the caller will add the output image to the bind map. ### Method `pub fn out_image(&self) -> ImageProxy` ### Parameters None. ### Returns - `ImageProxy` - The output image. ``` ```APIDOC ## Render::bump_buf ### Description Gets the bump buffer. ### Method `pub fn bump_buf(&self) -> BufferProxy` ### Parameters None. ### Returns - `BufferProxy` - The bump buffer. ``` ```APIDOC ## Render::take_captured_buffers ### Description Takes the captured buffers. Available only on the `debug_layers` feature. ### Method `pub fn take_captured_buffers(&mut self) -> Option` ### Parameters None. ### Returns - `Option` - The captured buffers, if any. ``` -------------------------------- ### Scene Methods Source: https://docs.rs/vello/latest/vello/struct.Scene.html Methods for creating, resetting, inspecting, and manipulating a Scene in the Vello rendering library. ```APIDOC ## Scene::new ### Description Creates a new empty scene. ### Method new ### Signature ```rust pub fn new() -> Self ``` ### Parameters None ### Returns - **Self** - A new empty `Scene` instance. ``` ```APIDOC ## Scene::reset ### Description Removes all content from the scene, clearing all drawing commands and resources. ### Method reset ### Signature ```rust pub fn reset(&mut self) ``` ### Parameters None ### Returns - **()** - Nothing. ``` ```APIDOC ## Scene::bump_estimate ### Description Tally up the bump allocator estimate for the current state of the encoding, taking into account an optional transform applied to the entire scene. This method is only available when the `bump_estimate` crate feature is enabled. ### Method bump_estimate ### Signature ```rust pub fn bump_estimate(&self, transform: Option) -> BumpAllocatorMemory ``` ### Parameters #### Parameters - **transform** (Option) - Required - An optional transform applied to the entire scene. ### Returns - **BumpAllocatorMemory** - The bump allocator memory estimate. ``` ```APIDOC ## Scene::encoding ### Description Returns the underlying raw encoding of the scene. ### Method encoding ### Signature ```rust pub fn encoding(&self) -> &Encoding ``` ### Parameters None ### Returns - **&Encoding** - A reference to the underlying raw encoding. ``` ```APIDOC ## Scene::encoding_mut ### Description Returns a mutable reference to the underlying raw encoding. This can be used to more easily create invalid scenes, and so should be used with care. ### Method encoding_mut ### Signature ```rust pub fn encoding_mut(&mut self) -> &mut Encoding ``` ### Parameters None ### Returns - **&mut Encoding** - A mutable reference to the underlying raw encoding. ``` ```APIDOC ## Scene::push_layer ### Description Pushes a new layer clipped by the specified shape and composed with previous layers using the specified blend mode. The `clip_style` controls how the `clip` shape is interpreted. Every drawing command after this call will be clipped by the shape until the layer is popped. The transforms are not saved or modified by the layer stack; the `transform` argument only applies a transform to the `clip` shape. ### Method push_layer ### Signature ```rust pub fn push_layer<'a>( &mut self, clip_style: impl Into>, blend: impl Into, alpha: f32, transform: Affine, clip: &impl Shape, ) ``` ### Parameters #### Parameters - **clip_style** (impl Into>) - Required - Controls how the `clip` shape is interpreted. Use `Fill` to clip to the interior of the shape, or `Stroke` (via `&Stroke`) to clip to the stroked outline. - **blend** (impl Into) - Required - The blend mode used to compose with previous layers. - **alpha** (f32) - Required - The alpha value for the layer. - **transform** (Affine) - Required - A transform applied to the `clip` shape. - **clip** (&impl Shape) - Required - The shape used for clipping. ### Returns - **()** - Nothing. ``` ```APIDOC ## Scene::push_luminance_mask_layer ### Description Pushes a new layer clipped by the specified shape and treated like a luminance mask for the current layer. Content drawn between this and the matching `pop_layer` call will serve as a luminance mask for the prior content in this layer. The `clip_style` controls how the `clip` shape is interpreted. Every drawing command after this call will be clipped by the shape until the layer is popped. The transforms are not saved or modified by the layer stack; the `transform` argument only applies a transform to the `clip` shape. ### Method push_luminance_mask_layer ### Signature ```rust pub fn push_luminance_mask_layer<'a>( &mut self, clip_style: impl Into>, alpha: f32, transform: Affine, clip: &impl Shape, ) ``` ### Parameters #### Parameters - **clip_style** (impl Into>) - Required - Controls how the `clip` shape is interpreted. Use `Fill` to clip to the interior of the shape, or `Stroke` (via `&Stroke`) to clip to the stroked outline. - **alpha** (f32) - Required - The alpha value for the layer. - **transform** (Affine) - Required - A transform applied to the `clip` shape. - **clip** (&impl Shape) - Required - The shape used for clipping. ### Returns - **()** - Nothing. ``` -------------------------------- ### ResourceProxy Source: https://docs.rs/vello/latest/vello/low_level/enum.ResourceProxy.html?search= Documentation for the ResourceProxy enum in the vello low_level module, including its variants, methods, and trait implementations. ```APIDOC ## ResourceProxy ### Description An enum representing a resource proxy that can be either a buffer, a buffer range, or an image. It provides constructors and accessors for these variants. ### Variants - **Buffer(BufferProxy)** - A buffer proxy. - **BufferRange { proxy: BufferProxy, offset: u64, size: u64 }** - A buffer range with a proxy, offset, and size. - **Image(ImageProxy)** - An image proxy. ### Methods #### new_buf(size: u64, name: &'static str) -> Self Creates a new buffer resource proxy with the given size and name. #### new_image(width: u32, height: u32, format: ImageFormat) -> Self Creates a new image resource proxy with the given width, height, and format. #### as_buf(&self) -> Option<&BufferProxy> Returns a reference to the buffer proxy if this is a buffer variant, otherwise None. #### as_image(&self) -> Option<&ImageProxy> Returns a reference to the image proxy if this is an image variant, otherwise None. ### Trait Implementations - **Clone** - Supports cloning. - **Copy** - Supports copying. - **From** - Converts from a BufferProxy. - **From** - Converts from an ImageProxy. ### Auto Traits - Freeze, RefUnwindSafe, Send, Sync, Unpin, UnsafeUnpin, UnwindSafe ### Blanket Implementations - Any, Borrow, BorrowMut, CloneToUninit, Downcast, From, Into, ToOwned, TryFrom, TryInto, Upcast, WasmNotSend, WasmNotSendSync, WasmNotSync ``` -------------------------------- ### ResourceProxy::as_buf Source: https://docs.rs/vello/latest/vello/low_level/enum.ResourceProxy.html?search=std%3A%3Avec Returns a reference to the underlying BufferProxy if the resource is a buffer, otherwise None. ```APIDOC ## ResourceProxy::as_buf ### Description Returns a reference to the underlying BufferProxy if the ResourceProxy is a buffer variant, otherwise returns None. ### Method `pub fn as_buf(&self) -> Option<&BufferProxy>` ### Parameters - `&self` - Required - The ResourceProxy instance. ### Returns - `Option<&BufferProxy>` - A reference to the buffer proxy if the resource is a buffer, otherwise None. ``` -------------------------------- ### Recording::clear_all Source: https://docs.rs/vello/latest/vello/low_level/struct.Recording.html?search= Commands to clear the whole buffer. ```APIDOC ## Recording::clear_all ### Description Commands to clear the whole buffer. ### Method clear_all ### Parameters - **buf** (BufferProxy) - Required - The buffer to clear. ### Returns - (void) - No return value. ```