oxidize-html-gpui
GPUI rendering backend for oxidize-html-engine. Translates DrawCommands into GPUI elements.
Usage
Add to your Cargo.toml:
[]
= {
oxidize-render = { path = "../oxidize-render", features = ["gpui"] }
= {
Then in your GPUI component:
use HtmlRenderer;
use ;
use ;
let mut renderer = default;
let commands = renderer.render_html;
let = content_extent;
let mut document = div
.relative
.w
.h;
for command in &commands
Public API
command_element(command: &DrawCommand) -> gpui::Div
Converts a single DrawCommand into a GPUI Div element positioned absolutely within a document canvas.
content_extent(commands: &[DrawCommand]) -> (f32, f32)
Computes the total (width, height) of the rendered document from its draw commands. Use this to size the canvas container.
to_bounds_with_offset(rect: Rect, ox: f32, oy: f32) -> Bounds<Pixels>
Converts an engine Rect to a GPUI Bounds<Pixels> with a scroll or origin offset applied. Useful for hit testing links and interactive elements.
Example:
use DrawCommand;
use to_bounds_with_offset;
use Bounds;
// inside Element::paint, where `bounds: Bounds` is available:
let ox = f32from;
let oy = f32from;
for command in &commands
Features
| Feature | Description |
|---|---|
gpui |
Enables the GPUI rendering backend (required) |