Skip to main content

render_image

Function render_image 

Source
pub fn render_image(view: &ViewHandle, width: u32, height: u32) -> Rendered
Expand description

Render a view through SwiftUI’s own ImageRenderer.

This is a different path from render, and the difference matters: cacheDisplayInRect captures the AppKit layer tree, which does not execute Metal shader effects or Liquid Glass compositing — those are resolved by SwiftUI’s renderer, so they come out as no-ops. ImageRenderer goes through SwiftUI itself and produces what the shader actually computes.

The view is framed to the requested size first, since ImageRenderer renders at the content’s natural size.