Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

V: Display Performance — Fast, Typical, High Quality display

Brandon Thomasc0f8679ba506
diff --git a/Cargo.lock b/Cargo.lock
index aa455f8db..23282fccd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1033,6 +1033,7 @@ dependencies = [
"hayro",
"image",
"log",
+ "serde",
"vello_common 0.2.0",
"vello_cpu 0.2.0",
]
diff --git a/ROADMAP.md b/ROADMAP.md
index 355b29773..69d896adb 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -30,6 +30,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
- Edit › Paste Into (copied objects become a frame's content, clipped by it; rendered, PDF and IDML both ways — verified in InDesign 2026); Polygon Settings (sides, star inset; double-click the Polygon tool).
- Color panel (fill/stroke proxy, CMYK/RGB/Lab sliders with channel ramps, tint slider for swatches, spectrum ramp, Add to Swatches) and Color Picker (double-click the proxy); mixed colours are unnamed (not listed in Swatches until added); `object.color`, `swatch.addToSwatches`, `swatch.addUnnamed`.
- Place text files: Word (.docx: styles by name with their attributes, bold/italic/underline/size/font, footnotes, tables, tabs, breaks), RTF and plain text, into the insertion point, the selected frame or a new frame; autoflow adds pages and threaded frames until the text fits; Remove Styles option (`designcraft-textimport`).
+- View › Display Performance: Fast (grey boxes, no effects, ⌥⇧⌘Z), Typical (72 ppi proxies, ⌥⌘Z), High Quality (⌥⌘H, our default — the renderer is fast enough).
- OpenType menu (Character panel): discretionary ligatures, fractions, ordinal, swash, titling, contextual alternates, slashed zero, the four figure styles and stylistic sets 1–20; `type.openType`; mapped to IDML's OTF attributes.
- Add Anchor Point (=), Delete Anchor Point (-) and Convert Direction Point (⇧C) tools (click toggles smooth/corner, drag pulls out handles), with `path.addAnchor`, `path.deleteAnchor`, `path.convertAnchor`.
- Gradients: the Gradient Swatch tool (G) drags a gradient's start and end across objects (Shift: 45°); the Gradient panel sets type, angle, reverse and edits stops on a ramp (drag, add, drag off to remove, location, colour). Edited gradients are unnamed swatches; `object.gradient`; the vector round-trips through IDML.
diff --git a/crates/render/Cargo.toml b/crates/render/Cargo.toml
index b925e65a4..9f69cc4a4 100644
--- a/crates/render/Cargo.toml
+++ b/crates/render/Cargo.toml
@@ -19,6 +19,7 @@ vello_common = { workspace = true }
image = { workspace = true }
hayro = { workspace = true }
log = { workspace = true }
+serde = { workspace = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
vello_cpu = { workspace = true, features = ["multithreading"] }
diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs
index 16b17a192..0153bde8c 100644
--- a/crates/render/src/lib.rs
+++ b/crates/render/src/lib.rs
@@ -99,6 +99,21 @@ pub struct RenderOptions {
pub page_shadow: bool,
/// Pink highlight behind text set in fonts that aren't installed (screen view).
pub highlight_missing_fonts: bool,
+ /// View › Display Performance.
+ pub quality: DisplayQuality,
+}
+
+/// View › Display Performance: how placed graphics and effects are drawn on screen.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum DisplayQuality {
+ /// Graphics as grey boxes, no transparency effects.
+ Fast,
+ /// Low-resolution proxies (72 ppi at 100%).
+ Typical,
+ /// Full resolution.
+ #[default]
+ High,
}
impl Default for RenderOptions {
@@ -111,6 +126,7 @@ impl Default for RenderOptions {
greek_below_px: 0.0,
page_shadow: false,
highlight_missing_fonts: false,
+ quality: DisplayQuality::High,
}
}
}
@@ -391,7 +407,8 @@ impl Renderer {
Content::Text(_) => 36.0 + 0.25 * vb.width().max(vb.height()),
_ => 0.0,
};
- let fx_outset = if it.effects.any() { fx::outset(it) } else { 0.0 };
+ let effects = it.effects.any() && f.opts.quality != DisplayQuality::Fast;
+ let fx_outset = if effects { fx::outset(it) } else { 0.0 };
if !rect_overlaps(vb.inflate(margin + fx_outset, margin + fx_outset), f.visible) {
return;
}
@@ -402,7 +419,7 @@ impl Renderer {
ctx.set_transform(Affine::IDENTITY);
ctx.push_layer(None, Some(blend_mode(it.blend)), Some(it.opacity), None, None);
}
- if it.effects.any() {
+ if effects {
self.draw_item_fx(ctx, f, it, &bp, xf, page_name);
} else {
self.draw_body(ctx, f, it, &bp, xf, page_name);
@@ -536,8 +553,15 @@ impl Renderer {
fn draw_graphic(&mut self, ctx: &mut RenderContext, f: &Frame, g: &designcraft_doc::Graphic, xf: Affine) {
let Some(asset) = f.doc.assets.get(&g.asset) else { return };
- // Pick a mip level close to the on-screen size.
+ if f.opts.quality == DisplayQuality::Fast {
+ ctx.set_transform(f.view * xf * g.xf);
+ ctx.set_paint(peniko::Color::from_rgba8(178, 178, 178, 255));
+ ctx.fill_rect(&Rect::new(0.0, 0.0, g.size.0, g.size.1));
+ return;
+ }
+ // Pick a mip level close to the on-screen size (Typical: a 72 ppi proxy).
let on_screen = (f.view * xf * g.xf).determinant().abs().sqrt();
+ let on_screen = if f.opts.quality == DisplayQuality::Typical { on_screen.min(1.0) } else { on_screen };
let Some(pm) = images::mip(&asset.data, g.size.0, on_screen) else { return };
let rect = Rect::new(0.0, 0.0, g.size.0, g.size.1);
ctx.set_transform(f.view * xf * g.xf);
@@ -808,6 +832,48 @@ mod tests {
assert!(gap[0] < 80 && gap[2] > 150, "gap {gap:?}");
}
+ #[test]
+ fn display_performance_fast_draws_grey_boxes() {
+ let mut d = Document::new(&NewDocument::default());
+ let lid = d.default_layer();
+ // A 4×4 red PNG placed at 100,100 (100×100 pt).
+ let mut png = Vec::new();
+ image::RgbaImage::from_pixel(4, 4, image::Rgba([255, 0, 0, 255]))
+ .write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png)
+ .unwrap();
+ let aid = designcraft_doc::AssetId(d.alloc());
+ d.assets.insert(
+ aid,
+ Arc::new(designcraft_doc::Asset {
+ id: aid,
+ name: "red.png".into(),
+ mime: "image/png".into(),
+ link: None,
+ data: Arc::new(png),
+ pixels: Some((4, 4)),
+ }),
+ );
+ let id = designcraft_doc::ItemId(d.alloc());
+ let mut it =
+ Item::new(id, lid, designcraft_doc::Shape::Rectangle, designcraft_geom::shapes::rectangle(Rect::new(100.0, 100.0, 200.0, 200.0)));
+ it.content = designcraft_doc::Content::Graphic(designcraft_doc::Graphic {
+ asset: aid,
+ size: (100.0, 100.0),
+ xf: Affine::translate((100.0, 100.0)),
+ auto_fit: Default::default(),
+ });
+ d.insert_item(SpreadRef::Doc(0), it, None).unwrap();
+ let cache = Cache::new();
+ let mut r = Renderer::new();
+ r.threads = 0;
+ let px = |q: DisplayQuality, r: &mut Renderer| {
+ r.render_page(&d, &cache, 0, 1.0, false, &RenderOptions { quality: q, ..Default::default() }).unwrap().pixel(150, 150)
+ };
+ assert_eq!(px(DisplayQuality::High, &mut r)[..3], [255, 0, 0]);
+ assert_eq!(px(DisplayQuality::Typical, &mut r)[..3], [255, 0, 0]);
+ assert_eq!(px(DisplayQuality::Fast, &mut r)[..3], [178, 178, 178]);
+ }
+
#[test]
fn missing_fonts_are_highlighted_on_screen_only() {
let mut d = Document::new(&NewDocument::default());
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 0c87bf3c6..043e4374f 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -311,6 +311,7 @@ fn render_texture(app: &mut DesignApp, ctx: &egui::Context, rect: Rect, xf: &Xf,
printing_only: preview,
greek_below_px: 3.0 * ppp,
highlight_missing_fonts: !preview,
+ quality: app.ui.display_quality,
..Default::default()
};
(st.doc.clone(), placed, w, h, view, opts)
@@ -413,6 +414,7 @@ fn patch_texture(app: &mut DesignApp, layout: &CanvasLayout, ppp: f64, doc_key:
printing_only: preview,
greek_below_px: 3.0 * ppp,
highlight_missing_fonts: !preview,
+ quality: app.ui.display_quality,
..Default::default()
};
let img = app.canvas.patcher.render(&new, &app.session.cache, &placed, (x1 - x0) as u32, (y1 - y0) as u32, view, &opts);
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index da9aa400b..c794576f3 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -83,6 +83,8 @@ pub struct UiState {
pub document_grid: bool,
pub text_threads: bool,
pub hidden_characters: bool,
+ /// View › Display Performance.
+ pub display_quality: designcraft_render::DisplayQuality,
pub control_bar: bool,
pub tools_double_column: bool,
/// Expanded right-dock panel group tab.
@@ -128,6 +130,7 @@ impl Default for UiState {
document_grid: false,
text_threads: false,
hidden_characters: false,
+ display_quality: designcraft_render::DisplayQuality::High,
control_bar: false,
tools_double_column: false,
dock_tab: "properties".into(),
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 595600b58..0c03842d0 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -42,6 +42,9 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[
("view.baselineGrid", "Show/Hide Baseline Grid", Some("Cmd+Alt+'"), "{}"),
("view.textThreads", "Show/Hide Text Threads", Some("Cmd+Alt+Y"), "{}"),
("view.hiddenCharacters", "Show/Hide Hidden Characters", Some("Cmd+Alt+I"), "{}"),
+ ("view.fastDisplay", "Fast Display", Some("Cmd+Alt+Shift+Z"), "{} — placed graphics as grey boxes, no effects"),
+ ("view.typicalDisplay", "Typical Display", Some("Cmd+Alt+Z"), "{} — low-resolution image proxies"),
+ ("view.highQualityDisplay", "High Quality Display", Some("Cmd+Alt+H"), "{} — full-resolution images"),
("view.goToPage", "Go to Page…", Some("Cmd+J"), "{page}"),
(
"window.panel",
@@ -351,6 +354,11 @@ pub const MENUS: &[(&str, &[&str])] = &[
"ui:view.entirePasteboard",
"-",
"ui:view.togglePreview",
+ ">Display Performance",
+ "ui:view.fastDisplay",
+ "ui:view.typicalDisplay",
+ "ui:view.highQualityDisplay",
+ "<",
"-",
"ui:view.rulers",
"ui:view.frameEdges",
@@ -570,6 +578,17 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,
Ok(Value::Null)
}
"view.frameEdges" => flag(&mut app.ui.frame_edges),
+ "view.fastDisplay" | "view.typicalDisplay" | "view.highQualityDisplay" => {
+ use designcraft_render::DisplayQuality as Q;
+ app.ui.display_quality = match id {
+ "view.fastDisplay" => Q::Fast,
+ "view.typicalDisplay" => Q::Typical,
+ _ => Q::High,
+ };
+ // Redraw everything at the new quality.
+ app.canvas.shown = None;
+ Ok(Value::Null)
+ }
"view.rulers" => flag(&mut app.ui.rulers),
"view.guides" => flag(&mut app.ui.guides),
"view.baselineGrid" => flag(&mut app.ui.baseline_grid),
@@ -836,6 +855,9 @@ pub fn checked(app: &DesignApp, id: &str, params: &Value) -> Option<bool> {
Some(match id {
"view.rulers" => app.ui.rulers,
"view.frameEdges" => app.ui.frame_edges,
+ "view.fastDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::Fast,
+ "view.typicalDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::Typical,
+ "view.highQualityDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::High,
"view.guides" => app.ui.guides,
"view.baselineGrid" => app.ui.baseline_grid,
"view.textThreads" => app.ui.text_threads,
diff --git a/docs/parity.md b/docs/parity.md
index 420469d58..55cf031b3 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -9,7 +9,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Priority | Features | Done | Partial | Missing | Parity |
|---|---|---|---|---|---|
-| P0 | 102 | 95 | 7 | 0 | 97% |
+| P0 | 102 | 97 | 5 | 0 | 98% |
| P1 | 97 | 33 | 23 | 41 | 46% |
| P2 | 76 | 8 | 7 | 61 | 15% |
@@ -22,7 +22,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Transform | 78% |
| Fill, stroke, colour | 69% |
| Effects & transparency | 50% |
-| Placing & links | 57% |
+| Placing & links | 62% |
| Type & text frames | 77% |
| Typography | 79% |
| Styles | 61% |
@@ -31,11 +31,11 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Interactivity & digital | 30% |
| Output & production | 48% |
| XML & automation | 39% |
-| View & navigation | 62% |
+| View & navigation | 68% |
| Undo, history, saving | 100% |
| Accessibility | 20% |
-Open P0 items: Dockable panels, Preferences, Raster formats, Vector/page formats (PDF/AI/SVG/EPS place), Display performance, Export to PDF (print), Display performance.
+Open P0 items: Dockable panels, Preferences, Raster formats, Vector/page formats (PDF/AI/SVG/EPS place), Export to PDF (print).
## Rows
@@ -179,7 +179,7 @@ Open P0 items: Dockable panels, Preferences, Raster formats, Vector/page formats
| Placing & links | Captions | P2 | M |
| Placing & links | Image import options | P1 | M |
| Placing & links | Linked text/stories | P2 | M |
-| Placing & links | Display performance | P0 | P |
+| Placing & links | Display performance | P0 | D |
| Placing & links | Video/audio | P2 | M |
| Type & text frames | Text frames | P0 | D |
| Type & text frames | Threading | P0 | D |
@@ -304,7 +304,7 @@ Open P0 items: Dockable panels, Preferences, Raster formats, Vector/page formats
| View & navigation | Rulers, guides, grids toggles | P0 | D |
| View & navigation | Show/hide frame edges, threads, hidden chars | P0 | D |
| View & navigation | Structure / tag markers | P2 | M |
-| View & navigation | Display performance | P0 | P |
+| View & navigation | Display performance | P0 | D |
| View & navigation | Navigate pages | P0 | D |
| View & navigation | Split window | P2 | M |
| View & navigation | Rotate spread view | P2 | M |