Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

Drawings are .klad folders in a fresh format, klad/1

Indicode BVe2dcd8faca3a
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 7617754..af28c1c 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -9,7 +9,7 @@ labels: bug
**What you expected**
**How to make it happen again**
-The steps in the editor, or the `klad` commands. A zipped `.draw` folder that shows it helps most.
+The steps in the editor, or the `klad` commands. A zipped `.klad` folder that shows it helps most.
**Version and machine**
- `klad --version`:
diff --git a/.gitignore b/.gitignore
index 9a92350..ba5409a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,12 @@
target/
/examples/
.DS_Store
-*.draw/.cache/
+*.klad/.cache/
/scratch
/references/
__pycache__/
-/samples/*/*.draw/
+/samples/*/*.klad/
/samples/*/*.png
/samples/*/*-godot/
/samples/*/*.json
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ec9f56..aeffbb6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,12 @@
The first builds, and klad's licences.
+- Drawings are `.klad` folders in a fresh format, `klad/1`. Drawings from before (`.draw` folders) do not open and are not converted.
- klad is source-available, not open source: the app is under the PolyForm Internal Use License 1.0.0, with permission for personal use, to propose contributions and to share the drawings you make (`LICENSE`); bought builds are under the same terms. The file format (`docs/format.md`), the command reference (`docs/cli.md`), the agent skill and the new `klad-client` crate are MIT (`LICENSE-MIT`), so any program or agent can read, write and make klad drawings. Contributions come in under a contributor licence agreement (`CLA.md`).
- `klad-client`: run klad from Rust, apply edits as JSON ops, read drawings back as JSON, render them.
- Builds for macOS (an app, Apple silicon and Intel in one) and Windows, sold on itch.io; Linux from source. Each has the `klad` command line, the editor, the fonts, the licences and the agent skill.
- The editor runs on Windows and Linux (`klad open`, or `klad-editor`), with the platform's open dialog; pens that report pressure through the system (Windows) draw with it.
-- On a Mac, `.draw` drawings show in Finder as one item and open in klad with a double click.
+- On a Mac, `.klad` drawings show in Finder as one item and open in klad with a double click.
- `klad install` (and "install the klad command" in the editor's document menu) puts `klad` on the terminal's path, for you and for agents. `klad skill` prints the agent skill.
- The editor checks once a day whether a newer version is out and says so, with a link to what changed (off in the settings window); About's "check now" and `klad updates` check on demand and say why a check failed.
- The agent's key field turns away a Claude subscription token (from `claude setup-token`) and says why: klad needs a Claude Console API key.
diff --git a/CLAUDE.md b/CLAUDE.md
index 41e6eab..3853743 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -30,7 +30,7 @@ Agent-first 2D art application in Rust: a `klad` CLI for agents and a native edi
- No comments in code except `// TODO:`.
- Iterator chains over `for` loops where they read better; plain loops in hot pixel paths where they are clearer or faster.
- Determinism in `core`, `brush` and `render`: transcendental math through `libm`, one seeded RNG (`klad_core::rng`), no wall clock, no `HashMap` iteration order in output, parallelism only over independent units (tiles, image rows).
-- Bundles are never broken by a format change: bump the format version and add a migration. The format id inside `doc.json` stays `draw-anything/N` (the project's earlier name) so every bundle keeps opening.
+- Bundles are never broken by a format change: bump the format version (`klad/N` in `doc.json`) and add a migration, and update `docs/format.md` in the same change. `klad/1` (2026-11-06) started clean: the `.draw` folders before it (`draw-anything/0` to `/9`) do not open, by Kevin's choice.
- Permissive dependencies only: MIT, Apache-2.0, BSD-2/3, ISC, Zlib, BSL-1.0, Unicode-3.0, CC0-1.0; fonts bundled in the editor may be OFL-1.1 or the Ubuntu Font Licence (egui's), and the fonts in `fonts/` OFL-1.1 or Apache-2.0 (`fonts/update.py` fetches them unchanged; the notices list them). No GPL, LGPL or MPL unless dual licensed with one of these. `deny.toml` holds the list and `just audit` checks it; every shipped licence text is in `THIRD-PARTY-NOTICES.md` (`just notices`).
- klad is source-available, not open source, copyright Indicode BV: the app is under the PolyForm Internal Use License 1.0.0 with permissions for personal use, proposing contributions and sharing drawings, which also covers the builds it sells (`LICENSE`; `license-file` in Cargo, since it has no SPDX identifier). `docs/format.md`, `docs/cli.md`, `docs/skill/` and `crates/client` are MIT (`LICENSE-MIT`): `klad-client` depends on none of the other crates, a format change updates `docs/format.md` in the same change, and a command change runs `just reference` (a test checks `docs/cli.md`). Outside contributions come in under the CLA (`CLA.md`).
- No em-dashes in docs, messages or UI text.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1343425..2176032 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ Thank you for looking. klad is young and changes fast; issues with a drawing tha
## Before you start
-- Bugs: open an issue with what you did, what you saw (run the command again with `KLAD_BACKTRACE=1` for the details of an error), `klad --version`, your OS, and if you can the `.draw` folder (zipped) or the commands that make it.
+- Bugs: open an issue with what you did, what you saw (run the command again with `KLAD_BACKTRACE=1` for the details of an error), `klad --version`, your OS, and if you can the `.klad` folder (zipped) or the commands that make it.
- Larger changes: open an issue first, so we can agree on the shape before you build it.
- Security problems: see `SECURITY.md`, not the issue tracker.
@@ -23,7 +23,7 @@ These come from `CLAUDE.md`, which is also the guide for coding agents working o
- No comments in code except `// TODO:`. Names and small functions carry the meaning.
- Iterator chains where they read better than loops; plain loops in hot pixel code where they are clearer or faster.
- Determinism: `core`, `brush` and `render` give the same pixels on every machine. Transcendental math goes through `libm`, randomness through the seeded `klad_core::rng`, no clock, no `HashMap` order in output, parallelism only over independent tiles or rows. A change that moves a sample's hash says why.
-- Bundles never break: a format change bumps the format version and adds a migration, so older drawings open unchanged.
+- Drawings never break: a format change bumps the format version (`klad/N`) and adds a migration, so older `.klad` drawings open unchanged, and updates `docs/format.md`.
- Dependencies are permissive only (MIT, Apache-2.0, BSD, ISC, Zlib and the others in `deny.toml`). Adding one means `just audit` passes and `just notices` regenerates `THIRD-PARTY-NOTICES.md` in the same change.
- Every feature has a CLI form and an editor form: a new command or op also gets its place in the editor, and an editor feature gets its command or op, with tests on both sides. The ops that draw from shapes (`ink`, `light`, `hatch`, `paint`, `scatter`) are the exception and stay CLI only.
- New behaviour comes with tests in the crate that owns it. `just lint` and `just test` are clean before a pull request.
diff --git a/README.md b/README.md
index 2f32ba7..be82431 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,9 @@ Drawings live on a timeline, frame by frame: holds, onion skins, loops and clips
The creature in `samples/creature` is six keys on six layers (lines, colour, a clipped shade and rim light, the far leg, a shadow): an idle and a walk, in-betweened by part, coloured from the first drawing and timed on threes and twos.
```sh
-klad inbetween creature.draw --layers lines,colour --from 3 --to 5 --spacing in-out
-klad arcs creature.draw --track 'lines:near leg' --clip walk --check
-klad export creature.draw --godot ../game/art
+klad inbetween creature.klad --layers lines,colour --from 3 --to 5 --spacing in-out
+klad arcs creature.klad --track 'lines:near leg' --clip walk --check
+klad export creature.klad --godot ../game/art
```
![The courier's idle](docs/images/courier-idle.gif) ![The courier's run](docs/images/courier-run.gif)
@@ -29,9 +29,9 @@ klad export creature.draw --godot ../game/art
The courier in `samples/courier` is drawn from shapes on every frame: a pose function places the body, legs and lantern, and the CLI fills, lights and inks them on thirteen layers. Its 16 drawings play as an idle and a run at 12 frames a second and export to Godot with that timing.
```sh
-klad fill courier.draw flats --shape shell-4 --color shell --frame 4
-klad light courier.draw --from shell-4 --light -0.6,-0.8 --shade shade --rim rim --frame 4
-klad ink courier.draw lines --from shell-4,head-4,near-leg-4 --weight 5 --frame 4
+klad fill courier.klad flats --shape shell-4 --color shell --frame 4
+klad light courier.klad --from shell-4 --light -0.6,-0.8 --shade shade --rim rim --frame 4
+klad ink courier.klad lines --from shell-4,head-4,near-leg-4 --weight 5 --frame 4
```
## Status
@@ -58,7 +58,7 @@ Building takes about ten minutes the first time.
1. Install Rust with [rustup](https://rustup.rs) and [`just`](https://github.com/casey/just) (`brew install just`, or `cargo install just`). On Linux also `pkg-config`, `libfreetype-dev`, `libfontconfig1-dev`, `libxkbcommon-dev` and `libwayland-dev`.
2. `git clone https://github.com/klad-app/klad && cd klad`, then `just build` makes `klad` and `klad-editor` in `target/release/` (on Linux in `target/linux/release/`).
3. `target/release/klad open` starts the editor on its start window: make a drawing and start painting.
-4. `just samples` builds the sample drawings in `samples/` (a lantern, a walking creature, a running courier, an underground ruin, an inn sign, a tree, a meadow, painted solids, a bowl of lemons and the same painted over with brushwork, a bouncing ball, ink examples); open one with `target/release/klad open samples/lantern/lantern.draw`.
+4. `just samples` builds the sample drawings in `samples/` (a lantern, a walking creature, a running courier, an underground ruin, an inn sign, a tree, a meadow, painted solids, a bowl of lemons and the same painted over with brushwork, a bouncing ball, ink examples); open one with `target/release/klad open samples/lantern/lantern.klad`.
5. `just app` makes `klad.app` and a disk image on a Mac; `just dist` makes the archive for the machine you are on (`just dist x86_64-pc-windows-msvc` for another target).
## Drawing with an agent
@@ -66,8 +66,8 @@ Building takes about ten minutes the first time.
Any coding agent that can run commands (Claude Code, Codex and others) can draw. Give it `docs/skill/SKILL.md` (or the output of `klad skill`) as its instructions (it is written as an agent skill) and the path to a drawing, then ask:
```sh
-target/release/klad new art.draw --width 1600 --height 1200 --background '#e9e4da' --sketch
-target/release/klad open art.draw # in another terminal, to watch and draw along
+target/release/klad new art.klad --width 1600 --height 1200 --background '#e9e4da' --sketch
+target/release/klad open art.klad # in another terminal, to watch and draw along
```
> "Block in a rock on the sketch layer, fill it, and paint it as a round form lit from the upper left."
diff --git a/SECURITY.md b/SECURITY.md
index a6bdedf..2b7be05 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -1,6 +1,6 @@
# Security
-klad opens `.draw` folders, pictures and fonts that may come from anyone, and runs agents' commands on them. A file that crashes it, reads or writes outside the drawing, or runs code is a security problem.
+klad opens `.klad` folders, pictures and fonts that may come from anyone, and runs agents' commands on them. A file that crashes it, reads or writes outside the drawing, or runs code is a security problem.
## Reporting
diff --git a/crates/app/src/agent/mod.rs b/crates/app/src/agent/mod.rs
index 1979d42..5b9f768 100644
--- a/crates/app/src/agent/mod.rs
+++ b/crates/app/src/agent/mod.rs
@@ -156,7 +156,7 @@ fn looks_like_path(arg: &str) -> bool {
|| arg.contains('\\')
|| arg.starts_with('~')
|| [
- ".png", ".jpg", ".jpeg", ".json", ".tres", ".tscn", ".ttf", ".otf", ".draw", ".svg",
+ ".png", ".jpg", ".jpeg", ".json", ".tres", ".tscn", ".ttf", ".otf", ".klad", ".svg",
]
.iter()
.any(|e| arg.to_ascii_lowercase().ends_with(e))
@@ -532,9 +532,9 @@ mod tests {
let mut doc = Document::new(320, 200);
doc.canvas.background = Some("#ffffff".into());
doc.layers = vec![Layer::paint("l1", "paint", "c1")];
- Bundle::create(dir.join("art.draw"), doc).unwrap();
+ Bundle::create(dir.join("art.klad"), doc).unwrap();
Drawing {
- bundle: dir.join("art.draw"),
+ bundle: dir.join("art.klad"),
binary: binary(),
editable,
}
@@ -682,13 +682,13 @@ mod tests {
#[test]
fn paths_stay_in_the_drawing_and_base64_is_standard() {
let d = Drawing {
- bundle: PathBuf::from("/w/art.draw"),
+ bundle: PathBuf::from("/w/art.klad"),
binary: PathBuf::new(),
editable: true,
};
- assert!(allowed(&d, "art.draw/brushes/x.json").is_ok());
+ assert!(allowed(&d, "art.klad/brushes/x.json").is_ok());
assert!(allowed(&d, "exports/hero.png").is_ok());
- assert!(allowed(&d, "../other.draw/doc.json").is_err());
+ assert!(allowed(&d, "../other.klad/doc.json").is_err());
assert!(allowed(&d, "/etc/passwd").is_err());
assert!(allowed(&d, "exports/../../x.png").is_err());
assert!(allowed(&d, "M10 20 L 30 40").is_ok());
diff --git a/crates/app/src/commands.rs b/crates/app/src/commands.rs
index e57782c..d8d660b 100644
--- a/crates/app/src/commands.rs
+++ b/crates/app/src/commands.rs
@@ -1904,7 +1904,7 @@ impl Cmd {
G::File,
T::Press(const { &[cmd(Key::N)] }),
R::No,
- "a new .draw bundle: name, folder, size, background; this one stays saved",
+ "a new .klad bundle: name, folder, size, background; this one stays saved",
),
Cmd::OpenDocument => spec(
"file.open",
@@ -1913,7 +1913,7 @@ impl Cmd {
G::File,
T::Press(const { &[cmd(Key::O)] }),
R::No,
- "pick a .draw folder and switch to it; this one stays saved",
+ "pick a .klad folder and switch to it; this one stays saved",
),
Cmd::OpenRecent => spec(
"file.recent",
@@ -2039,7 +2039,7 @@ impl Cmd {
G::File,
T::None,
R::No,
- "puts the .draw folder's path on the clipboard, to hand to the agent",
+ "puts the .klad folder's path on the clipboard, to hand to the agent",
),
Cmd::NudgeDown => spec(
"edit.nudge-down",
diff --git a/crates/app/src/editor/bones.rs b/crates/app/src/editor/bones.rs
index fa61b91..4940910 100644
--- a/crates/app/src/editor/bones.rs
+++ b/crates/app/src/editor/bones.rs
@@ -536,8 +536,8 @@ mod tests {
fn a_pose_from_the_editor_is_the_cli_pose() {
let pose = BTreeMap::from([("fore".to_string(), -45.0), ("upper".to_string(), 0.0)]);
assert_eq!(
- pose_args(std::path::Path::new("/w/a.draw"), "l1", 4, &pose).join(" "),
- "pose /w/a.draw l1 --from 4 --to 4 --bone fore=-45.00"
+ pose_args(std::path::Path::new("/w/a.klad"), "l1", 4, &pose).join(" "),
+ "pose /w/a.klad l1 --from 4 --to 4 --bone fore=-45.00"
);
}
}
diff --git a/crates/app/src/editor/checks.rs b/crates/app/src/editor/checks.rs
index b58e489..3250cd8 100644
--- a/crates/app/src/editor/checks.rs
+++ b/crates/app/src/editor/checks.rs
@@ -471,24 +471,24 @@ mod tests {
#[test]
fn the_job_arguments_are_the_cli_commands() {
- assert_eq!(refill_args("a.draw", "l2", 4).join(" "), "refill a.draw l2 --frame 4");
+ assert_eq!(refill_args("a.klad", "l2", 4).join(" "), "refill a.klad l2 --frame 4");
assert_eq!(
- fill_like_args("a.draw", "l2", "c7", (3, 9)).join(" "),
- "fill a.draw l2 --like c7 --frames 3-9"
+ fill_like_args("a.klad", "l2", "c7", (3, 9)).join(" "),
+ "fill a.klad l2 --like c7 --frames 3-9"
);
assert_eq!(
- gaps_args("a.draw", "l2", (5, 5)).join(" "),
- "gaps a.draw l2 --json --frame 5"
+ gaps_args("a.klad", "l2", (5, 5)).join(" "),
+ "gaps a.klad l2 --json --frame 5"
);
assert_eq!(
- gaps_args("a.draw", "l2", (0, 11)).join(" "),
- "gaps a.draw l2 --json --sheet 0-11"
+ gaps_args("a.klad", "l2", (0, 11)).join(" "),
+ "gaps a.klad l2 --json --sheet 0-11"
);
assert_eq!(
- arcs_args("a.draw", "lines:near leg", (12, 27)),
+ arcs_args("a.klad", "lines:near leg", (12, 27)),
[
"arcs",
- "a.draw",
+ "a.klad",
"--track",
"lines:near leg",
"--from",
@@ -498,7 +498,7 @@ mod tests {
"--json"
]
);
- assert_eq!(font_args("a.draw", "/f/Sign.ttf").join(" "), "font a.draw /f/Sign.ttf");
+ assert_eq!(font_args("a.klad", "/f/Sign.ttf").join(" "), "font a.klad /f/Sign.ttf");
}
#[test]
diff --git a/crates/app/src/editor/clips.rs b/crates/app/src/editor/clips.rs
index 522530f..64cbb57 100644
--- a/crates/app/src/editor/clips.rs
+++ b/crates/app/src/editor/clips.rs
@@ -392,11 +392,11 @@ mod tests {
#[test]
fn the_scene_and_rig_buttons_run_the_cli_export() {
let args = godot_args(
- std::path::Path::new("/w/a.draw"),
+ std::path::Path::new("/w/a.klad"),
"--godot-rig",
std::path::Path::new("/w/game/art"),
);
- assert_eq!(args.join(" "), "export /w/a.draw --godot-rig /w/game/art");
+ assert_eq!(args.join(" "), "export /w/a.klad --godot-rig /w/game/art");
}
#[test]
diff --git a/crates/app/src/editor/compare.rs b/crates/app/src/editor/compare.rs
index b17d1b5..7638037 100644
--- a/crates/app/src/editor/compare.rs
+++ b/crates/app/src/editor/compare.rs
@@ -142,18 +142,18 @@ mod tests {
#[test]
fn the_window_builds_the_cli_compare_and_finds_the_reference() {
let joined = args(
- Path::new("/w/a.draw"),
- Path::new("/w/a.draw/images/f.png"),
+ Path::new("/w/a.klad"),
+ Path::new("/w/a.klad/images/f.png"),
2,
Path::new("/w/h.png"),
)
.join(" ");
assert_eq!(
joined,
- "compare /w/a.draw /w/a.draw/images/f.png --frame 2 --json --heat /w/h.png"
+ "compare /w/a.klad /w/a.klad/images/f.png --frame 2 --json --heat /w/h.png"
);
let mut doc = klad_core::doc::Document::new(100, 100);
- assert!(reference_image(Path::new("/w/a.draw"), &doc).is_none());
+ assert!(reference_image(Path::new("/w/a.klad"), &doc).is_none());
let node: klad_core::doc::Node =
serde_json::from_value(serde_json::json!({"id": "n1", "type": "image", "src": "f.png", "w": 10, "h": 10}))
.unwrap();
@@ -161,8 +161,8 @@ mod tests {
layer.reference = true;
doc.layers = vec![layer];
assert_eq!(
- reference_image(Path::new("/w/a.draw"), &doc),
- Some(PathBuf::from("/w/a.draw/images/f.png"))
+ reference_image(Path::new("/w/a.klad"), &doc),
+ Some(PathBuf::from("/w/a.klad/images/f.png"))
);
}
}
diff --git a/crates/app/src/editor/export.rs b/crates/app/src/editor/export.rs
index 6959876..91d5b07 100644
--- a/crates/app/src/editor/export.rs
+++ b/crates/app/src/editor/export.rs
@@ -242,7 +242,7 @@ mod tests {
#[test]
fn the_window_builds_the_cli_export() {
- let (bundle, home) = (Path::new("/w/art.draw"), Path::new("/w"));
+ let (bundle, home) = (Path::new("/w/art.klad"), Path::new("/w"));
let image = Form {
background: true,
scale: 2.0,
@@ -251,7 +251,7 @@ mod tests {
};
assert_eq!(
args(bundle, home, 3, &image).join(" "),
- "export /w/art.draw --frame 3 --scale 2 --background -o /w/out/hero.png"
+ "export /w/art.klad --frame 3 --scale 2 --background -o /w/out/hero.png"
);
let sheet = Form {
what: What::Sheet,
@@ -262,7 +262,7 @@ mod tests {
};
assert_eq!(
args(bundle, home, 0, &sheet).join(" "),
- "export /w/art.draw --sheet walk --layer l2 --depth 16 --padding 2 --max 4096"
+ "export /w/art.klad --sheet walk --layer l2 --depth 16 --padding 2 --max 4096"
);
let frames = Form {
what: What::Frames,
@@ -273,7 +273,7 @@ mod tests {
};
assert_eq!(
args(bundle, home, 0, &frames).join(" "),
- "export /w/art.draw --frames 0-11 --scale 0.5"
+ "export /w/art.klad --frames 0-11 --scale 0.5"
);
}
}
diff --git a/crates/app/src/editor/paintover.rs b/crates/app/src/editor/paintover.rs
index 077637d..92d7952 100644
--- a/crates/app/src/editor/paintover.rs
+++ b/crates/app/src/editor/paintover.rs
@@ -214,14 +214,14 @@ mod tests {
#[test]
fn the_window_builds_the_cli_paintover() {
- let bundle = Path::new("/w/art.draw");
+ let bundle = Path::new("/w/art.klad");
let form = Form {
within: "rock".into(),
..Form::default()
};
assert_eq!(
args(bundle, "l4", 3, &form, None).join(" "),
- "paintover /w/art.draw l4 --frame 3 --sizes 32,16,8 --threshold 6 --length 1,8 --curve 0.5 --brush oil --vary 0.025 --seed 1 --in rock"
+ "paintover /w/art.klad l4 --frame 3 --sizes 32,16,8 --threshold 6 --length 1,8 --curve 0.5 --brush oil --vary 0.025 --seed 1 --in rock"
);
let carried = args(bundle, "l4", 3, &Form::default(), Some(("c9", "3-12".into()))).join(" ");
assert!(carried.ends_with("--like c9 --frames 3-12"), "{carried}");
diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rs
index 1b94358..c565e01 100644
--- a/crates/app/src/editor/ui_tests.rs
+++ b/crates/app/src/editor/ui_tests.rs
@@ -425,7 +425,7 @@ fn copy_dir(from: &Path, to: &Path) {
#[test]
#[ignore]
fn ui_time_per_frame() {
- let creature = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../examples/creature/creature.draw");
+ let creature = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../examples/creature/creature.klad");
let copy = std::env::temp_dir().join(format!("draw-ui-creature-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&copy);
if creature.exists() {
@@ -480,7 +480,7 @@ fn ui_time_per_frame() {
fn panel_pictures() {
let out = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../scratch/ui");
std::fs::create_dir_all(&out).unwrap();
- let creature = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../examples/creature/creature.draw");
+ let creature = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../examples/creature/creature.klad");
let path = std::env::temp_dir().join(format!("draw-ui-pictures-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&path);
copy_dir(&creature, &path);
@@ -2191,7 +2191,7 @@ fn the_cli_only_features_run_from_the_editor_and_give_what_the_cli_gives() {
let base = std::env::temp_dir().join(format!("draw-ui-cli-forms-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&base);
std::fs::create_dir_all(&base).unwrap();
- let (ours, theirs) = (base.join("ours.draw"), base.join("theirs.draw"));
+ let (ours, theirs) = (base.join("ours.klad"), base.join("theirs.klad"));
let (o, t) = (ours.to_str().unwrap(), theirs.to_str().unwrap());
run(&[
"new", o, "--width", "256", "--height", "160", "--layers", "0", "--frames", "4",
diff --git a/crates/app/src/home.rs b/crates/app/src/home.rs
index 573d4c4..5b8fc03 100644
--- a/crates/app/src/home.rs
+++ b/crates/app/src/home.rs
@@ -343,10 +343,10 @@ mod tests {
h.run_steps(2);
h.get_by_label("Create").click();
h.run_steps(3);
- let made = dir.join("rock study.draw");
+ let made = dir.join("rock study.klad");
assert_eq!(opened(&h), made);
let cli = Bundle::blank(
- dir.join("cli.draw"),
+ dir.join("cli.klad"),
&Blank {
background: Some("#f4efe6".into()),
sketch: true,
@@ -372,7 +372,7 @@ mod tests {
#[test]
fn a_drawing_the_system_asks_to_open_opens_from_the_start_window() {
let dir = folder("finder");
- let made = dir.join("from finder.draw");
+ let made = dir.join("from finder.klad");
Bundle::blank(&made, &small(), "cli").unwrap();
let mut first = home(&dir, &[]);
first.begin(&egui::Context::default(), None);
@@ -402,11 +402,11 @@ mod tests {
#[test]
fn recent_reopens_a_drawing_and_greys_out_a_moved_one() {
let dir = folder("recent");
- let (a, b) = (dir.join("ledge.draw"), dir.join("cave.draw"));
+ let (a, b) = (dir.join("ledge.klad"), dir.join("cave.klad"));
[&a, &b].iter().for_each(|p| {
Bundle::blank(p, &small(), "cli").unwrap();
});
- std::fs::rename(&b, dir.join("cave moved.draw")).unwrap();
+ std::fs::rename(&b, dir.join("cave moved.klad")).unwrap();
let mut first = home(&dir, &[&a, &b]);
first.begin(&egui::Context::default(), None);
let mut h = harness(first);
@@ -419,17 +419,17 @@ mod tests {
assert_eq!(opened(&h), a);
assert!(h.state().start.is_none());
let mut missing = home(&dir, &[]);
- missing.begin(&egui::Context::default(), Some(&dir.join("nowhere.draw")));
+ missing.begin(&egui::Context::default(), Some(&dir.join("nowhere.klad")));
assert!(missing.editor.is_none());
let error = missing.start.as_ref().unwrap().error.clone().unwrap();
- assert!(error.contains("nowhere.draw"), "{error}");
+ assert!(error.contains("nowhere.klad"), "{error}");
std::fs::remove_dir_all(&dir).unwrap();
}
#[test]
fn cmd_n_and_cmd_o_in_the_editor_switch_drawings_and_back_keeps_this_one() {
let dir = folder("switch");
- let (a, b) = (dir.join("first.draw"), dir.join("second.draw"));
+ let (a, b) = (dir.join("first.klad"), dir.join("second.klad"));
[&a, &b].iter().for_each(|p| {
Bundle::blank(p, &small(), "cli").unwrap();
});
@@ -454,7 +454,7 @@ mod tests {
h.run_steps(2);
h.get_by_label("Create").click();
h.run_steps(3);
- assert_eq!(opened(&h), dir.join("third.draw"));
+ assert_eq!(opened(&h), dir.join("third.klad"));
h.key_press_modifiers(Modifiers::COMMAND, Key::O);
h.run_steps(3);
h.get_by_role_and_label(Role::TextInput, "Or paste its path")
@@ -466,7 +466,7 @@ mod tests {
let order: Vec<String> = h.state().settings.documents.clone();
assert_eq!(
order,
- [&b, &dir.join("third.draw"), &a].map(|p| p.display().to_string())
+ [&b, &dir.join("third.klad"), &a].map(|p| p.display().to_string())
);
h.state_mut().editor.as_mut().unwrap().wants = None;
h.get_by_label(theme::icon::FILE).click();
@@ -490,14 +490,14 @@ mod tests {
let out = root.join("scratch/ui");
std::fs::create_dir_all(&out).unwrap();
let shown: Vec<PathBuf> = [
- "samples/solids/solids.draw",
- "samples/lantern/lantern-painted.draw",
- "samples/creature/creature.draw",
+ "samples/solids/solids.klad",
+ "samples/lantern/lantern-painted.klad",
+ "samples/creature/creature.klad",
]
.iter()
.map(|p| std::fs::canonicalize(root.join(p)).expect("run just samples and build the painted lantern first"))
.collect();
- let gone = PathBuf::from("/Users/you/Drawings/old sketch.draw");
+ let gone = PathBuf::from("/Users/you/Drawings/old sketch.klad");
let settings = Settings {
drawings: Some("~/Drawings".into()),
documents: shown
@@ -536,7 +536,7 @@ mod tests {
#[test]
fn the_document_menu_shows_the_licence_and_the_notices() {
let dir = folder("about");
- let path = dir.join("about.draw");
+ let path = dir.join("about.klad");
Bundle::blank(&path, &small(), "cli").unwrap();
let mut first = home(&dir, &[]);
first.open(&egui::Context::default(), &path).unwrap();
@@ -565,11 +565,11 @@ mod tests {
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
let out = root.join("scratch/ui");
std::fs::create_dir_all(&out).unwrap();
- let source = std::fs::canonicalize(root.join("samples/lantern/lantern-painted.draw")).expect(
- "build it first: PAINTED=1 FORCE=1 bash samples/lantern/build.sh samples/lantern/lantern-painted.draw",
+ let source = std::fs::canonicalize(root.join("samples/lantern/lantern-painted.klad")).expect(
+ "build it first: PAINTED=1 FORCE=1 bash samples/lantern/build.sh samples/lantern/lantern-painted.klad",
);
let dir = folder("editor-picture");
- let path = dir.join("lantern.draw");
+ let path = dir.join("lantern.klad");
let copied = std::process::Command::new("cp")
.arg("-R")
.arg(&source)
diff --git a/crates/app/src/settings.rs b/crates/app/src/settings.rs
index 993be62..39fecd8 100644
--- a/crates/app/src/settings.rs
+++ b/crates/app/src/settings.rs
@@ -332,12 +332,12 @@ mod tests {
new.defaults.surround = [20, 20, 24];
new.save(&path).unwrap();
assert_eq!(Settings::load(&path), new);
- let (a, b) = (dir.join("a.draw"), dir.join("b.draw"));
+ let (a, b) = (dir.join("a.klad"), dir.join("b.klad"));
new.opened(&a);
new.opened(&b);
new.opened(&a);
assert_eq!(new.documents, [a.display().to_string(), b.display().to_string()]);
- (0..20).for_each(|i| new.opened(&dir.join(format!("{i}.draw"))));
+ (0..20).for_each(|i| new.opened(&dir.join(format!("{i}.klad"))));
assert_eq!(new.documents.len(), DOCUMENTS);
new.forget(&new.documents[0].clone());
assert_eq!(new.documents.len(), DOCUMENTS - 1);
diff --git a/crates/app/src/start.rs b/crates/app/src/start.rs
index 8fbbcdc..c70747a 100644
--- a/crates/app/src/start.rs
+++ b/crates/app/src/start.rs
@@ -97,9 +97,9 @@ impl Start {
pub fn target(&self) -> PathBuf {
let name = self.name.trim();
- let file = match name.ends_with(".draw") {
+ let file = match name.ends_with(".klad") {
true => name.to_string(),
- false => format!("{name}.draw"),
+ false => format!("{name}.klad"),
};
expand(&self.folder).join(file)
}
@@ -253,7 +253,7 @@ impl Start {
let mut picked = None;
if picker::NATIVE
&& ui
- .add(egui::Button::new("Choose a .draw folder...").min_size(vec2(200.0, 28.0)))
+ .add(egui::Button::new("Choose a .klad folder...").min_size(vec2(200.0, 28.0)))
.clicked()
{
picked = picker::choose_folder(Some(&settings.drawings_folder()), "Open");
@@ -411,7 +411,7 @@ pub fn expand(text: &str) -> PathBuf {
pub fn openable(path: &Path) -> Result<()> {
if path.as_os_str().is_empty() {
- bail!("paste the path of a .draw folder");
+ bail!("paste the path of a .klad folder");
}
if !path.is_dir() {
bail!("{} is not a folder", path.display());
@@ -428,7 +428,7 @@ pub fn free_name(folder: &Path) -> String {
1 => "untitled".to_string(),
n => format!("untitled {n}"),
})
- .find(|name| !folder.join(format!("{name}.draw")).exists())
+ .find(|name| !folder.join(format!("{name}.klad")).exists())
.unwrap_or_default()
}
@@ -509,7 +509,7 @@ mod tests {
#[test]
fn a_thumbnail_is_rendered_once_and_again_when_the_drawing_changes() {
assert!(draw_binary().is_some(), "build the klad binary first (just test does)");
- let dir = std::env::temp_dir().join(format!("draw-thumb-{}.draw", std::process::id()));
+ let dir = std::env::temp_dir().join(format!("draw-thumb-{}.klad", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let blank = Blank {
width: 400,
@@ -545,9 +545,9 @@ mod tests {
};
let mut start = Start::new(&settings, Section::New);
start.name = " cave ".into();
- assert_eq!(start.target(), PathBuf::from("/art/cave.draw"));
- start.name = "cave.draw".into();
- assert_eq!(start.target(), PathBuf::from("/art/cave.draw"));
+ assert_eq!(start.target(), PathBuf::from("/art/cave.klad"));
+ start.name = "cave.klad".into();
+ assert_eq!(start.target(), PathBuf::from("/art/cave.klad"));
assert_eq!(
(start.blank().width, start.blank().height, start.blank().background),
(2048, 2048, None)
diff --git a/crates/app/src/sync.rs b/crates/app/src/sync.rs
index a187d6c..48d7a2a 100644
--- a/crates/app/src/sync.rs
+++ b/crates/app/src/sync.rs
@@ -38,11 +38,11 @@ mod tests {
#[test]
fn only_document_files_count() {
- assert!(relevant(Path::new("a.draw/doc.json")));
- assert!(relevant(Path::new("a.draw/.cache/sync.json")));
- assert!(relevant(Path::new("a.draw/.cache/notes.json")));
- assert!(relevant(Path::new("a.draw/strokes/l1/c0.strokes")));
- assert!(!relevant(Path::new("a.draw/doc.json.tmp-123")));
- assert!(!relevant(Path::new("a.draw/.cache/tiles/l1.raster")));
+ assert!(relevant(Path::new("a.klad/doc.json")));
+ assert!(relevant(Path::new("a.klad/.cache/sync.json")));
+ assert!(relevant(Path::new("a.klad/.cache/notes.json")));
+ assert!(relevant(Path::new("a.klad/strokes/l1/c0.strokes")));
+ assert!(!relevant(Path::new("a.klad/doc.json.tmp-123")));
+ assert!(!relevant(Path::new("a.klad/.cache/tiles/l1.raster")));
}
}
diff --git a/crates/cli/src/export.rs b/crates/cli/src/export.rs
index edfe14a..ec17fb5 100644
--- a/crates/cli/src/export.rs
+++ b/crates/cli/src/export.rs
@@ -106,13 +106,13 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
let mut doc = Document::new(64, 32);
doc.layers.push(Layer::paint("l1", "ink", "c1"));
- let bundle = Bundle::create(dir.join("art.draw/"), doc).unwrap();
+ let bundle = Bundle::create(dir.join("art.klad/"), doc).unwrap();
assert_eq!(default_path(&bundle, None, 0, 1.0), dir.join("art.png"));
assert_eq!(default_path(&bundle, Some("ink"), 0, 2.0), dir.join("[email protected]"));
assert_eq!(default_path(&bundle, None, 0, 0.5), dir.join("[email protected]"));
let out = dir.join("out/ink.png");
run(
- &dir.join("art.draw"),
+ &dir.join("art.klad"),
Export {
layer: Some("ink".into()),
frame: 0,
@@ -138,7 +138,7 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
let mut doc = Document::new(120, 60);
doc.layers.push(Layer::paint("l1", "ink", "c1"));
- let mut bundle = Bundle::create(dir.join("art.draw/"), doc).unwrap();
+ let mut bundle = Bundle::create(dir.join("art.klad/"), doc).unwrap();
bundle
.apply(
&klad_core::ops::parse_lines(
diff --git a/crates/cli/src/looks.rs b/crates/cli/src/looks.rs
index d46239c..3365d16 100644
--- a/crates/cli/src/looks.rs
+++ b/crates/cli/src/looks.rs
@@ -170,7 +170,7 @@ mod tests {
let dir = std::env::temp_dir().join(format!("klad-cli-picture-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
- let bundle = dir.join("art.draw");
+ let bundle = dir.join("art.klad");
Bundle::create(&bundle, klad_core::doc::Document::new(200, 100)).unwrap();
let rgba = klad_render::assets::Rgba {
width: 400,
diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs
index 0eb7bb4..a863545 100644
--- a/crates/cli/src/main.rs
+++ b/crates/cli/src/main.rs
@@ -161,7 +161,7 @@ enum Command {
},
#[command(
about = "Insert or remove frames in every layer or the listed ones",
- long_about = "Insert or remove frames in every layer or the listed ones.\n\n klad frame art.draw insert 4 --count 2\n klad frame art.draw remove 4 --layers l3,l5\n\nInsert: what showed at the frame now shows there and for the inserted frames too (that exposure lengthens), everything after moves later. Remove: exposures over the removed frames get shorter, drawings left with no frames go (links to them take them over), everything after moves earlier. On every layer, clips and the timeline length follow; on listed layers an insert lengthens the timeline only as far as their drawings need (a last drawing without a hold keeps its length)."
+ long_about = "Insert or remove frames in every layer or the listed ones.\n\n klad frame art.klad insert 4 --count 2\n klad frame art.klad remove 4 --layers l3,l5\n\nInsert: what showed at the frame now shows there and for the inserted frames too (that exposure lengthens), everything after moves later. Remove: exposures over the removed frames get shorter, drawings left with no frames go (links to them take them over), everything after moves earlier. On every layer, clips and the timeline length follow; on listed layers an insert lengthens the timeline only as far as their drawings need (a last drawing without a hold keeps its length)."
)]
Frame {
bundle: PathBuf,
@@ -177,7 +177,7 @@ enum Command {
},
#[command(
about = "Track marks, parts or points across frames: positions, spacing, ground contacts, feet crossing",
- long_about = "Track things across frames, the way an animator checks arcs and spacing: a mark (c4:s12, through the drawings that keep its id, as in-betweens do), a part (leaf, or lines:leaf: the centre of the part's marks in each drawing) or a point (x,y: carried by the stroke nearest to it). Prints each frame's position, the distance moved since the frame before, and the lowest point. --ground y (one for all tracks, or one per track) adds the frames where a track goes under the ground line or slides along it while touching it (for a cycle drawn in place, --travel gives the px per frame the planted foot should move back by); with two or more tracks, the frames where two of them swap sides (feet crossing) are listed. --check makes any of these an error, for scripts. klad render --overlay arcs --track ... draws the same paths.\n\n klad arcs walk.draw --track 'near foot' --track 'far foot' --clip walk --ground 610,598 --travel 7 --check\n klad arcs walk.draw --track c12:s4 --from 12 --to 27 --json"
+ long_about = "Track things across frames, the way an animator checks arcs and spacing: a mark (c4:s12, through the drawings that keep its id, as in-betweens do), a part (leaf, or lines:leaf: the centre of the part's marks in each drawing) or a point (x,y: carried by the stroke nearest to it). Prints each frame's position, the distance moved since the frame before, and the lowest point. --ground y (one for all tracks, or one per track) adds the frames where a track goes under the ground line or slides along it while touching it (for a cycle drawn in place, --travel gives the px per frame the planted foot should move back by); with two or more tracks, the frames where two of them swap sides (feet crossing) are listed. --check makes any of these an error, for scripts. klad render --overlay arcs --track ... draws the same paths.\n\n klad arcs walk.klad --track 'near foot' --track 'far foot' --clip walk --ground 610,598 --travel 7 --check\n klad arcs walk.klad --track c12:s4 --from 12 --to 27 --json"
)]
Arcs {
bundle: PathBuf,
@@ -215,7 +215,7 @@ enum Command {
},
#[command(
about = "Name a group of marks in a drawing (a part), so in-betweens pair them whatever their ids",
- long_about = "Name a group of marks in a drawing: a part such as leaf, near leg or body. In-betweens pair marks part by part first (in order within a part, nearest shape when the counts differ), whatever their ids; arcs track a part's centre. A mark is in one part at most; naming it again moves it. dup, copy and in-betweens keep parts. --name '' takes the marks out of their part.\n\n klad part art.draw c4:s14 c4:s15 --name leaf\n klad part art.draw c9:s17 c9:s18 --name leaf\n klad stroke art.draw lines --path \"M...\" --part leaf\n\nAlso an op: {\"op\":\"part\",\"ids\":[\"c4:s14\",\"c4:s15\"],\"name\":\"leaf\"}. klad strokes lists each mark's part."
+ long_about = "Name a group of marks in a drawing: a part such as leaf, near leg or body. In-betweens pair marks part by part first (in order within a part, nearest shape when the counts differ), whatever their ids; arcs track a part's centre. A mark is in one part at most; naming it again moves it. dup, copy and in-betweens keep parts. --name '' takes the marks out of their part.\n\n klad part art.klad c4:s14 c4:s15 --name leaf\n klad part art.klad c9:s17 c9:s18 --name leaf\n klad stroke art.klad lines --path \"M...\" --part leaf\n\nAlso an op: {\"op\":\"part\",\"ids\":[\"c4:s14\",\"c4:s15\"],\"name\":\"leaf\"}. klad strokes lists each mark's part."
)]
Part {
bundle: PathBuf,
@@ -227,7 +227,7 @@ enum Command {
},
#[command(
about = "Duplicate a layer with its drawings, links and mask, above it",
- long_about = "Duplicate a layer: its drawings, links, in-between marks and mask are copied with new ids, and the copy, named \"<name> copy\", goes right above it.\n\n klad duplicate art.draw l3\n\nAlso an op in klad apply: {\"op\":\"duplicate\",\"layer\":\"l3\"}."
+ long_about = "Duplicate a layer: its drawings, links, in-between marks and mask are copied with new ids, and the copy, named \"<name> copy\", goes right above it.\n\n klad duplicate art.klad l3\n\nAlso an op in klad apply: {\"op\":\"duplicate\",\"layer\":\"l3\"}."
)]
Duplicate {
bundle: PathBuf,
@@ -237,7 +237,7 @@ enum Command {
},
#[command(
about = "Make drawings on the timeline: new, dup, link, unlink, move",
- long_about = "Make drawings on the timeline.\n\n klad cel art.draw new l3 --frame 4 a blank drawing on layer l3 at frame 4\n klad cel art.draw dup c4 [--frame 6] a copy of c4's drawing (default: right after c4's exposure)\n klad cel art.draw link c4 --frame 8 show c4's drawing again at frame 8\n klad cel art.draw unlink c9 turn the link c9 into a drawing of its own\n klad cel art.draw move c5 --frame 12 start c5 at frame 12, keeping its hold; drawings in the way are pushed along\n\nInside an exposure a new cel takes over the rest of it; elsewhere it lasts until the next cel, or --hold frames (dup and link default to their source's hold). --insert moves later cels of that layer back to make room (only at the start or end of an exposure). Strokes keep their ids in a dup."
+ long_about = "Make drawings on the timeline.\n\n klad cel art.klad new l3 --frame 4 a blank drawing on layer l3 at frame 4\n klad cel art.klad dup c4 [--frame 6] a copy of c4's drawing (default: right after c4's exposure)\n klad cel art.klad link c4 --frame 8 show c4's drawing again at frame 8\n klad cel art.klad unlink c9 turn the link c9 into a drawing of its own\n klad cel art.klad move c5 --frame 12 start c5 at frame 12, keeping its hold; drawings in the way are pushed along\n\nInside an exposure a new cel takes over the rest of it; elsewhere it lasts until the next cel, or --hold frames (dup and link default to their source's hold). --insert moves later cels of that layer back to make room (only at the start or end of an exposure). Strokes keep their ids in a dup."
)]
Cel {
bundle: PathBuf,
@@ -256,7 +256,7 @@ enum Command {
},
#[command(
about = "Copy strokes and fills into another drawing, with new ids, moving them on the way",
- long_about = "Copy strokes and fills (<cel>:s<id>) into another drawing. The copies get new ids, printed as a map (c1:s3 -> c9:s12), and land on top of that drawing in the order they had. --to names the drawing; --frame takes the drawing the layer shows at that frame (a new drawing on an empty frame or past the end; a frame that shows a link names its source instead). The marks' own layer unless --layer. The move, turn, scale and flip options are klad transform's, applied to the copies together about the middle of their bounds or --pivot. --cut keeps only the parts inside a polygon.\n\n klad copy art.draw c1:s3 c1:s4 --frame 4\n klad copy art.draw c1:s3 --to c9 --move 12,-4 --rotate 8\n klad copy art.draw c1:s3 --frame 6 --layer shade --flip h --pivot 512,400\n\nAlso a copy op in klad apply: {\"op\":\"copy\",\"ids\":[\"c1:s3\"],\"frame\":4,\"x\":12,\"y\":-4} (or \"to\":\"c9\")."
+ long_about = "Copy strokes and fills (<cel>:s<id>) into another drawing. The copies get new ids, printed as a map (c1:s3 -> c9:s12), and land on top of that drawing in the order they had. --to names the drawing; --frame takes the drawing the layer shows at that frame (a new drawing on an empty frame or past the end; a frame that shows a link names its source instead). The marks' own layer unless --layer. The move, turn, scale and flip options are klad transform's, applied to the copies together about the middle of their bounds or --pivot. --cut keeps only the parts inside a polygon.\n\n klad copy art.klad c1:s3 c1:s4 --frame 4\n klad copy art.klad c1:s3 --to c9 --move 12,-4 --rotate 8\n klad copy art.klad c1:s3 --frame 6 --layer shade --flip h --pivot 512,400\n\nAlso a copy op in klad apply: {\"op\":\"copy\",\"ids\":[\"c1:s3\"],\"frame\":4,\"x\":12,\"y\":-4} (or \"to\":\"c9\")."
)]
Copy {
bundle: PathBuf,
@@ -291,7 +291,7 @@ enum Command {
},
#[command(
about = "Retime a range of frames: on ones/twos/threes, fit into n frames, reverse, ping-pong",
- long_about = "Retime frames FROM-TO (both included) on every layer, or on --layers (with their masks and children). The range is cut where any of those layers changes what it shows; each piece is one picture.\n\n klad retime art.draw 0-11 --on 2 every picture shows for 2 frames (ones to twos)\n klad retime art.draw 0-23 --on 1 and back to ones\n klad retime art.draw 0-11 --fit 16 the range becomes 16 frames; order and relative timing kept, at least one frame each\n klad retime art.draw 0-7 --reverse\n klad retime art.draw 0-7 --pingpong the pictures again backwards as links, the ends not repeated: a b c d c b\n\nLater cels move by the change in length; on every layer clips move and stretch with it and the timeline grows or shrinks; on listed layers clips stay and the timeline only grows. A drawing that ends up in two places is shown again by a link. One history step. Also a retime op: {\"op\":\"retime\",\"from\":0,\"to\":11,\"on\":2,\"layers\":[\"l3\"]} (or \"fit\":16, \"reverse\":true, \"pingpong\":true)."
+ long_about = "Retime frames FROM-TO (both included) on every layer, or on --layers (with their masks and children). The range is cut where any of those layers changes what it shows; each piece is one picture.\n\n klad retime art.klad 0-11 --on 2 every picture shows for 2 frames (ones to twos)\n klad retime art.klad 0-23 --on 1 and back to ones\n klad retime art.klad 0-11 --fit 16 the range becomes 16 frames; order and relative timing kept, at least one frame each\n klad retime art.klad 0-7 --reverse\n klad retime art.klad 0-7 --pingpong the pictures again backwards as links, the ends not repeated: a b c d c b\n\nLater cels move by the change in length; on every layer clips move and stretch with it and the timeline grows or shrinks; on listed layers clips stay and the timeline only grows. A drawing that ends up in two places is shown again by a link. One history step. Also a retime op: {\"op\":\"retime\",\"from\":0,\"to\":11,\"on\":2,\"layers\":[\"l3\"]} (or \"fit\":16, \"reverse\":true, \"pingpong\":true)."
)]
Retime {
bundle: PathBuf,
@@ -312,7 +312,7 @@ enum Command {
},
#[command(
about = "Make the drawings between two keys: a new cel on each frame between them",
- long_about = "Make in-betweens of two keys on paint layers: the drawings shown at --from and --to (the second key is the frame where a drawing starts; a link there names its source, so a loop's last in-betweens can lead back to its first drawing). By default a new cel on every frame between them; --count n spreads n of them, each holding until the next.\n\n klad inbetween art.draw --layers lines,colour --from 0 --to 6\n klad inbetween art.draw --layers lines --from 0 --to 8 --count 3 --spacing in-out\n klad inbetween art.draw --layers arm --from 4 --to 10 --match near --pair s3=s7\n klad inbetween art.draw --redo after a key changed\n\nStrokes pair by id (a key duplicated from the other keeps its ids), by --match order or by nearest shape; --pair forces pairs (first key id = second key id). Each pair is resampled along its length; points, pressure, tilt, size, opacity, flow, taper and colour move at the spacing (colour evenly in OKLab, so colour the second key for its light and the in-betweens carry the change), and the pair turns and scales along an arc about the point its best-fit rotation turns around, so a swinging limb keeps its length. A line end that touches another line in both keys touches it in every in-between. Lasso fills are interpolated; flood fills are recomputed in each in-between from a seed carried with the lines next to it (the layers they fill against go first). Unpaired marks and fills that fail (a seed on a line, a leak) are left out and listed.\n\nSpacing: even, in (eases in: the in-betweens bunch near the first key), out (they bunch near the second key), in-out, or the positions themselves, 0.2,0.5,0.9. Every in-between remembers its keys (tween in klad show), so --redo remakes them after a key changed; it refuses cels changed since they were made unless --force. One history step."
+ long_about = "Make in-betweens of two keys on paint layers: the drawings shown at --from and --to (the second key is the frame where a drawing starts; a link there names its source, so a loop's last in-betweens can lead back to its first drawing). By default a new cel on every frame between them; --count n spreads n of them, each holding until the next.\n\n klad inbetween art.klad --layers lines,colour --from 0 --to 6\n klad inbetween art.klad --layers lines --from 0 --to 8 --count 3 --spacing in-out\n klad inbetween art.klad --layers arm --from 4 --to 10 --match near --pair s3=s7\n klad inbetween art.klad --redo after a key changed\n\nStrokes pair by id (a key duplicated from the other keeps its ids), by --match order or by nearest shape; --pair forces pairs (first key id = second key id). Each pair is resampled along its length; points, pressure, tilt, size, opacity, flow, taper and colour move at the spacing (colour evenly in OKLab, so colour the second key for its light and the in-betweens carry the change), and the pair turns and scales along an arc about the point its best-fit rotation turns around, so a swinging limb keeps its length. A line end that touches another line in both keys touches it in every in-between. Lasso fills are interpolated; flood fills are recomputed in each in-between from a seed carried with the lines next to it (the layers they fill against go first). Unpaired marks and fills that fail (a seed on a line, a leak) are left out and listed.\n\nSpacing: even, in (eases in: the in-betweens bunch near the first key), out (they bunch near the second key), in-out, or the positions themselves, 0.2,0.5,0.9. Every in-between remembers its keys (tween in klad show), so --redo remakes them after a key changed; it refuses cels changed since they were made unless --force. One history step."
)]
Inbetween {
bundle: PathBuf,
@@ -402,7 +402,7 @@ enum Command {
},
#[command(
about = "Copy a font into the bundle for text nodes, by name or from a file, or list the fonts it has",
- long_about = "Copy one of klad's fonts (by family, or family and style) or a font file (TTF or OTF) into the bundle's fonts folder, so text nodes render the same on every machine; a family that klad does not have yet but Google Fonts does is downloaded first. With no font, list the bundle's fonts. Text nodes also take a family name directly (font=Inter, font=\"Inter Bold\") and copy it in themselves.\n\n klad font art.draw Cinzel\n klad font art.draw \"Barlow Bold\"\n klad font art.draw ~/fonts/Signage.ttf\n klad add art.draw text --in l4 text=INN font=Cinzel size=48 x=120 y=80 fill=#2b1d12"
+ long_about = "Copy one of klad's fonts (by family, or family and style) or a font file (TTF or OTF) into the bundle's fonts folder, so text nodes render the same on every machine; a family that klad does not have yet but Google Fonts does is downloaded first. With no font, list the bundle's fonts. Text nodes also take a family name directly (font=Inter, font=\"Inter Bold\") and copy it in themselves.\n\n klad font art.klad Cinzel\n klad font art.klad \"Barlow Bold\"\n klad font art.klad ~/fonts/Signage.ttf\n klad add art.klad text --in l4 text=INN font=Cinzel size=48 x=120 y=80 fill=#2b1d12"
)]
Font { bundle: PathBuf, font: Option<String> },
#[command(
@@ -425,7 +425,7 @@ enum Command {
},
#[command(
about = "Fog and haze by depth: show, set or turn off the document's atmosphere",
- long_about = "The atmosphere fades layers at the top of the stack that have a depth (klad set art.draw g2 depth=2) towards the fog colour, blurs them and takes colour out, more the deeper they are.\n\n klad atmosphere art.draw\n klad atmosphere art.draw color=#9aa8b8 top=#d8e0e8 density=0.5 blur=1 desaturate=0.15\n klad atmosphere art.draw --off"
+ long_about = "The atmosphere fades layers at the top of the stack that have a depth (klad set art.klad g2 depth=2) towards the fog colour, blurs them and takes colour out, more the deeper they are.\n\n klad atmosphere art.klad\n klad atmosphere art.klad color=#9aa8b8 top=#d8e0e8 density=0.5 blur=1 desaturate=0.15\n klad atmosphere art.klad --off"
)]
Atmosphere {
bundle: PathBuf,
@@ -437,7 +437,7 @@ enum Command {
},
#[command(
about = "Show the timeline (fps, length, origin, clips) or set fps, length and origin",
- long_about = "Show the timeline (fps, length, origin, clips) or set fps, length and origin.\n\n klad timeline art.draw\n klad timeline art.draw --fps 12 --frames 24\n klad timeline art.draw --origin 512,700 the canvas point a Godot export puts on the node's position\n klad timeline art.draw --origin centre back to the middle of the canvas (the default)"
+ long_about = "Show the timeline (fps, length, origin, clips) or set fps, length and origin.\n\n klad timeline art.klad\n klad timeline art.klad --fps 12 --frames 24\n klad timeline art.klad --origin 512,700 the canvas point a Godot export puts on the node's position\n klad timeline art.klad --origin centre back to the middle of the canvas (the default)"
)]
Timeline {
bundle: PathBuf,
@@ -452,7 +452,7 @@ enum Command {
},
#[command(
about = "List, add, change, rename and remove clips (named frame ranges)",
- long_about = "List, add, change, rename and remove clips: named frame ranges such as idle, run or attack. Exports turn each clip into an animation; a clip may have its own fps.\n\n klad clip art.draw list them\n klad clip art.draw --add run --from 0 --to 11 --loop --fps 12\n klad clip art.draw --set run --to 15 --no-loop\n klad clip art.draw --set run --name sprint rename\n klad clip art.draw --set run --fps doc use the document's fps again\n klad clip art.draw --rm run\n\nFrames inserted or removed on every layer move and stretch clips; a clip ends where the timeline ends."
+ long_about = "List, add, change, rename and remove clips: named frame ranges such as idle, run or attack. Exports turn each clip into an animation; a clip may have its own fps.\n\n klad clip art.klad list them\n klad clip art.klad --add run --from 0 --to 11 --loop --fps 12\n klad clip art.klad --set run --to 15 --no-loop\n klad clip art.klad --set run --name sprint rename\n klad clip art.klad --set run --fps doc use the document's fps again\n klad clip art.klad --rm run\n\nFrames inserted or removed on every layer move and stretch clips; a clip ends where the timeline ends."
)]
Clip {
bundle: PathBuf,
@@ -489,7 +489,7 @@ enum Command {
Show { bundle: PathBuf, id: String },
#[command(
about = "Add a layer, cel or shape",
- long_about = "Add a layer, cel or shape.\n\n klad add art.draw layer vector name=sky\n klad add art.draw rect --in l2 x=0 y=0 w=2048 h=900 fill=#1b2a41\n klad add art.draw ellipse --in l2 cx=500 cy=300 rx=80 ry=80 'fill={\"radial\":{\"center\":[500,300],\"radius\":80,\"stops\":[[0,\"#fff6d5\"],[1,\"#f3c76a\"]]}}'\n klad add art.draw cel --in l3 frame=4 hold=2\n\nValues are JSON when they parse as JSON, otherwise strings. Dotted keys nest: transform.rotate=15, stroke.width=3."
+ long_about = "Add a layer, cel or shape.\n\n klad add art.klad layer vector name=sky\n klad add art.klad rect --in l2 x=0 y=0 w=2048 h=900 fill=#1b2a41\n klad add art.klad ellipse --in l2 cx=500 cy=300 rx=80 ry=80 'fill={\"radial\":{\"center\":[500,300],\"radius\":80,\"stops\":[[0,\"#fff6d5\"],[1,\"#f3c76a\"]]}}'\n klad add art.klad cel --in l3 frame=4 hold=2\n\nValues are JSON when they parse as JSON, otherwise strings. Dotted keys nest: transform.rotate=15, stroke.width=3."
)]
Add {
bundle: PathBuf,
@@ -505,8 +505,8 @@ enum Command {
flags: EditFlags,
},
#[command(
- about = "Change properties: klad set art.draw n4 fill=#ff0000 transform.rotate=15 (null removes)",
- long_about = "Change properties of a layer, cel, shape, stroke or fill. Values are JSON when they parse as JSON, otherwise strings; null removes a key. Dotted keys nest.\n\n klad set art.draw n4 fill=#ff0000 transform.rotate=15\n klad set art.draw l2 opacity=0.5 blend=multiply\n klad set art.draw c4:s12 color=#c84a3a size=6 brush=pencil\n klad set art.draw c4:s7 color=skin opacity=0.8\n\nStrokes take color, size, opacity, flow, brush and taper ([in,out] or null); fills take color and opacity. Colours may be palette names."
+ about = "Change properties: klad set art.klad n4 fill=#ff0000 transform.rotate=15 (null removes)",
+ long_about = "Change properties of a layer, cel, shape, stroke or fill. Values are JSON when they parse as JSON, otherwise strings; null removes a key. Dotted keys nest.\n\n klad set art.klad n4 fill=#ff0000 transform.rotate=15\n klad set art.klad l2 opacity=0.5 blend=multiply\n klad set art.klad c4:s12 color=#c84a3a size=6 brush=pencil\n klad set art.klad c4:s7 color=skin opacity=0.8\n\nStrokes take color, size, opacity, flow, brush and taper ([in,out] or null); fills take color and opacity. Colours may be palette names."
)]
Set {
bundle: PathBuf,
@@ -526,7 +526,7 @@ enum Command {
},
#[command(
about = "Move, rotate or scale strokes and fills (<cel>:s<id>)",
- long_about = "Move, rotate or scale strokes and fills, addressed as <cel>:s<id> (klad strokes lists them). Rotation and scale turn about --pivot, by default the middle of the marks' bounds. Stroke sizes and tapers scale with them; fills move by whole pixels and are resampled when turned or scaled.\n\n klad transform art.draw c4:s12 c4:s13 --move 40,-10\n klad transform art.draw c4:s12 --rotate 15 --scale 1.2\n klad transform art.draw c4:s3 c4:s5 --sx -1 --pivot 512,400\n\nAlso a transform op in klad apply: {\"op\":\"transform\",\"ids\":[\"c4:s12\"],\"x\":40,\"y\":-10,\"rotate\":15,\"sx\":1.2,\"sy\":1.2}"
+ long_about = "Move, rotate or scale strokes and fills, addressed as <cel>:s<id> (klad strokes lists them). Rotation and scale turn about --pivot, by default the middle of the marks' bounds. Stroke sizes and tapers scale with them; fills move by whole pixels and are resampled when turned or scaled.\n\n klad transform art.klad c4:s12 c4:s13 --move 40,-10\n klad transform art.klad c4:s12 --rotate 15 --scale 1.2\n klad transform art.klad c4:s3 c4:s5 --sx -1 --pivot 512,400\n\nAlso a transform op in klad apply: {\"op\":\"transform\",\"ids\":[\"c4:s12\"],\"x\":40,\"y\":-10,\"rotate\":15,\"sx\":1.2,\"sy\":1.2}"
)]
Transform {
bundle: PathBuf,
@@ -552,7 +552,7 @@ enum Command {
},
#[command(
about = "Lasso strokes and fills on a paint layer; --cut also takes the parts crossing the edge",
- long_about = "Select the strokes and fills of a paint layer inside a polygon and move, turn, scale, flip or delete them in one step. Without --cut only whole marks move: strokes whose points are all inside and fills whose pixels are. With --cut every stroke or fill crossing the edge is split at the edge: the part outside stays where it is and the part inside moves with the rest, so nothing outside the lasso changes. Without a move, turn, scale, flip or --rm it only lists what is inside and what crosses.\n\n klad lasso art.draw l3 --polygon '100,100 400,120 380,400 90,380'\n klad lasso art.draw l3 --polygon '100,100 400,120 380,400 90,380' --cut --move 60,-20\n klad lasso art.draw l3 --polygon '...' --cut --rotate 15 --scale 1.2\n klad lasso art.draw l3 --polygon '...' --flip h\n klad lasso art.draw l3 --polygon '...' --cut --rm\n\nAlso a lasso op in klad apply: {\"op\":\"lasso\",\"layer\":\"l3\",\"polygon\":[[100,100],[400,120],[380,400]],\"cut\":true,\"x\":60,\"y\":-20} (or \"rm\":true)."
+ long_about = "Select the strokes and fills of a paint layer inside a polygon and move, turn, scale, flip or delete them in one step. Without --cut only whole marks move: strokes whose points are all inside and fills whose pixels are. With --cut every stroke or fill crossing the edge is split at the edge: the part outside stays where it is and the part inside moves with the rest, so nothing outside the lasso changes. Without a move, turn, scale, flip or --rm it only lists what is inside and what crosses.\n\n klad lasso art.klad l3 --polygon '100,100 400,120 380,400 90,380'\n klad lasso art.klad l3 --polygon '100,100 400,120 380,400 90,380' --cut --move 60,-20\n klad lasso art.klad l3 --polygon '...' --cut --rotate 15 --scale 1.2\n klad lasso art.klad l3 --polygon '...' --flip h\n klad lasso art.klad l3 --polygon '...' --cut --rm\n\nAlso a lasso op in klad apply: {\"op\":\"lasso\",\"layer\":\"l3\",\"polygon\":[[100,100],[400,120],[380,400]],\"cut\":true,\"x\":60,\"y\":-20} (or \"rm\":true)."
)]
Lasso {
bundle: PathBuf,
@@ -587,7 +587,7 @@ enum Command {
},
#[command(
about = "List the points of a path, rect or ellipse, or edit them",
- long_about = "Without edit flags: list the points (anchors) of a path, rect or ellipse with their handles, numbered across subpaths. Coordinates are the shape's own, as in its d, before its transform. Any edit turns a rect or ellipse into a path that looks the same.\n\n klad path art.draw n7\n klad path art.draw n7 --move 3 412,230\n klad path art.draw n7 --nudge 3,4,5 0,-20\n klad path art.draw n7 --handle 3 out 430,210\n klad path art.draw n7 --insert 3,0.5 (split the segment after point 3)\n klad path art.draw n7 --add 418,236 (a point on the nearest segment)\n klad path art.draw n7 --rm 4,5 --corner 2 --smooth 6\n klad path art.draw n7 --simplify 1.5 (fewer, smooth points within 1.5 px)\n\nAs ops: {\"op\":\"path\",\"id\":\"n7\",\"move\":3,\"to\":[412,230]}, \"move\":[3,4],\"by\":[0,-20]; \"handle\":3,\"out\":[430,210]; \"insert\":3,\"t\":0.5; \"add\":[418,236]; \"rm\":[4,5]; \"corner\":2; \"smooth\":6; \"simplify\":1.5. A smooth point keeps its handles in line unless \"free\":true."
+ long_about = "Without edit flags: list the points (anchors) of a path, rect or ellipse with their handles, numbered across subpaths. Coordinates are the shape's own, as in its d, before its transform. Any edit turns a rect or ellipse into a path that looks the same.\n\n klad path art.klad n7\n klad path art.klad n7 --move 3 412,230\n klad path art.klad n7 --nudge 3,4,5 0,-20\n klad path art.klad n7 --handle 3 out 430,210\n klad path art.klad n7 --insert 3,0.5 (split the segment after point 3)\n klad path art.klad n7 --add 418,236 (a point on the nearest segment)\n klad path art.klad n7 --rm 4,5 --corner 2 --smooth 6\n klad path art.klad n7 --simplify 1.5 (fewer, smooth points within 1.5 px)\n\nAs ops: {\"op\":\"path\",\"id\":\"n7\",\"move\":3,\"to\":[412,230]}, \"move\":[3,4],\"by\":[0,-20]; \"handle\":3,\"out\":[430,210]; \"insert\":3,\"t\":0.5; \"add\":[418,236]; \"rm\":[4,5]; \"corner\":2; \"smooth\":6; \"simplify\":1.5. A smooth point keeps its handles in line unless \"free\":true."
)]
Path {
bundle: PathBuf,
@@ -707,7 +707,7 @@ enum Command {
},
#[command(
about = "Paint a stroke with a brush along an SVG path or explicit points",
- long_about = "Paint with a brush along an SVG path (M, L, H, V, C, S, Q, T, Z; several subpaths make several strokes) or explicit points.\n\n klad stroke art.draw l3 --brush ink --size 14 --color #1b1b1b --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05\n klad stroke art.draw l3 --brush ink --size 6 --taper 12,30 --path 'M100 100 Q 200 40 300 120'\n klad stroke art.draw l3 --points '10,10,0.5 40,30,1 80,35,0.2'\n\nPressure is spread evenly along the stroke. --taper thins the first and last px of the line whatever the pressure. Brushes are a bundle brush id or a library brush (klad brushes). Strokes are marked as agent strokes."
+ long_about = "Paint with a brush along an SVG path (M, L, H, V, C, S, Q, T, Z; several subpaths make several strokes) or explicit points.\n\n klad stroke art.klad l3 --brush ink --size 14 --color #1b1b1b --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05\n klad stroke art.klad l3 --brush ink --size 6 --taper 12,30 --path 'M100 100 Q 200 40 300 120'\n klad stroke art.klad l3 --points '10,10,0.5 40,30,1 80,35,0.2'\n\nPressure is spread evenly along the stroke. --taper thins the first and last px of the line whatever the pressure. Brushes are a bundle brush id or a library brush (klad brushes). Strokes are marked as agent strokes."
)]
Stroke {
bundle: PathBuf,
@@ -755,7 +755,7 @@ enum Command {
},
#[command(
about = "Fill a region of a paint layer, inside the lines (flood) or inside a polygon (lasso)",
- long_about = "Fill a region of a paint layer. A flood fill starts at --at and spreads over pixels within --tolerance of that pixel in the reference: this layer (default), all (everything visible) or a layer id or name. --gap closes openings in the lines up to that many px wide; --expand grows the fill under the lines by that many px. --polygon fills a lasso polygon instead. The fill is stored with its coverage, so it renders the same later; klad refill recomputes it after the lines change.\n\n klad fill art.draw l2 --at 820,640 --ref lines --gap 4 --color '#c84a3a'\n klad fill art.draw l2 --at 820,640 --ref all --color skin\n klad fill art.draw l2 --polygon '100,100 400,120 260,380' --color '#20304a'\n\nColours are #rrggbb, #rrggbbaa or a palette name. Also a fill op in klad apply: {\"op\":\"fill\",\"layer\":\"l2\",\"at\":[820,640],\"ref\":\"lines\",\"gap\":4,\"color\":\"#c84a3a\"}"
+ long_about = "Fill a region of a paint layer. A flood fill starts at --at and spreads over pixels within --tolerance of that pixel in the reference: this layer (default), all (everything visible) or a layer id or name. --gap closes openings in the lines up to that many px wide; --expand grows the fill under the lines by that many px. --polygon fills a lasso polygon instead. The fill is stored with its coverage, so it renders the same later; klad refill recomputes it after the lines change.\n\n klad fill art.klad l2 --at 820,640 --ref lines --gap 4 --color '#c84a3a'\n klad fill art.klad l2 --at 820,640 --ref all --color skin\n klad fill art.klad l2 --polygon '100,100 400,120 260,380' --color '#20304a'\n\nColours are #rrggbb, #rrggbbaa or a palette name. Also a fill op in klad apply: {\"op\":\"fill\",\"layer\":\"l2\",\"at\":[820,640],\"ref\":\"lines\",\"gap\":4,\"color\":\"#c84a3a\"}"
)]
Fill {
bundle: PathBuf,
@@ -803,7 +803,7 @@ enum Command {
},
#[command(
about = "Ink the outlines of vector shapes as tapered strokes, the way an inker would",
- long_about = "Ink the outlines of vector shapes (rects, ellipses, paths, groups of them; often on a hidden sketch layer) as strokes on a paint layer. An outline is split into separate strokes at corners sharper than --break degrees, each stroke tapers in and out, and its weight follows rules instead of pressure written by hand: heavier on the side facing away from the light, heavier on the silhouette (the outer edge of the shapes inked together) than on inner lines, thinner along tight curves, with a small seeded wobble.\n\n klad ink art.draw lines --from body,eye,leg --weight 6 --light -1,-1\n klad ink art.draw lines --from rock --weight 9 --break 45 --gap 3 --wobble 1\n klad ink art.draw lines --path \"M10 10 C 80 0 120 60 200 40\" --weight 4\n\nThe strokes are ordinary agent strokes: klad set, klad transform and the editor edit them. Also an ink op: {\"op\":\"ink\",\"layer\":\"l3\",\"from\":[\"n5\"],\"weight\":6,\"light\":[-1,-1],\"break\":60,\"gap\":0,\"wobble\":0.6}."
+ long_about = "Ink the outlines of vector shapes (rects, ellipses, paths, groups of them; often on a hidden sketch layer) as strokes on a paint layer. An outline is split into separate strokes at corners sharper than --break degrees, each stroke tapers in and out, and its weight follows rules instead of pressure written by hand: heavier on the side facing away from the light, heavier on the silhouette (the outer edge of the shapes inked together) than on inner lines, thinner along tight curves, with a small seeded wobble.\n\n klad ink art.klad lines --from body,eye,leg --weight 6 --light -1,-1\n klad ink art.klad lines --from rock --weight 9 --break 45 --gap 3 --wobble 1\n klad ink art.klad lines --path \"M10 10 C 80 0 120 60 200 40\" --weight 4\n\nThe strokes are ordinary agent strokes: klad set, klad transform and the editor edit them. Also an ink op: {\"op\":\"ink\",\"layer\":\"l3\",\"from\":[\"n5\"],\"weight\":6,\"light\":[-1,-1],\"break\":60,\"gap\":0,\"wobble\":0.6}."
)]
Ink {
bundle: PathBuf,
@@ -857,7 +857,7 @@ enum Command {
},
#[command(
about = "Shade and rim light vector shapes from one light direction",
- long_about = "Make the two lighting layers of the flat-colour recipe from the shapes: on --shade, the side of each shape facing away from the light (the shape minus itself moved towards the light by --depth, in --soft overlapping steps so the inner edge is soft); on --rim, a thin band along the edge facing the light. Both are lasso fills with a cut, so with the layers clipped to the flats (multiply for shade, screen or add for rim) the light follows the shapes.\n\n klad light art.draw --from body,head --light -1,-1 --shade shade --rim rim\n klad light art.draw --from rock --shade shade --depth 24 --soft 4 --shade-color '#3a2f50'\n\nAlso a light op: {\"op\":\"light\",\"from\":[\"n5\"],\"light\":[-1,-1],\"shade\":\"l5\",\"rim\":\"l6\",\"depth\":14,\"soft\":3,\"rimWidth\":4}."
+ long_about = "Make the two lighting layers of the flat-colour recipe from the shapes: on --shade, the side of each shape facing away from the light (the shape minus itself moved towards the light by --depth, in --soft overlapping steps so the inner edge is soft); on --rim, a thin band along the edge facing the light. Both are lasso fills with a cut, so with the layers clipped to the flats (multiply for shade, screen or add for rim) the light follows the shapes.\n\n klad light art.klad --from body,head --light -1,-1 --shade shade --rim rim\n klad light art.klad --from rock --shade shade --depth 24 --soft 4 --shade-color '#3a2f50'\n\nAlso a light op: {\"op\":\"light\",\"from\":[\"n5\"],\"light\":[-1,-1],\"shade\":\"l5\",\"rim\":\"l6\",\"depth\":14,\"soft\":3,\"rimWidth\":4}."
)]
Light {
bundle: PathBuf,
@@ -900,7 +900,7 @@ enum Command {
},
#[command(
about = "Fill a shape's area with short tapered strokes: hatching, bark, fur, stone grain",
- long_about = "Fill the area of closed vector shapes (or a polygon) with short tapered strokes, parallel at --angle or following the outline (--along), clipped to the area, with seeded variation.\n\n klad hatch art.draw shade --in body --angle 35 --spacing 7 --length 10-24\n klad hatch art.draw lines --in trunk --along --spacing 9 --weight 1.5 --color '#3b2a1e'\n\nAlso a hatch op: {\"op\":\"hatch\",\"layer\":\"l5\",\"in\":[\"n5\"],\"angle\":30,\"spacing\":6,\"length\":[12,30],\"jitter\":0.3,\"weight\":2}."
+ long_about = "Fill the area of closed vector shapes (or a polygon) with short tapered strokes, parallel at --angle or following the outline (--along), clipped to the area, with seeded variation.\n\n klad hatch art.klad shade --in body --angle 35 --spacing 7 --length 10-24\n klad hatch art.klad lines --in trunk --along --spacing 9 --weight 1.5 --color '#3b2a1e'\n\nAlso a hatch op: {\"op\":\"hatch\",\"layer\":\"l5\",\"in\":[\"n5\"],\"angle\":30,\"spacing\":6,\"length\":[12,30],\"jitter\":0.3,\"weight\":2}."
)]
Hatch {
bundle: PathBuf,
@@ -944,7 +944,7 @@ enum Command {
},
#[command(
about = "Paint a shape as a form, with strokes that follow it and colours from a light model",
- long_about = "Paint closed vector shapes (or a polygon) as forms. --form round bulges any closed shape like a pillow (its height grows with the distance to its outline), flat is a plane facing --facing x,y,z, cylinder is round across --axis degrees. The light model: a key light from --light x,y at --elevation (or a --lamp x,y,height in canvas px; the shape nearest the lamp gets the full key light and farther ones less, by inverse square), cool fill from above (--fill, --fill-strength), warm bounce from below (--bounce, --bounce-strength) and a darker core just past the terminator (--core). --color is the local colour in full light.\n\nStrokes follow the form: along bands of equal light on round forms, along the axis on cylinders, at --angle on planes. Each takes its colour from the model where it lies and stops where the light changes, so no stroke carries the lit colour into the shadow. Passes go from 2x --weight down to half of it (the small ones only where the form turns), then a decisive pass with --bold in the lights and a few quiet strokes in the shadows (--decisive 0 skips both). Every stroke is drawn like a hand (--hand): its own pressure curve, tapers and width.\n\nPaint on a layer clipped to the flats, or lock the flats layer and paint into it: then strokes run past the outline and a pass of short strokes along it cuts the edge in, so no flat colour shows at the rim. On a plain layer strokes stay inside the outline.\n\n klad paint art.draw paint --in rock --color '#8a8f96' --light -1,-1\n klad paint art.draw paint --in pillar --form cylinder --axis 90 --color '#c9b8a0' --lamp 200,600,150\n klad paint art.draw paint --in wall --form flat --facing 0,0,1 --angle 0 --weight 10\n\nAlso a paint op: {\"op\":\"paint\",\"layer\":\"l5\",\"in\":[\"n5\"],\"color\":\"#5d6a78\",\"light\":[-1,-1],\"weight\":14,\"form\":\"round\"}."
+ long_about = "Paint closed vector shapes (or a polygon) as forms. --form round bulges any closed shape like a pillow (its height grows with the distance to its outline), flat is a plane facing --facing x,y,z, cylinder is round across --axis degrees. The light model: a key light from --light x,y at --elevation (or a --lamp x,y,height in canvas px; the shape nearest the lamp gets the full key light and farther ones less, by inverse square), cool fill from above (--fill, --fill-strength), warm bounce from below (--bounce, --bounce-strength) and a darker core just past the terminator (--core). --color is the local colour in full light.\n\nStrokes follow the form: along bands of equal light on round forms, along the axis on cylinders, at --angle on planes. Each takes its colour from the model where it lies and stops where the light changes, so no stroke carries the lit colour into the shadow. Passes go from 2x --weight down to half of it (the small ones only where the form turns), then a decisive pass with --bold in the lights and a few quiet strokes in the shadows (--decisive 0 skips both). Every stroke is drawn like a hand (--hand): its own pressure curve, tapers and width.\n\nPaint on a layer clipped to the flats, or lock the flats layer and paint into it: then strokes run past the outline and a pass of short strokes along it cuts the edge in, so no flat colour shows at the rim. On a plain layer strokes stay inside the outline.\n\n klad paint art.klad paint --in rock --color '#8a8f96' --light -1,-1\n klad paint art.klad paint --in pillar --form cylinder --axis 90 --color '#c9b8a0' --lamp 200,600,150\n klad paint art.klad paint --in wall --form flat --facing 0,0,1 --angle 0 --weight 10\n\nAlso a paint op: {\"op\":\"paint\",\"layer\":\"l5\",\"in\":[\"n5\"],\"color\":\"#5d6a78\",\"light\":[-1,-1],\"weight\":14,\"form\":\"round\"}."
)]
Paint {
bundle: PathBuf,
@@ -1056,7 +1056,7 @@ enum Command {
},
#[command(
about = "Buffer the drawings of a span of frames, as the editor's prepare does",
- long_about = "Replay every painted drawing shown in frames --from to --to (all frames by default) into the bundle's cache, so the editor and later renders read them instead of replaying their strokes. Run it after a big change made by the CLI, before the editor opens or plays the file.\n\n klad prepare art.draw\n klad prepare art.draw --from 0 --to 23"
+ long_about = "Replay every painted drawing shown in frames --from to --to (all frames by default) into the bundle's cache, so the editor and later renders read them instead of replaying their strokes. Run it after a big change made by the CLI, before the editor opens or plays the file.\n\n klad prepare art.klad\n klad prepare art.klad --from 0 --to 23"
)]
Prepare {
bundle: PathBuf,
@@ -1067,7 +1067,7 @@ enum Command {
},
#[command(
about = "Scatter copies of a small mark over a shape: grass, cracks, dots",
- long_about = "Scatter copies of a small mark (SVG path data around 0,0) inside closed vector shapes (or a polygon), avoiding other shapes, each copy scaled and turned a little (seeded).\n\n klad scatter art.draw lines --in ground --mark \"M0 0 L0 -18\" --count 40 --size 0.7-1.2 --turn -15,15\n klad scatter art.draw lines --in rock --mark \"M0 0 L6 3 L10 -2\" --spacing 22 --avoid moss\n\nAlso a scatter op: {\"op\":\"scatter\",\"layer\":\"l3\",\"in\":[\"n5\"],\"mark\":\"M0 0 L0 -18\",\"count\":40,\"size\":[0.7,1.2],\"turn\":[-15,15],\"avoid\":[\"n9\"]}."
+ long_about = "Scatter copies of a small mark (SVG path data around 0,0) inside closed vector shapes (or a polygon), avoiding other shapes, each copy scaled and turned a little (seeded).\n\n klad scatter art.klad lines --in ground --mark \"M0 0 L0 -18\" --count 40 --size 0.7-1.2 --turn -15,15\n klad scatter art.klad lines --in rock --mark \"M0 0 L6 3 L10 -2\" --spacing 22 --avoid moss\n\nAlso a scatter op: {\"op\":\"scatter\",\"layer\":\"l3\",\"in\":[\"n5\"],\"mark\":\"M0 0 L0 -18\",\"count\":40,\"size\":[0.7,1.2],\"turn\":[-15,15],\"avoid\":[\"n9\"]}."
)]
Scatter {
bundle: PathBuf,
@@ -1113,7 +1113,7 @@ enum Command {
},
#[command(
about = "Paint closed shapes as clumps of leaves, lit as forms",
- long_about = "Build each closed shape out of leaves: leaf marks across the clump take their colour from a round form lit by --light (or a --lamp x,y,height), in a few value steps from --shade through --color to --lit (by default darker and cooler, lighter and warmer than --color), with the most variety in the light; then leaves along the outline, most on the side facing the light and the sky, a few glowing (--glow) at the shadow side's edge, so the silhouette breaks up and the sky shows between them. --mass names a shape around the whole crown, so every clump also turns with the big form. --leaf is the leaf size in px, --density how close the leaves sit. Fill a darker, slightly smaller core under each clump first and paint clumps back to front on one layer. The brush is leaves (several leaf shapes, one per dab).\n\n klad foliage tree.draw canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown\n\nAlso a foliage op: {\"op\":\"foliage\",\"layer\":\"canopy\",\"in\":[\"clump1\"],\"color\":\"#4d7a3b\",\"light\":[-0.6,-0.8],\"leaf\":16,\"mass\":\"crown\"}."
+ long_about = "Build each closed shape out of leaves: leaf marks across the clump take their colour from a round form lit by --light (or a --lamp x,y,height), in a few value steps from --shade through --color to --lit (by default darker and cooler, lighter and warmer than --color), with the most variety in the light; then leaves along the outline, most on the side facing the light and the sky, a few glowing (--glow) at the shadow side's edge, so the silhouette breaks up and the sky shows between them. --mass names a shape around the whole crown, so every clump also turns with the big form. --leaf is the leaf size in px, --density how close the leaves sit. Fill a darker, slightly smaller core under each clump first and paint clumps back to front on one layer. The brush is leaves (several leaf shapes, one per dab).\n\n klad foliage tree.klad canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown\n\nAlso a foliage op: {\"op\":\"foliage\",\"layer\":\"canopy\",\"in\":[\"clump1\"],\"color\":\"#4d7a3b\",\"light\":[-0.6,-0.8],\"leaf\":16,\"mass\":\"crown\"}."
)]
Foliage {
bundle: PathBuf,
@@ -1163,7 +1163,7 @@ enum Command {
},
#[command(
about = "Add, remove, rename, move or reparent a bone of a layer's or group's skeleton",
- long_about = "Bones go on a paint layer or a group (a group's skeleton poses every paint layer in it together). A bone has a name, an optional parent, a head and a tail in canvas px; a child usually starts where its parent ends. Removing a bone removes its children.\n\n klad bone art.draw body --add hip --head 400,500 --tail 400,420\n klad bone art.draw body --add thigh --parent hip --head 400,500 --tail 410,620\n klad bone art.draw body --rename thigh --as femur\n klad bone art.draw body --move femur --tail 420,630\n klad bone art.draw body --reparent femur --parent pelvis\n klad bone art.draw body --rm femur\n\nAlso a bone op: {\"op\":\"bone\",\"layer\":\"body\",\"add\":\"thigh\",\"parent\":\"hip\",\"head\":[400,500],\"tail\":[410,620]}."
+ long_about = "Bones go on a paint layer or a group (a group's skeleton poses every paint layer in it together). A bone has a name, an optional parent, a head and a tail in canvas px; a child usually starts where its parent ends. Removing a bone removes its children.\n\n klad bone art.klad body --add hip --head 400,500 --tail 400,420\n klad bone art.klad body --add thigh --parent hip --head 400,500 --tail 410,620\n klad bone art.klad body --rename thigh --as femur\n klad bone art.klad body --move femur --tail 420,630\n klad bone art.klad body --reparent femur --parent pelvis\n klad bone art.klad body --rm femur\n\nAlso a bone op: {\"op\":\"bone\",\"layer\":\"body\",\"add\":\"thigh\",\"parent\":\"hip\",\"head\":[400,500],\"tail\":[410,620]}."
)]
Bone {
bundle: PathBuf,
@@ -1197,7 +1197,7 @@ enum Command {
},
#[command(
about = "Set how much each bone moves each part of the drawing: automatic, painted dabs, a whole part, smoothed",
- long_about = "Every bone has a weight map over the rest drawing (a grid at a quarter of the canvas resolution); where weights blend, lines bend smoothly; a part held by one bone at weight 1 moves rigidly. --auto starts from the bones (by distance, blending across the joints). --set paints soft round dabs of a weight onto --bone: 'x,y,radius,weight ...'. --part makes a named part of the drawing (at --frame) fully that bone's (and no other's). --smooth blurs the maps a little. render --overlay weights:<bone> shows a bone's map.\n\n klad weights art.draw body --auto\n klad weights art.draw body --bone shin --set '400,600,30,1 410,640,20,0.8'\n klad weights art.draw body --bone head --part head\n\nAlso a weights op: {\"op\":\"weights\",\"layer\":\"body\",\"bone\":\"shin\",\"set\":[[400,600,30,1]]}."
+ long_about = "Every bone has a weight map over the rest drawing (a grid at a quarter of the canvas resolution); where weights blend, lines bend smoothly; a part held by one bone at weight 1 moves rigidly. --auto starts from the bones (by distance, blending across the joints). --set paints soft round dabs of a weight onto --bone: 'x,y,radius,weight ...'. --part makes a named part of the drawing (at --frame) fully that bone's (and no other's). --smooth blurs the maps a little. render --overlay weights:<bone> shows a bone's map.\n\n klad weights art.klad body --auto\n klad weights art.klad body --bone shin --set '400,600,30,1 410,640,20,0.8'\n klad weights art.klad body --bone head --part head\n\nAlso a weights op: {\"op\":\"weights\",\"layer\":\"body\",\"bone\":\"shin\",\"set\":[[400,600,30,1]]}."
)]
Weights {
bundle: PathBuf,
@@ -1221,7 +1221,7 @@ enum Command {
},
#[command(
about = "Pose a drawing with its bones: a new drawing at --to, bent from the rest drawing at --from",
- long_about = "A pose is a turn per bone (degrees from its rest angle, children follow their parent) and a move of the whole (--root). Every paint layer under the skeleton gets a new drawing at --to: each stroke point and fill moves by its bones' weighted blend, the same way Godot's Skeleton2D bends a Polygon2D. The pose is kept on the drawing; posing that frame again re-poses it from the same rest drawing, and posing from a posed drawing starts from its rest drawing. klad inbetween between two poses of one rest drawing turns the bones instead of matching strokes.\n\n klad pose art.draw body --from 0 --to 4 --bone thigh=25 --bone shin=-40 --root 0,6\n\nAlso a pose op: {\"op\":\"pose\",\"layer\":\"body\",\"from\":0,\"to\":4,\"bones\":{\"thigh\":25,\"shin\":-40},\"root\":[0,6]}."
+ long_about = "A pose is a turn per bone (degrees from its rest angle, children follow their parent) and a move of the whole (--root). Every paint layer under the skeleton gets a new drawing at --to: each stroke point and fill moves by its bones' weighted blend, the same way Godot's Skeleton2D bends a Polygon2D. The pose is kept on the drawing; posing that frame again re-poses it from the same rest drawing, and posing from a posed drawing starts from its rest drawing. klad inbetween between two poses of one rest drawing turns the bones instead of matching strokes.\n\n klad pose art.klad body --from 0 --to 4 --bone thigh=25 --bone shin=-40 --root 0,6\n\nAlso a pose op: {\"op\":\"pose\",\"layer\":\"body\",\"from\":0,\"to\":4,\"bones\":{\"thigh\":25,\"shin\":-40},\"root\":[0,6]}."
)]
Pose {
bundle: PathBuf,
@@ -1241,7 +1241,7 @@ enum Command {
},
#[command(
about = "Key a layer, group or shape: its position, turn, scale or opacity at a frame, eased to the next key",
- long_about = "Keys animate a layer, a group or a vector shape without a drawing per frame: x and y (px), rotate (degrees), sx, sy or scale, and opacity, each with its own keys. Between two keys the value follows the first key's ease: linear, in, out, in-out, step, or a curve x1,y1,x2,y2 (as in CSS). Before the first key and after the last the value holds. A layer or group turns and scales about the canvas centre; a shape about its own pivot. --rm removes the keys at that frame (only the named properties, or all).\n\n klad key art.draw lantern --frame 0 y=0\n klad key art.draw lantern --frame 12 y=-14 --ease in-out\n klad key art.draw glow --frame 6 opacity=0.4\n klad key art.draw lantern --frame 12 --rm\n\nAlso a key op: {\"op\":\"key\",\"id\":\"lantern\",\"frame\":12,\"y\":-14,\"ease\":\"in-out\"}."
+ long_about = "Keys animate a layer, a group or a vector shape without a drawing per frame: x and y (px), rotate (degrees), sx, sy or scale, and opacity, each with its own keys. Between two keys the value follows the first key's ease: linear, in, out, in-out, step, or a curve x1,y1,x2,y2 (as in CSS). Before the first key and after the last the value holds. A layer or group turns and scales about the canvas centre; a shape about its own pivot. --rm removes the keys at that frame (only the named properties, or all).\n\n klad key art.klad lantern --frame 0 y=0\n klad key art.klad lantern --frame 12 y=-14 --ease in-out\n klad key art.klad glow --frame 6 opacity=0.4\n klad key art.klad lantern --frame 12 --rm\n\nAlso a key op: {\"op\":\"key\",\"id\":\"lantern\",\"frame\":12,\"y\":-14,\"ease\":\"in-out\"}."
)]
Key {
bundle: PathBuf,
@@ -1266,7 +1266,7 @@ enum Command {
},
#[command(
about = "Measure a drawing against a reference picture: values, saturation, texture, edges, colour per region",
- long_about = "Render the drawing (or read a PNG or JPEG) at the reference's size and compare the two in OKLab: the value range (L at the 5th, 50th and 95th percentile), mean chroma, stroke texture (mean absolute Laplacian of L), edge sharpness (99th percentile of the gradient) and the mean colour difference, with what differs in words (lighter, bluer, busier, softer edges). --region adds a row per named rectangle; --heat writes a picture of where they differ most (black, red, yellow, white as the difference grows to 20).\n\n klad compare cafe.draw reference.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png"
+ long_about = "Render the drawing (or read a PNG or JPEG) at the reference's size and compare the two in OKLab: the value range (L at the 5th, 50th and 95th percentile), mean chroma, stroke texture (mean absolute Laplacian of L), edge sharpness (99th percentile of the gradient) and the mean colour difference, with what differs in words (lighter, bluer, busier, softer edges). --region adds a row per named rectangle; --heat writes a picture of where they differ most (black, red, yellow, white as the difference grows to 20).\n\n klad compare cafe.klad reference.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png"
)]
Compare {
drawing: PathBuf,
@@ -1282,7 +1282,7 @@ enum Command {
},
#[command(
about = "Paint over a picture with brushwork: strokes that follow its forms and stop at its colour edges, big to small",
- long_about = "Repaint what is below a paint layer (or the layers in --from) with strokes on that layer: big brushes first, then smaller ones only where the painting still differs from the source by more than --threshold (a colour difference in OKLab, x100), so detail lands where the source has it. Each stroke takes the source's colour where it starts, broken a little warm and cool (--vary), and runs along the forms (across the colour gradient) until the colour under it changes, it reaches --length (in brush widths, min,max) or it would bend more than --curve allows (0 straight, 1 follows every turn). --in limits it to closed shapes; --focus lets the smallest brush work only in and near one shape. The strokes are ordinary strokes in the part \"paint over\" (--part), one history step, so they take body and relief and can be edited.\n\nFor animation, paint over one key, then carry it to the next with --like <cel>: every stroke moves with the marks under it, takes its colour from the new drawing, and strokes are only added (part \"paint over added\") where the new drawing needs them. The carried strokes keep their order, so klad inbetween pairs them part by part and nothing boils.\n\n klad paintover still.draw brushwork --sizes 32,16,8 --threshold 6\n klad paintover walk.draw brushwork --frame 4 --like c12\n\nAlso a paintover op, alone in its batch: {\"op\":\"paintover\",\"layer\":\"brushwork\",\"sizes\":[32,16,8],\"threshold\":6}."
+ long_about = "Repaint what is below a paint layer (or the layers in --from) with strokes on that layer: big brushes first, then smaller ones only where the painting still differs from the source by more than --threshold (a colour difference in OKLab, x100), so detail lands where the source has it. Each stroke takes the source's colour where it starts, broken a little warm and cool (--vary), and runs along the forms (across the colour gradient) until the colour under it changes, it reaches --length (in brush widths, min,max) or it would bend more than --curve allows (0 straight, 1 follows every turn). --in limits it to closed shapes; --focus lets the smallest brush work only in and near one shape. The strokes are ordinary strokes in the part \"paint over\" (--part), one history step, so they take body and relief and can be edited.\n\nFor animation, paint over one key, then carry it to the next with --like <cel>: every stroke moves with the marks under it, takes its colour from the new drawing, and strokes are only added (part \"paint over added\") where the new drawing needs them. The carried strokes keep their order, so klad inbetween pairs them part by part and nothing boils.\n\n klad paintover still.klad brushwork --sizes 32,16,8 --threshold 6\n klad paintover walk.klad brushwork --frame 4 --like c12\n\nAlso a paintover op, alone in its batch: {\"op\":\"paintover\",\"layer\":\"brushwork\",\"sizes\":[32,16,8],\"threshold\":6}."
)]
Paintover {
bundle: PathBuf,
@@ -1342,7 +1342,7 @@ enum Command {
},
#[command(
about = "Grow grass in closed shapes: blades lit by the ground, smaller with distance, breaking the top edge",
- long_about = "Fill closed shapes with grass blades from the far (top) edge to the near (bottom) one: each blade rises from its root, leans with --wind (degrees) and bends, and is smaller and denser towards the top (--far is the far size against the near one). The ground under them rolls in soft patches about --patch px wide, lit by --light (or a --lamp x,y,height): each blade runs from a dark root to a lit tip in a few value families from --shade through --color to --lit. Along the top edge taller blades (--edge) break the outline against what is behind. Near blades are drawn last.\n\nWith a stroke brush (blade, the default, or any round or chalk tip) each blade is a tapered stroke whose colour runs from --color at the root to the lit colour at the tip when the brush blends to a second colour by pressure. With a picture brush (a tip made of pictures, like your own tufts) each blade is one stamp of the picture, turned to the blade. Build your own brush for your grass (klad brushes --picture, --set) and pass it with --brush: the op decides where the marks go and how they are lit, the brush decides what they look like.\n\n klad grass meadow.draw field --in field-shape --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22\n klad grass meadow.draw bank --in bank --brush my-tuft --blade 160 --density 0.1\n\nAlso a grass op: {\"op\":\"grass\",\"layer\":\"field\",\"in\":[\"field-shape\"],\"color\":\"#6f8a3c\",\"blade\":30,\"far\":0.22,\"wind\":12}."
+ long_about = "Fill closed shapes with grass blades from the far (top) edge to the near (bottom) one: each blade rises from its root, leans with --wind (degrees) and bends, and is smaller and denser towards the top (--far is the far size against the near one). The ground under them rolls in soft patches about --patch px wide, lit by --light (or a --lamp x,y,height): each blade runs from a dark root to a lit tip in a few value families from --shade through --color to --lit. Along the top edge taller blades (--edge) break the outline against what is behind. Near blades are drawn last.\n\nWith a stroke brush (blade, the default, or any round or chalk tip) each blade is a tapered stroke whose colour runs from --color at the root to the lit colour at the tip when the brush blends to a second colour by pressure. With a picture brush (a tip made of pictures, like your own tufts) each blade is one stamp of the picture, turned to the blade. Build your own brush for your grass (klad brushes --picture, --set) and pass it with --brush: the op decides where the marks go and how they are lit, the brush decides what they look like.\n\n klad grass meadow.klad field --in field-shape --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22\n klad grass meadow.klad bank --in bank --brush my-tuft --blade 160 --density 0.1\n\nAlso a grass op: {\"op\":\"grass\",\"layer\":\"field\",\"in\":[\"field-shape\"],\"color\":\"#6f8a3c\",\"blade\":30,\"far\":0.22,\"wind\":12}."
)]
Grass {
bundle: PathBuf,
@@ -1407,7 +1407,7 @@ enum Command {
},
#[command(
about = "List closed regions of the lines that no fill on the layer covers",
- long_about = "List the closed regions of a fill layer's reference (the lines its flood fills fill against) that no fill on the layer covers: pockets a fill missed, or drawings not coloured yet. Regions open to the canvas edge are the outside and do not count. Each pocket prints its bounds and size, and a render of the frame marks them in magenta with a box.\n\n klad gaps art.draw colour --frame 4\n klad gaps art.draw colour --sheet all\n klad gaps art.draw colour --sheet walk --ref lines --gap 4\n\nThe reference, gap and tolerance default to those of the layer's flood fills on those frames."
+ long_about = "List the closed regions of a fill layer's reference (the lines its flood fills fill against) that no fill on the layer covers: pockets a fill missed, or drawings not coloured yet. Regions open to the canvas edge are the outside and do not count. Each pocket prints its bounds and size, and a render of the frame marks them in magenta with a box.\n\n klad gaps art.klad colour --frame 4\n klad gaps art.klad colour --sheet all\n klad gaps art.klad colour --sheet walk --ref lines --gap 4\n\nThe reference, gap and tolerance default to those of the layer's flood fills on those frames."
)]
Gaps {
bundle: PathBuf,
@@ -1442,7 +1442,7 @@ enum Command {
},
#[command(
about = "The document palette: list, --add a colour (with --name), --rm a name, colour or index",
- long_about = "The document palette, kept in doc.json. Named colours can be used wherever a colour goes (--color skin).\n\n klad palette art.draw\n klad palette art.draw --add '#f0c8a0' --name skin\n klad palette art.draw --add '#d0a080' --name skin (changes skin)\n klad palette art.draw --rm skin\n\nAs ops: {\"op\":\"palette\",\"add\":\"#f0c8a0\",\"name\":\"skin\"}, {\"op\":\"palette\",\"rm\":\"skin\"}, {\"op\":\"palette\",\"set\":[{\"color\":\"#1b1b1b\",\"name\":\"ink\"}]}"
+ long_about = "The document palette, kept in doc.json. Named colours can be used wherever a colour goes (--color skin).\n\n klad palette art.klad\n klad palette art.klad --add '#f0c8a0' --name skin\n klad palette art.klad --add '#d0a080' --name skin (changes skin)\n klad palette art.klad --rm skin\n\nAs ops: {\"op\":\"palette\",\"add\":\"#f0c8a0\",\"name\":\"skin\"}, {\"op\":\"palette\",\"rm\":\"skin\"}, {\"op\":\"palette\",\"set\":[{\"color\":\"#1b1b1b\",\"name\":\"ink\"}]}"
)]
Palette {
bundle: PathBuf,
@@ -1457,7 +1457,7 @@ enum Command {
},
#[command(
about = "Export PNGs, sprite sheets, numbered frames or a Godot SpriteFrames and scene",
- long_about = "Export a transparent PNG of the whole image or one layer or group, at a frame, at any scale from 1/16 to 8 (vectors stay sharp; paint layers are resampled). 8-bit PNGs are dithered from the 16-bit float pixels so gradients do not band; --depth 16 writes 16-bit PNGs. --background keeps the canvas background colour.\n\n klad export art.draw\n klad export art.draw --scale 2\n klad export art.draw --layer lines --scale 4 --depth 16 -o lines.png\n\nAnimations (each clip, or the whole timeline when there are no clips):\n\n klad export art.draw --sheet all [--scale 0.5] [--padding 2] [--max 4096]\n a PNG holding each distinct picture once, trimmed to its pixels (more pages, art-sheet-2.png ..., when it does not fit --max), plus art-sheet.json in Aseprite's array layout: one entry per exposure with its duration in ms, frameTags for clips\n klad export art.draw --sheet run one clip; --sheet 0-11 a range\n klad export art.draw --frames run numbered full-size PNGs, one per frame (run-0000.png ...) in art-run/\n klad export art.draw --godot ../game/art the sheet, art.tres (SpriteFrames: one animation per clip with its fps, loop and per-frame durations) and art.tscn (an AnimatedSprite2D placed so the timeline's origin sits on the node's position). The first folder given is kept in the document (export.godot); later exports and the editor's button write there, and Godot uids are kept so scenes using them keep working. --store replaces a kept folder."
+ long_about = "Export a transparent PNG of the whole image or one layer or group, at a frame, at any scale from 1/16 to 8 (vectors stay sharp; paint layers are resampled). 8-bit PNGs are dithered from the 16-bit float pixels so gradients do not band; --depth 16 writes 16-bit PNGs. --background keeps the canvas background colour.\n\n klad export art.klad\n klad export art.klad --scale 2\n klad export art.klad --layer lines --scale 4 --depth 16 -o lines.png\n\nAnimations (each clip, or the whole timeline when there are no clips):\n\n klad export art.klad --sheet all [--scale 0.5] [--padding 2] [--max 4096]\n a PNG holding each distinct picture once, trimmed to its pixels (more pages, art-sheet-2.png ..., when it does not fit --max), plus art-sheet.json in Aseprite's array layout: one entry per exposure with its duration in ms, frameTags for clips\n klad export art.klad --sheet run one clip; --sheet 0-11 a range\n klad export art.klad --frames run numbered full-size PNGs, one per frame (run-0000.png ...) in art-run/\n klad export art.klad --godot ../game/art the sheet, art.tres (SpriteFrames: one animation per clip with its fps, loop and per-frame durations) and art.tscn (an AnimatedSprite2D placed so the timeline's origin sits on the node's position). The first folder given is kept in the document (export.godot); later exports and the editor's button write there, and Godot uids are kept so scenes using them keep working. --store replaces a kept folder."
)]
Export {
bundle: PathBuf,
@@ -1522,7 +1522,7 @@ enum Command {
},
#[command(
about = "List brushes: the library, and with a bundle the ones it embeds",
- long_about = "List brushes: the built-in library, and with a bundle the brushes it embeds (a document keeps every brush it uses in brushes/<id>.json, so it renders the same when the library changes).\n\n klad brushes\n klad brushes art.draw\n klad brushes art.draw --show ink"
+ long_about = "List brushes: the built-in library, and with a bundle the brushes it embeds (a document keeps every brush it uses in brushes/<id>.json, so it renders the same when the library changes).\n\n klad brushes\n klad brushes art.klad\n klad brushes art.klad --show ink"
)]
Brushes {
bundle: Option<PathBuf>,
@@ -1536,7 +1536,7 @@ enum Command {
picture: Option<Vec<String>>,
},
#[command(
- about = "List, add or remove a layer's effects: klad effect art.draw l3 glow radius=24 color=#ffd080",
+ about = "List, add or remove a layer's effects: klad effect art.klad l3 glow radius=24 color=#ffd080",
long_about = "Effects apply in order when the layer composes: blur (radius), glow (radius, strength, threshold, color, blend), outline (width, color, inside), shadow (x, y, radius, color), noise (amount, size, seed, mono), displace (amount, size, seed, by: a layer id whose red and green push the pixels). With no effect name it lists them."
)]
Effect {
@@ -3567,7 +3567,7 @@ const REFERENCE_HEAD: &str = "_Last updated: with the commands it lists. `just r
# klad command reference
-Every command of the `klad` command line with its options, as `klad <command> --help` prints them. A drawing is a `.draw` folder (`docs/format.md`); `klad apply` takes the same edits as JSON lines, one transaction per call. `docs/skill/SKILL.md` explains how an agent uses them, and the `klad-client` crate (`crates/client`) runs them from Rust.
+Every command of the `klad` command line with its options, as `klad <command> --help` prints them. A drawing is a `.klad` folder (`docs/format.md`); `klad apply` takes the same edits as JSON lines, one transaction per call. `docs/skill/SKILL.md` explains how an agent uses them, and the `klad-client` crate (`crates/client`) runs them from Rust.
This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad itself.
@@ -3639,7 +3639,7 @@ mod tests {
let lasso = Cli::try_parse_from([
"draw",
"lasso",
- "a.draw",
+ "a.klad",
"l1",
"--polygon",
"0,0 9,0 9,9",
diff --git a/crates/cli/src/scene.rs b/crates/cli/src/scene.rs
index 3d8ca88..ac9a3f9 100644
--- a/crates/cli/src/scene.rs
+++ b/crates/cli/src/scene.rs
@@ -578,7 +578,7 @@ func _process(_delta):
)
.unwrap();
fs::write(project.join("check.gd"), CHECK).unwrap();
- let path = dir.join("arm.draw");
+ let path = dir.join("arm.klad");
let mut doc = Document::new(600, 400);
doc.canvas.background = Some("#f0e8dc".into());
doc.timeline.frames = 8;
diff --git a/crates/cli/src/sprites.rs b/crates/cli/src/sprites.rs
index f364766..2781757 100644
--- a/crates/cli/src/sprites.rs
+++ b/crates/cli/src/sprites.rs
@@ -584,7 +584,7 @@ func _init():
},
];
doc.layers = vec![ball];
- let path = dir.join("hop.draw");
+ let path = dir.join("hop.klad");
let bundle = Bundle::create(&path, doc).unwrap();
let dot = |x: f32, y: f32| {
marks(vec![
diff --git a/crates/cli/tests/binary.rs b/crates/cli/tests/binary.rs
index 78d1221..a922882 100644
--- a/crates/cli/tests/binary.rs
+++ b/crates/cli/tests/binary.rs
@@ -14,7 +14,7 @@ fn the_binary_runs() {
fn a_drawing_moves_and_a_layer_duplicates_from_the_command_line() {
let dir = std::env::temp_dir().join(format!("draw-binary-move-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
- let bundle = dir.join("a.draw");
+ let bundle = dir.join("a.klad");
let draw = |args: &[&str]| {
let out = Command::new(env!("CARGO_BIN_EXE_klad")).args(args).output().unwrap();
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
@@ -45,7 +45,7 @@ fn a_drawing_moves_and_a_layer_duplicates_from_the_command_line() {
#[test]
fn an_error_is_one_line_and_the_backtrace_waits_for_klad_backtrace() {
- let missing = std::env::temp_dir().join(format!("draw-binary-missing-{}.draw", std::process::id()));
+ let missing = std::env::temp_dir().join(format!("draw-binary-missing-{}.klad", std::process::id()));
let run = |backtrace: Option<&str>| {
let mut command = Command::new(env!("CARGO_BIN_EXE_klad"));
command
@@ -78,7 +78,7 @@ fn the_client_makes_edits_reads_and_renders_a_drawing() {
std::fs::create_dir_all(&dir).unwrap();
let klad = Klad::at(env!("CARGO_BIN_EXE_klad"));
assert!(klad.version().unwrap().starts_with("klad"));
- let art = klad.drawing(dir.join("art.draw"));
+ let art = klad.drawing(dir.join("art.klad"));
art.create(320, 200, Some("#e9e4da")).unwrap();
let ids = art
.apply([
diff --git a/crates/client/README.md b/crates/client/README.md
index bbc0522..e9b7247 100644
--- a/crates/client/README.md
+++ b/crates/client/README.md
@@ -10,7 +10,7 @@ use std::path::Path;
fn main() -> klad_client::Result<()> {
let klad = Klad::new();
- let art = klad.drawing("art.draw");
+ let art = klad.drawing("art.klad");
art.create(800, 600, Some("#e9e4da"))?;
let ids = art.apply([
json!({"op": "add", "layer": {"kind": "vector", "name": "sky"}}),
diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs
index 22c8817..eeeb380 100644
--- a/crates/client/src/lib.rs
+++ b/crates/client/src/lib.rs
@@ -273,12 +273,12 @@ mod tests {
#[test]
fn a_missing_program_is_an_io_error_naming_the_command() {
let klad = Klad::at("/no/such/klad");
- let error = klad.drawing("a.draw").ls(0).unwrap_err();
+ let error = klad.drawing("a.klad").ls(0).unwrap_err();
assert!(matches!(error, Error::Io { .. }));
assert!(
error
.to_string()
- .starts_with("/no/such/klad ls a.draw --json --frame 0")
+ .starts_with("/no/such/klad ls a.klad --json --frame 0")
);
}
diff --git a/crates/core/brushes/library/airbrush.json b/crates/core/brushes/library/airbrush.json
index 2d0d3c7..ebc0650 100644
--- a/crates/core/brushes/library/airbrush.json
+++ b/crates/core/brushes/library/airbrush.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Airbrush",
"tip": { "round": { "hardness": 0.0 } },
"spacing": 0.05,
diff --git a/crates/core/brushes/library/blade.json b/crates/core/brushes/library/blade.json
index 9c3c480..c32429a 100644
--- a/crates/core/brushes/library/blade.json
+++ b/crates/core/brushes/library/blade.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Blade",
"tip": { "round": { "hardness": 0.85 } },
"spacing": 0.12,
diff --git a/crates/core/brushes/library/blender.json b/crates/core/brushes/library/blender.json
index e6aa48c..aae039e 100644
--- a/crates/core/brushes/library/blender.json
+++ b/crates/core/brushes/library/blender.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Blender",
"tip": { "round": { "hardness": 0.1 } },
"spacing": 0.08,
diff --git a/crates/core/brushes/library/chalk.json b/crates/core/brushes/library/chalk.json
index bb471c7..b9c9e07 100644
--- a/crates/core/brushes/library/chalk.json
+++ b/crates/core/brushes/library/chalk.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Chalk",
"tip": { "chalk": { "seed": 7 } },
"spacing": 0.15,
diff --git a/crates/core/brushes/library/clover.json b/crates/core/brushes/library/clover.json
index d585c64..99ca088 100644
--- a/crates/core/brushes/library/clover.json
+++ b/crates/core/brushes/library/clover.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Clover",
"tip": { "image": { "image": "trefoil" } },
"spacing": 1.0,
diff --git a/crates/core/brushes/library/dry-brush.json b/crates/core/brushes/library/dry-brush.json
index c0f75c4..6f5ed7a 100644
--- a/crates/core/brushes/library/dry-brush.json
+++ b/crates/core/brushes/library/dry-brush.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Dry brush",
"tip": { "round": { "hardness": 0.8 } },
"spacing": 0.08,
diff --git a/crates/core/brushes/library/eraser.json b/crates/core/brushes/library/eraser.json
index 8f16da0..299d878 100644
--- a/crates/core/brushes/library/eraser.json
+++ b/crates/core/brushes/library/eraser.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Eraser",
"tip": { "round": { "hardness": 0.85 } },
"spacing": 0.06,
diff --git a/crates/core/brushes/library/flat-bristle.json b/crates/core/brushes/library/flat-bristle.json
index 4e2e9d6..53cecf7 100644
--- a/crates/core/brushes/library/flat-bristle.json
+++ b/crates/core/brushes/library/flat-bristle.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Flat bristle",
"tip": { "image": { "image": "bristle-flat" } },
"spacing": 0.05,
diff --git a/crates/core/brushes/library/fog.json b/crates/core/brushes/library/fog.json
index b043ccb..1cd3b53 100644
--- a/crates/core/brushes/library/fog.json
+++ b/crates/core/brushes/library/fog.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Fog",
"tip": {
"round": {
diff --git a/crates/core/brushes/library/grass.json b/crates/core/brushes/library/grass.json
index 2e38633..f88eb24 100644
--- a/crates/core/brushes/library/grass.json
+++ b/crates/core/brushes/library/grass.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Grass",
"tip": { "image": { "image": "grass" } },
"spacing": 0.35,
diff --git a/crates/core/brushes/library/ink.json b/crates/core/brushes/library/ink.json
index a4a93ca..9400c88 100644
--- a/crates/core/brushes/library/ink.json
+++ b/crates/core/brushes/library/ink.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Inking pen",
"tip": { "round": { "hardness": 0.92 } },
"spacing": 0.04,
diff --git a/crates/core/brushes/library/leaves.json b/crates/core/brushes/library/leaves.json
index 17e4cd8..c2f6871 100644
--- a/crates/core/brushes/library/leaves.json
+++ b/crates/core/brushes/library/leaves.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Leaves",
"tip": { "image": { "image": "leaf", "more": ["leaf-oval", "leaf-oval", "leaf-lance", "leaf-twig"] } },
"spacing": 0.6,
diff --git a/crates/core/brushes/library/marker.json b/crates/core/brushes/library/marker.json
index 5cb5ebe..be27dac 100644
--- a/crates/core/brushes/library/marker.json
+++ b/crates/core/brushes/library/marker.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Marker",
"tip": { "round": { "hardness": 0.75 } },
"spacing": 0.05,
diff --git a/crates/core/brushes/library/oil-load.json b/crates/core/brushes/library/oil-load.json
index d612531..48b9795 100644
--- a/crates/core/brushes/library/oil-load.json
+++ b/crates/core/brushes/library/oil-load.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Loaded oil",
"tip": {"round": {"hardness": 0.78}},
"spacing": 0.04,
diff --git a/crates/core/brushes/library/oil.json b/crates/core/brushes/library/oil.json
index e9a86be..57a9e7d 100644
--- a/crates/core/brushes/library/oil.json
+++ b/crates/core/brushes/library/oil.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Oil",
"tip": {"round": {"hardness": 0.55}},
"spacing": 0.05,
diff --git a/crates/core/brushes/library/pencil.json b/crates/core/brushes/library/pencil.json
index d1d22bc..41d935f 100644
--- a/crates/core/brushes/library/pencil.json
+++ b/crates/core/brushes/library/pencil.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Pencil",
"tip": { "round": { "hardness": 0.6 } },
"spacing": 0.1,
diff --git a/crates/core/brushes/library/round-bristle.json b/crates/core/brushes/library/round-bristle.json
index 8b5d140..1e20091 100644
--- a/crates/core/brushes/library/round-bristle.json
+++ b/crates/core/brushes/library/round-bristle.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Round bristle",
"tip": {
"image": {
diff --git a/crates/core/brushes/library/seed-head.json b/crates/core/brushes/library/seed-head.json
index 1609ab1..0565bbf 100644
--- a/crates/core/brushes/library/seed-head.json
+++ b/crates/core/brushes/library/seed-head.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Seed head",
"tip": { "image": { "image": "seed-head" } },
"spacing": 1.0,
diff --git a/crates/core/brushes/library/smudge.json b/crates/core/brushes/library/smudge.json
index 4f11788..85adbc3 100644
--- a/crates/core/brushes/library/smudge.json
+++ b/crates/core/brushes/library/smudge.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Smudge",
"tip": { "round": { "hardness": 0.3 } },
"spacing": 0.05,
diff --git a/crates/core/brushes/library/soft.json b/crates/core/brushes/library/soft.json
index 6f6c5ed..6e805c4 100644
--- a/crates/core/brushes/library/soft.json
+++ b/crates/core/brushes/library/soft.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Soft",
"tip": { "round": { "hardness": 0.0 } },
"spacing": 0.08,
diff --git a/crates/core/brushes/library/splatter.json b/crates/core/brushes/library/splatter.json
index 69b82f8..7c097d3 100644
--- a/crates/core/brushes/library/splatter.json
+++ b/crates/core/brushes/library/splatter.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Splatter",
"tip": { "image": { "image": "splatter" } },
"spacing": 1.2,
diff --git a/crates/core/brushes/library/sponge.json b/crates/core/brushes/library/sponge.json
index 5338b43..5624642 100644
--- a/crates/core/brushes/library/sponge.json
+++ b/crates/core/brushes/library/sponge.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Sponge",
"tip": { "image": { "image": "sponge" } },
"spacing": 0.2,
diff --git a/crates/core/brushes/library/two-tone.json b/crates/core/brushes/library/two-tone.json
index 3c994b0..fce3f2f 100644
--- a/crates/core/brushes/library/two-tone.json
+++ b/crates/core/brushes/library/two-tone.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Two tone",
"tip": { "round": { "hardness": 0.8 } },
"spacing": 0.05,
diff --git a/crates/core/brushes/library/wet.json b/crates/core/brushes/library/wet.json
index 5c63d2e..3b7507e 100644
--- a/crates/core/brushes/library/wet.json
+++ b/crates/core/brushes/library/wet.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Wet round",
"tip": { "round": { "hardness": 0.5 } },
"spacing": 0.05,
diff --git a/crates/core/brushes/m1/chalk.json b/crates/core/brushes/m1/chalk.json
index bb471c7..b9c9e07 100644
--- a/crates/core/brushes/m1/chalk.json
+++ b/crates/core/brushes/m1/chalk.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Chalk",
"tip": { "chalk": { "seed": 7 } },
"spacing": 0.15,
diff --git a/crates/core/brushes/m1/eraser.json b/crates/core/brushes/m1/eraser.json
index 8f16da0..299d878 100644
--- a/crates/core/brushes/m1/eraser.json
+++ b/crates/core/brushes/m1/eraser.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Eraser",
"tip": { "round": { "hardness": 0.85 } },
"spacing": 0.06,
diff --git a/crates/core/brushes/m1/ink.json b/crates/core/brushes/m1/ink.json
index ddb5726..6791806 100644
--- a/crates/core/brushes/m1/ink.json
+++ b/crates/core/brushes/m1/ink.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Ink (M1)",
"tip": { "round": { "hardness": 0.92 } },
"spacing": 0.04,
diff --git a/crates/core/brushes/m1/pencil.json b/crates/core/brushes/m1/pencil.json
index d1d22bc..41d935f 100644
--- a/crates/core/brushes/m1/pencil.json
+++ b/crates/core/brushes/m1/pencil.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Pencil",
"tip": { "round": { "hardness": 0.6 } },
"spacing": 0.1,
diff --git a/crates/core/brushes/m1/soft.json b/crates/core/brushes/m1/soft.json
index 6f6c5ed..6e805c4 100644
--- a/crates/core/brushes/m1/soft.json
+++ b/crates/core/brushes/m1/soft.json
@@ -1,5 +1,5 @@
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Soft",
"tip": { "round": { "hardness": 0.0 } },
"spacing": 0.08,
diff --git a/crates/core/src/brushes.rs b/crates/core/src/brushes.rs
index 202d94f..02a80e4 100644
--- a/crates/core/src/brushes.rs
+++ b/crates/core/src/brushes.rs
@@ -4,7 +4,7 @@ use anyhow::{Result, bail};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
-pub const BRUSH_FORMAT: &str = "draw-anything-brush/1";
+pub const BRUSH_FORMAT: &str = "klad-brush/1";
pub const SPEED_FULL: f32 = 5.0;
const LIBRARY: &[(&str, &str)] = &[
diff --git a/crates/core/src/bundle.rs b/crates/core/src/bundle.rs
index 62acc2a..d16aad5 100644
--- a/crates/core/src/bundle.rs
+++ b/crates/core/src/bundle.rs
@@ -134,28 +134,10 @@ impl Bundle {
let text = fs::read_to_string(&path).with_context(|| format!("reading {}", path.display()))?;
let raw: serde_json::Value =
serde_json::from_str(&text).with_context(|| format!("parsing {}", path.display()))?;
- let migrated = migrate(raw).with_context(|| format!("upgrading {}", path.display()))?;
- let doc: Document =
- serde_json::from_value(migrated.value.clone()).with_context(|| format!("reading {}", path.display()))?;
+ let value = migrate(raw).with_context(|| format!("opening {}", root.display()))?;
+ let doc: Document = serde_json::from_value(value).with_context(|| format!("reading {}", path.display()))?;
doc.validate().with_context(|| format!("checking {}", path.display()))?;
- let mut bundle = Self { root, doc };
- if migrated.changed() {
- migrated.moves.iter().try_for_each(|m| {
- let from = bundle.root.join(&m.from);
- if from.exists() {
- write_atomic(&bundle.root.join(&m.to), &fs::read(&from)?)?;
- }
- Ok::<_, anyhow::Error>(())
- })?;
- if migrated.embed_m1_brushes {
- bundle.embed_m1_brushes()?;
- }
- bundle.save()?;
- migrated.moves.iter().for_each(|m| {
- let _ = fs::remove_file(bundle.root.join(&m.from));
- });
- eprintln!("upgraded {} to {}", bundle.root.display(), bundle.doc.format);
- }
+ let bundle = Self { root, doc };
Ok(bundle)
}
@@ -214,28 +196,6 @@ impl Bundle {
Ok(ids)
}
- fn used_brushes(&self) -> Result<BTreeSet<String>> {
- self.doc
- .paint_cels()
- .iter()
- .try_fold(BTreeSet::new(), |mut used, (layer, cel)| {
- used.extend(self.read_strokes(&layer.id, &cel.id)?.into_iter().map(|s| s.brush));
- Ok(used)
- })
- }
-
- fn embed_m1_brushes(&self) -> Result<()> {
- self.used_brushes()?.iter().try_for_each(|id| {
- match brushes::legacy_m1(id).or_else(|| brushes::library(id)) {
- Some(def) => {
- self.embed_brush(id, &def)?;
- }
- None => eprintln!("{}: strokes use unknown brush {id:?}", self.root.display()),
- }
- Ok(())
- })
- }
-
pub fn embed_brushes_of(&self, marks: &[Mark]) -> Result<()> {
self.embed_library(strokes_of(marks).map(|s| s.brush.as_str()))
}
@@ -975,55 +935,14 @@ mod tests {
}
#[test]
- fn v0_bundles_upgrade_on_open_and_keep_their_strokes() {
- let dir = scratch("upgrade");
- fs::create_dir_all(dir.join("strokes/ink")).unwrap();
- let v0 = r##"{"format":"draw-anything/0","rev":3,"canvas":{"width":128,"height":128},
- "layers":[{"id":"bg","name":"bg","kind":"vector","shapes":[{"type":"rect","x":0,"y":0,"w":128,"h":128,"fill":"#102030"}]},
- {"id":"ink","name":"ink","kind":"paint"}]}"##;
- fs::write(dir.join("doc.json"), v0).unwrap();
- let strokes = Synth::canvas(128.0, 128.0).strokes(4, 1);
- fs::write(
- dir.join("strokes/ink/c0.strokes"),
- encode_cel(&crate::stroke::marks(strokes.clone())).unwrap(),
- )
- .unwrap();
- let bundle = Bundle::open(&dir).unwrap();
- assert_eq!(bundle.doc.format, crate::doc::FORMAT);
- assert_eq!(bundle.doc.rev, 4);
- let cel = bundle.doc.layer("ink").unwrap().cels()[0].id.clone();
- assert_eq!(bundle.read_strokes("ink", &cel).unwrap(), strokes);
- assert!(!dir.join("strokes/ink/c0.strokes").exists());
- let again = Bundle::open(&dir).unwrap();
- assert_eq!(again.doc.rev, 4);
- fs::remove_dir_all(&dir).unwrap();
- }
-
- #[test]
- fn m1_bundles_embed_the_m1_brushes_they_use() {
- let dir = scratch("m1");
- let mut doc = Document::new(64, 64);
- doc.format = "draw-anything/1".into();
- doc.layers.push(Layer::paint("l1", "ink", "c1"));
- let text = serde_json::to_string(&doc).unwrap();
+ fn a_drawing_in_the_old_format_is_refused_and_left_alone() {
+ let dir = scratch("old-format");
fs::create_dir_all(&dir).unwrap();
- fs::write(dir.join("doc.json"), text).unwrap();
- let mut synth = Synth::canvas(64.0, 64.0);
- synth.brushes = vec!["ink".into(), "chalk".into()];
- fs::create_dir_all(dir.join("strokes/l1")).unwrap();
- fs::write(
- dir.join("strokes/l1/c1.strokes"),
- encode_cel(&crate::stroke::marks(synth.strokes(6, 3))).unwrap(),
- )
- .unwrap();
- let bundle = Bundle::open(&dir).unwrap();
- assert_eq!(bundle.doc.format, crate::doc::FORMAT);
- let embedded = bundle.brushes().unwrap();
- assert_eq!(embedded.keys().collect::<Vec<_>>(), ["chalk", "ink"]);
- assert_eq!(embedded["ink"], brushes::legacy_m1("ink").unwrap());
- assert_ne!(embedded["ink"], brushes::library("ink").unwrap());
- assert_eq!(bundle.brush("marker").unwrap(), brushes::library("marker"));
- assert_eq!(Bundle::open(&dir).unwrap().doc.rev, bundle.doc.rev);
+ let old = r##"{"format":"draw-anything/9","rev":3,"canvas":{"width":128,"height":128},"layers":[]}"##;
+ fs::write(dir.join("doc.json"), old).unwrap();
+ let error = format!("{:#}", Bundle::open(&dir).err().unwrap());
+ assert!(error.contains("old .draw format"), "{error}");
+ assert_eq!(fs::read_to_string(dir.join("doc.json")).unwrap(), old);
fs::remove_dir_all(&dir).unwrap();
}
diff --git a/crates/core/src/doc.rs b/crates/core/src/doc.rs
index d00f56a..0be3206 100644
--- a/crates/core/src/doc.rs
+++ b/crates/core/src/doc.rs
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::collections::{BTreeMap, BTreeSet};
-pub const FORMAT: &str = "draw-anything/9";
+pub const FORMAT: &str = "klad/1";
pub const MAX_SIZE: u32 = 16384;
pub const MASK: usize = usize::MAX;
diff --git a/crates/core/src/fill.rs b/crates/core/src/fill.rs
index dffe490..ce24392 100644
--- a/crates/core/src/fill.rs
+++ b/crates/core/src/fill.rs
@@ -236,7 +236,7 @@ pub(crate) fn encode(out: &mut Vec<u8>, fill: &Fill) {
}
}
-pub(crate) fn decode(reader: &mut Reader, version: u8) -> Result<Fill> {
+pub(crate) fn decode(reader: &mut Reader) -> Result<Fill> {
let id = u32::try_from(reader.varint()?)?;
let color = [reader.u16()?, reader.u16()?, reader.u16()?, reader.u16()?];
let opacity = reader.f32()?;
@@ -246,7 +246,7 @@ pub(crate) fn decode(reader: &mut Reader, version: u8) -> Result<Fill> {
Author::Human
};
let tag = reader.u8()?;
- let flags = if version >= 5 { tag & (FILL_LOCK | FILL_CUTS) } else { 0 };
+ let flags = tag & (FILL_LOCK | FILL_CUTS);
let source = match tag & !flags {
0 => {
let (x, y) = (reader.f32()?, reader.f32()?);
@@ -368,7 +368,7 @@ mod tests {
let mut bytes = Vec::new();
encode(&mut bytes, fill);
let mut reader = Reader::new(&bytes);
- assert_eq!(&decode(&mut reader, 5).unwrap(), fill);
+ assert_eq!(&decode(&mut reader).unwrap(), fill);
assert!(reader.done());
});
let mut bytes = Vec::new();
diff --git a/crates/core/src/history.rs b/crates/core/src/history.rs
index b6b1231..f93b285 100644
--- a/crates/core/src/history.rs
+++ b/crates/core/src/history.rs
@@ -155,8 +155,7 @@ fn read_patch(dir: &Path) -> Result<Patch> {
fn snapshot_doc(dir: &Path) -> Result<Document> {
let text = zstd::decode_all(&fs::read(dir.join("doc.json.zst"))?[..])?;
let value: serde_json::Value = serde_json::from_slice(&text).context("reading the snapshot document")?;
- let migrated = migrate(value).context("upgrading the snapshot document")?;
- serde_json::from_value(migrated.value).context("reading the snapshot document")
+ serde_json::from_value(migrate(value)?).context("reading the snapshot document")
}
fn restored(current: &Document, entry: &Entry, dir: &Path) -> Result<Document> {
@@ -405,7 +404,7 @@ mod tests {
}
#[test]
- #[ignore = "timing: LANDSCAPE=<copy of landscape.draw> cargo test --release -p klad-core undo_timing -- --ignored --nocapture"]
+ #[ignore = "timing: LANDSCAPE=<copy of landscape.klad> cargo test --release -p klad-core undo_timing -- --ignored --nocapture"]
fn undo_timing() {
let path = std::env::var("LANDSCAPE").expect("LANDSCAPE");
let mut bundle = Bundle::open(&path).unwrap();
diff --git a/crates/core/src/migrate.rs b/crates/core/src/migrate.rs
index 49046d1..6296e09 100644
--- a/crates/core/src/migrate.rs
+++ b/crates/core/src/migrate.rs
@@ -1,288 +1,40 @@
use crate::doc::FORMAT;
use anyhow::{Result, bail};
-use serde_json::{Map, Value, json};
-use std::collections::BTreeSet;
-use std::path::PathBuf;
+use serde_json::Value;
-const V0: &str = "draw-anything/0";
-const V1: &str = "draw-anything/1";
-const V2: &str = "draw-anything/2";
-const V3: &str = "draw-anything/3";
-const V4: &str = "draw-anything/4";
-const V5: &str = "draw-anything/5";
-const V6: &str = "draw-anything/6";
-const V7: &str = "draw-anything/7";
-const V8: &str = "draw-anything/8";
-
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct FileMove {
- pub from: PathBuf,
- pub to: PathBuf,
-}
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Migrated {
- pub value: Value,
- pub moves: Vec<FileMove>,
- pub embed_m1_brushes: bool,
-}
-
-impl Migrated {
- pub fn changed(&self) -> bool {
- !self.moves.is_empty() || self.embed_m1_brushes
- }
-}
-
-pub fn migrate(value: Value) -> Result<Migrated> {
+pub fn migrate(value: Value) -> Result<Value> {
let format = value
.get("format")
.and_then(Value::as_str)
.unwrap_or_default()
.to_string();
match format.as_str() {
- FORMAT => Ok(Migrated {
- value,
- moves: Vec::new(),
- embed_m1_brushes: false,
- }),
- V2 | V3 | V4 | V5 | V6 | V7 | V8 => Ok(Migrated {
- value: to_current(value),
- moves: Vec::new(),
- embed_m1_brushes: false,
- }),
- V1 => Ok(Migrated {
- value: to_current(value),
- moves: Vec::new(),
- embed_m1_brushes: true,
- }),
- V0 => {
- let (v1, moves) = from_v0(&value);
- Ok(Migrated {
- value: to_current(v1),
- moves,
- embed_m1_brushes: true,
- })
- }
- other => bail!("unknown document format {other:?}"),
+ FORMAT => Ok(value),
+ old if old.starts_with("draw-anything/") => bail!(
+ "a drawing in the old .draw format ({old}); this klad opens {FORMAT} drawings (.klad) only and does not convert old ones"
+ ),
+ "" => bail!("not a klad drawing: doc.json has no format"),
+ other => bail!("format {other} is not {FORMAT}: made by another or a newer klad"),
}
}
-fn to_current(mut value: Value) -> Value {
- value["format"] = Value::String(FORMAT.to_string());
- value
-}
-
-struct Ids {
- taken: BTreeSet<String>,
- next: u64,
-}
-
-impl Ids {
- fn alloc(&mut self, prefix: char) -> String {
- loop {
- self.next += 1;
- let id = format!("{prefix}{}", self.next);
- if self.taken.insert(id.clone()) {
- return id;
- }
- }
- }
-}
-
-fn strokes(layer: &str, cel: &str) -> PathBuf {
- PathBuf::from("strokes").join(layer).join(format!("{cel}.strokes"))
-}
-
-fn from_v0(v0: &Value) -> (Value, Vec<FileMove>) {
- let layers = v0["layers"].as_array().cloned().unwrap_or_default();
- let mut ids = Ids {
- taken: layers
- .iter()
- .filter_map(|l| l["id"].as_str().map(String::from))
- .collect(),
- next: 0,
- };
- let mut moves = Vec::new();
- let mut converted = Vec::new();
- for layer in &layers {
- let id = layer["id"].as_str().unwrap_or_default().to_string();
- let kind = layer["kind"].as_str().unwrap_or("paint");
- let cel_id = ids.alloc('c');
- let mut cel = json!({ "id": cel_id, "frame": 0 });
- if kind == "vector" {
- let nodes: Vec<Value> = layer["shapes"]
- .as_array()
- .cloned()
- .unwrap_or_default()
- .into_iter()
- .map(|mut shape| {
- shape["id"] = Value::String(ids.alloc('n'));
- shape
- })
- .collect();
- cel["nodes"] = Value::Array(nodes);
- } else {
- moves.push(FileMove {
- from: strokes(&id, "c0"),
- to: strokes(&id, &cel_id),
- });
- }
- let mut out = Map::new();
- out.insert("id".into(), Value::String(id));
- out.insert("name".into(), layer["name"].clone());
- out.insert("kind".into(), Value::String(kind.to_string()));
- out.insert("cels".into(), json!([cel]));
- ["opacity", "blend", "visible"]
- .iter()
- .filter(|k| layer.get(**k).is_some())
- .for_each(|k| {
- out.insert((*k).to_string(), layer[*k].clone());
- });
- converted.push(Value::Object(out));
- }
- let doc = json!({
- "format": V1,
- "rev": v0["rev"].as_u64().unwrap_or(0),
- "canvas": v0["canvas"].clone(),
- "timeline": { "fps": 12, "frames": 1 },
- "layers": converted,
- "nextId": ids.next,
- });
- (doc, moves)
-}
-
#[cfg(test)]
mod tests {
use super::*;
- use crate::doc::{Document, Kind, Shape};
-
- #[test]
- fn v0_documents_become_v1_with_cels_and_node_ids() {
- let v0 = json!({
- "format": "draw-anything/0", "rev": 4,
- "canvas": { "width": 64, "height": 32, "background": "#ffffff" },
- "layers": [
- { "id": "sky", "name": "sky", "kind": "vector",
- "shapes": [{ "type": "rect", "x": 0, "y": 0, "w": 64, "h": 32, "fill": "#336699" }] },
- { "id": "c1", "name": "ink", "kind": "paint", "blend": "multiply", "opacity": 0.5 }
- ]
- });
- let out = migrate(v0).unwrap();
- assert!(out.embed_m1_brushes);
- let moves = out.moves;
- let doc: Document = serde_json::from_value(out.value).unwrap();
- doc.validate().unwrap();
- assert_eq!(doc.rev, 4);
- assert_eq!(doc.layers[0].kind(), Kind::Vector);
- let node = &doc.layers[0].cels()[0].nodes[0];
- assert!(matches!(node.shape, Shape::Rect { w, .. } if w == 64.0));
- assert!(node.id.starts_with('n'));
- let ink = &doc.layers[1];
- assert_eq!(ink.opacity, 0.5);
- assert_ne!(ink.cels()[0].id, "c1");
- assert_eq!(moves.len(), 1);
- assert_eq!(moves[0].from, PathBuf::from("strokes/c1/c0.strokes"));
- assert_eq!(
- moves[0].to,
- PathBuf::from(format!("strokes/c1/{}.strokes", ink.cels()[0].id))
+ use serde_json::json;
+
+ #[test]
+ fn current_documents_pass_and_old_ones_are_refused_with_the_reason() {
+ let current = json!({"format": FORMAT, "rev": 1});
+ assert_eq!(migrate(current.clone()).unwrap(), current);
+ let old = migrate(json!({"format": "draw-anything/9"})).unwrap_err().to_string();
+ assert!(old.contains("old .draw format") && old.contains("klad/1"), "{old}");
+ assert!(
+ migrate(json!({"format": "klad/7"}))
+ .unwrap_err()
+ .to_string()
+ .contains("newer klad")
);
- }
-
- #[test]
- fn current_documents_pass_through_and_unknown_formats_fail() {
- let current = json!({ "format": FORMAT, "rev": 1 });
- let same = migrate(current.clone()).unwrap();
- assert_eq!(same.value, current);
- assert!(!same.changed());
- assert!(migrate(json!({ "format": "other/9" })).is_err());
- }
-
- #[test]
- fn v6_documents_only_change_format_and_have_no_parts() {
- let v6 = json!({ "format": "draw-anything/6", "rev": 2, "canvas": { "width": 8, "height": 8 },
- "timeline": { "fps": 12, "frames": 2 },
- "layers": [{ "id": "l1", "name": "lines", "kind": "paint", "cels": [{ "id": "c1", "frame": 0 }] }] });
- let out = migrate(v6).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert!(!out.changed());
- let doc: crate::doc::Document = serde_json::from_value(out.value).unwrap();
- assert!(doc.layers[0].cels()[0].parts.is_empty());
- }
-
- #[test]
- fn v5_documents_only_change_format_and_read_tweens_after() {
- let v5 = json!({ "format": "draw-anything/5", "rev": 4, "canvas": { "width": 8, "height": 8 },
- "timeline": { "fps": 12, "frames": 4, "origin": [4, 6] },
- "layers": [{ "id": "l1", "name": "lines", "kind": "paint",
- "cels": [{ "id": "c1", "frame": 0, "hold": 1 }, { "id": "c2", "frame": 2 }] }] });
- let out = migrate(v5).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert!(!out.changed());
- let mut doc: crate::doc::Document = serde_json::from_value(out.value).unwrap();
- doc.validate().unwrap();
- assert!(doc.layers[0].cels().iter().all(|c| c.tween.is_none()));
- let cels = doc.layers[0].cels_mut().unwrap();
- cels.insert(
- 1,
- crate::doc::Cel {
- tween: Some(crate::doc::Tween {
- from: "c1".into(),
- to: "c2".into(),
- t: 0.5,
- matching: String::new(),
- pairs: Vec::new(),
- made: "ab12".into(),
- unpaired: String::new(),
- }),
- hold: Some(1),
- ..crate::doc::Cel::at("c3", 1)
- },
- );
- doc.validate().unwrap();
- let text = serde_json::to_string(&doc.layers[0].cels()[1]).unwrap();
- assert_eq!(
- text,
- r#"{"id":"c3","frame":1,"hold":1,"tween":{"from":"c1","to":"c2","t":0.5,"made":"ab12"}}"#
- );
- }
-
- #[test]
- fn v4_documents_only_change_format() {
- let v4 = json!({ "format": "draw-anything/4", "rev": 9, "canvas": { "width": 8, "height": 8 },
- "timeline": { "fps": 12, "frames": 4, "clips": [{ "name": "run", "from": 0, "to": 3, "loop": true }] },
- "layers": [] });
- let out = migrate(v4).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert!(!out.changed());
- let doc: crate::doc::Document = serde_json::from_value(out.value).unwrap();
- doc.validate().unwrap();
- assert_eq!(doc.timeline.clips[0].fps, None);
- assert_eq!(doc.timeline.fps_of(&doc.timeline.clips[0]), 12);
- }
-
- #[test]
- fn v3_documents_only_change_format() {
- let v3 = json!({ "format": "draw-anything/3", "rev": 5, "canvas": { "width": 8, "height": 8 }, "layers": [] });
- let out = migrate(v3).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert!(!out.changed());
- }
-
- #[test]
- fn v2_documents_only_change_format() {
- let v2 = json!({ "format": "draw-anything/2", "rev": 3, "canvas": { "width": 8, "height": 8 }, "layers": [] });
- let out = migrate(v2).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert!(out.moves.is_empty() && !out.embed_m1_brushes);
- assert_eq!(out.value["rev"], 3);
- }
-
- #[test]
- fn v1_documents_only_change_format_and_ask_for_m1_brushes() {
- let v1 = json!({ "format": "draw-anything/1", "rev": 7, "canvas": { "width": 8, "height": 8 }, "layers": [] });
- let out = migrate(v1).unwrap();
- assert_eq!(out.value["format"], FORMAT);
- assert_eq!(out.value["rev"], 7);
- assert!(out.moves.is_empty() && out.embed_m1_brushes && out.changed());
+ assert!(migrate(json!({})).unwrap_err().to_string().contains("no format"));
}
}
diff --git a/crates/core/src/stroke.rs b/crates/core/src/stroke.rs
index b871a2e..2923f77 100644
--- a/crates/core/src/stroke.rs
+++ b/crates/core/src/stroke.rs
@@ -8,8 +8,9 @@ pub const POS_SCALE: f32 = 16.0;
pub const PRESSURE_STEPS: f32 = 4095.0;
pub const TILT_STEPS: f32 = 127.0;
pub const ZSTD_LEVEL: i32 = 3;
-const MAGIC: &[u8; 4] = b"DAST";
-const VERSION: u8 = 6;
+const MAGIC: &[u8; 4] = b"KLST";
+const OLD_MAGIC: &[u8; 4] = b"DAST";
+const VERSION: u8 = 1;
const MARK_STROKE: u8 = 0;
const MARK_FILL: u8 = 1;
const HAS_TILT: u8 = 1;
@@ -227,7 +228,7 @@ fn encode_stroke(out: &mut Vec<u8>, stroke: &Stroke) {
}
}
-fn decode_stroke(reader: &mut Reader, version: u8) -> Result<Stroke> {
+fn decode_stroke(reader: &mut Reader) -> Result<Stroke> {
let id = u32::try_from(reader.varint()?)?;
let name_len = reader.varint()? as usize;
let brush = String::from_utf8(reader.take(name_len)?.to_vec())?;
@@ -237,23 +238,23 @@ fn decode_stroke(reader: &mut Reader, version: u8) -> Result<Stroke> {
let flow = reader.f32()?;
let seed = reader.u32()?;
let channels = reader.u8()?;
- let author = if version >= 2 && reader.u8()? == 1 {
+ let author = if reader.u8()? == 1 {
Author::Agent
} else {
Author::Human
};
- let taper = if version >= 3 && channels & HAS_TAPER != 0 {
+ let taper = if channels & HAS_TAPER != 0 {
[reader.f32()?, reader.f32()?]
} else {
[0.0, 0.0]
};
- let lock = version >= 5 && channels & HAS_LOCK != 0;
- let cuts = if version >= 5 && channels & HAS_CUTS != 0 {
+ let lock = channels & HAS_LOCK != 0;
+ let cuts = if channels & HAS_CUTS != 0 {
cut::decode(reader)?
} else {
Vec::new()
};
- let second = if version >= 6 && channels & HAS_SECOND != 0 {
+ let second = if channels & HAS_SECOND != 0 {
Some([reader.u16()?, reader.u16()?, reader.u16()?, reader.u16()?])
} else {
None
@@ -431,24 +432,21 @@ pub fn encode_raw(marks: &[Mark]) -> Vec<u8> {
pub fn decode_raw(bytes: &[u8]) -> Result<Vec<Mark>> {
let mut reader = Reader::new(bytes);
- if reader.take(4)? != MAGIC {
- bail!("not a stroke file");
+ match reader.take(4)? {
+ m if m == MAGIC => {}
+ m if m == OLD_MAGIC => bail!("a stroke file of the old .draw format; this klad reads .klad drawings only"),
+ _ => bail!("not a stroke file"),
}
let version = reader.u8()?;
- if version == 0 || version > VERSION {
- bail!("stroke format version {version} is not supported");
+ if version != VERSION {
+ bail!("stroke file version {version} is not {VERSION}");
}
let count = reader.varint()? as usize;
let marks = (0..count)
- .map(|_| {
- if version < 4 {
- return decode_stroke(&mut reader, version).map(Mark::Stroke);
- }
- match reader.u8()? {
- MARK_STROKE => decode_stroke(&mut reader, version).map(Mark::Stroke),
- MARK_FILL => fill::decode(&mut reader, version).map(Mark::Fill),
- other => bail!("unknown mark kind {other}"),
- }
+ .map(|_| match reader.u8()? {
+ MARK_STROKE => decode_stroke(&mut reader).map(Mark::Stroke),
+ MARK_FILL => fill::decode(&mut reader).map(Mark::Fill),
+ other => bail!("unknown mark kind {other}"),
})
.collect::<Result<Vec<_>>>()?;
if !reader.done() {
@@ -475,14 +473,6 @@ mod tests {
use crate::fill::{Coverage, FillRef, FillSource, Seed};
use crate::synth::Synth;
- fn as_version(stroke: &Stroke, version: u8) -> Vec<u8> {
- let mut bytes = encode_raw(&[Mark::Stroke(stroke.clone())]);
- assert_eq!(bytes[6], MARK_STROKE);
- bytes.remove(6);
- bytes[4] = version;
- bytes
- }
-
#[test]
fn cel_round_trip_is_exact() {
let strokes = marks(Synth::canvas(2048.0, 2048.0).strokes(200, 3));
@@ -507,33 +497,19 @@ mod tests {
}
#[test]
- fn authors_survive_and_version_one_files_still_load() {
- let agent = Stroke::new(1, "ink", [0.0, 0.0, 0.0, 1.0], 4.0, 1)
- .with_points(&[(1.0, 1.0, 1.0), (2.0, 2.0, 1.0)], 5.0)
- .by(Author::Agent);
- let v2 = as_version(&agent, 2);
- assert_eq!(decode_raw(&v2).unwrap()[0].author(), Author::Agent);
- let author_at = 4 + 1 + 1 + 1 + 4 + 8 + 12 + 4 + 1;
- assert_eq!(v2[author_at], 1);
- let mut v1 = v2.clone();
- v1[4] = 1;
- v1.remove(author_at);
- let legacy = decode_raw(&v1).unwrap();
- let Mark::Stroke(legacy) = &legacy[0] else { panic!() };
- assert_eq!(legacy.author, Author::Human);
- assert_eq!(legacy.samples, agent.samples);
- }
-
- #[test]
- fn tapers_survive_and_older_files_still_load() {
+ fn authors_and_tapers_round_trip_and_old_files_are_refused() {
let points = [(1.0, 1.0, 1.0), (9.0, 2.0, 0.5)];
- let tapered = Stroke::new(1, "ink", [0.0, 0.0, 0.0, 1.0], 4.0, 1)
+ let agent = Stroke::new(1, "ink", [0.0, 0.0, 0.0, 1.0], 4.0, 1)
.with_points(&points, 5.0)
+ .by(Author::Agent)
.tapered([12.0, 30.0]);
- let back = decode_raw(&as_version(&tapered, 3)).unwrap();
- assert_eq!(back[0].as_stroke().unwrap().taper, [12.0, 30.0]);
- let plain = Stroke::new(1, "ink", [0.0, 0.0, 0.0, 1.0], 4.0, 1).with_points(&points, 5.0);
- assert_eq!(decode_raw(&as_version(&plain, 2)).unwrap(), vec![Mark::Stroke(plain)]);
+ let mut bytes = encode_raw(&[agent.clone().into()]);
+ assert_eq!(decode_raw(&bytes).unwrap(), vec![Mark::Stroke(agent)]);
+ bytes[..4].copy_from_slice(OLD_MAGIC);
+ assert!(decode_raw(&bytes).unwrap_err().to_string().contains("old .draw format"));
+ bytes[..4].copy_from_slice(MAGIC);
+ bytes[4] = 2;
+ assert!(decode_raw(&bytes).is_err());
}
#[test]
@@ -581,7 +557,6 @@ mod tests {
}];
let back = decode_raw(&encode_raw(&[cut.clone().into(), plain.clone().into()])).unwrap();
assert_eq!(back, vec![Mark::Stroke(cut.clone()), Mark::Stroke(plain.clone())]);
- assert_eq!(&encode_raw(&[plain.clone().into()])[7..], &as_version(&plain, 4)[6..]);
let bounds = Mark::Stroke(Stroke {
cuts: vec![Cut {
keep: cut::Keep::Inside,
diff --git a/crates/render/src/fonts.rs b/crates/render/src/fonts.rs
index 5d0a0e5..e1d4dee 100644
--- a/crates/render/src/fonts.rs
+++ b/crates/render/src/fonts.rs
@@ -496,7 +496,7 @@ mod tests {
#[ignore = "downloads a family from GitHub"]
fn a_family_downloads_into_the_user_folder_and_comes_into_a_drawing() {
let dir = std::env::temp_dir().join(format!("klad-user-fonts-{}", std::process::id()));
- let root = dir.join("art.draw");
+ let root = dir.join("art.klad");
let _ = std::fs::remove_dir_all(&dir);
unsafe { std::env::set_var("KLAD_USER_FONTS", dir.join("fonts")) };
forget();
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index f6daef2..ce6d0d0 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -1,4 +1,4 @@
-_Last updated: 2026-11-06 11:54_
+_Last updated: 2026-11-06 15:05_
# klad: design
@@ -29,7 +29,7 @@ crates/
Two binaries from one crate: `klad`, the command line, and `klad-editor`, the editor alone (a windowed program on Windows, the executable of `klad.app` on a Mac, started by the Linux AppImage). `klad open [bundle]` launches the same editor from the command line, on the bundle or, without one, on the start window (new, open, recent). `--no-default-features` builds `klad` without the editor. `klad --version` and the editor's About show the version and `git describe` of the commit it was built from (`crates/version.rs`, shared by both crates' build scripts; `KLAD_BUILD` overrides it).
-**Platforms and packaging (M7).** Folders follow each platform: settings in `~/Library/Application Support/klad`, `%APPDATA%\klad` or `$XDG_CONFIG_HOME/klad`; downloaded fonts in the same places' data folder; drawings in `~/Drawings` by default. The open panel is `NSOpenPanel` on macOS and `rfd` elsewhere (the XDG portal on Linux, the common dialog on Windows). The pen: macOS reads `NSEvent`; elsewhere a pen that the system reports as a touch with force (Windows pens through `WM_POINTER`) draws with that pressure (`pen::from_egui`), and anything else draws as a mouse at full pressure; Linux tablets report no pressure through `winit` yet. `packaging/` makes the downloads: `macos/app.sh` builds `klad.app` (both binaries, lipo'd when several targets are given, the fonts, licences and skill in `Resources`, `.draw` declared as a document package of type `com.indicode.klad.drawing` so Finder shows a drawing as one item and opens it in klad) and a disk image; `archive.sh <target>` builds a `tar.gz` or `zip` with both binaries, `fonts/`, the licences and `SKILL.md`, and an AppImage on Linux when `APPIMAGETOOL` is set; `icon/` draws the icon in klad and packs `klad.icns` and `klad.ico`. Builds use the `dist` profile (no debug info, stripped, thin LTO); the samples hash the same from it. The fonts are found next to the binary (`fonts/`), in `../Resources/fonts` or `../share/klad/fonts`. On macOS a drawing opened from Finder arrives as an `application:openURLs:` message, which klad adds to `NSObject` before the event loop starts so it reaches whatever delegate `winit` installs; the paths queue up (`opened.rs`) and the start window or editor opens the last. `klad install` puts `klad` on the terminal's path (a link in `/usr/local/bin` through an administrator prompt on macOS, `~/.local/bin` on Linux, the user's `PATH` on Windows); the editor's document menu runs it as a job. `klad skill` prints the agent skill compiled into the binary. Builds are sold on itch.io (later Steam) for macOS and Windows, and Linux is built from source: on a version tag the `release` workflow builds the Windows version and pushes it to itch.io with butler (never as a workflow artifact, which anyone could download from a public repository) and publishes the changelog section as the release notes, and `just itch-mac` builds and pushes the Mac app from a Mac; `check` runs lint, tests and the audit on every pull request, tests on macOS and builds on Windows. The editor asks the GitHub releases API at most once a day (`updates.rs`, curl on a thread, off in the settings window) and, when a newer version is out, says so in the start window, the message line and About, with a link to what changed; it installs nothing. About's "check now" and `klad updates` check on demand (`updates::spawn`, a channel per check) and say why a check failed: no release published yet, no network, or a feed that does not parse.
+**Platforms and packaging (M7).** Folders follow each platform: settings in `~/Library/Application Support/klad`, `%APPDATA%\klad` or `$XDG_CONFIG_HOME/klad`; downloaded fonts in the same places' data folder; drawings in `~/Drawings` by default. The open panel is `NSOpenPanel` on macOS and `rfd` elsewhere (the XDG portal on Linux, the common dialog on Windows). The pen: macOS reads `NSEvent`; elsewhere a pen that the system reports as a touch with force (Windows pens through `WM_POINTER`) draws with that pressure (`pen::from_egui`), and anything else draws as a mouse at full pressure; Linux tablets report no pressure through `winit` yet. `packaging/` makes the downloads: `macos/app.sh` builds `klad.app` (both binaries, lipo'd when several targets are given, the fonts, licences and skill in `Resources`, `.klad` declared as a document package of type `com.indicode.klad.drawing` so Finder shows a drawing as one item and opens it in klad) and a disk image; `archive.sh <target>` builds a `tar.gz` or `zip` with both binaries, `fonts/`, the licences and `SKILL.md`, and an AppImage on Linux when `APPIMAGETOOL` is set; `icon/` draws the icon in klad and packs `klad.icns` and `klad.ico`. Builds use the `dist` profile (no debug info, stripped, thin LTO); the samples hash the same from it. The fonts are found next to the binary (`fonts/`), in `../Resources/fonts` or `../share/klad/fonts`. On macOS a drawing opened from Finder arrives as an `application:openURLs:` message, which klad adds to `NSObject` before the event loop starts so it reaches whatever delegate `winit` installs; the paths queue up (`opened.rs`) and the start window or editor opens the last. `klad install` puts `klad` on the terminal's path (a link in `/usr/local/bin` through an administrator prompt on macOS, `~/.local/bin` on Linux, the user's `PATH` on Windows); the editor's document menu runs it as a job. `klad skill` prints the agent skill compiled into the binary. Builds are sold on itch.io (later Steam) for macOS and Windows, and Linux is built from source: on a version tag the `release` workflow builds the Windows version and pushes it to itch.io with butler (never as a workflow artifact, which anyone could download from a public repository) and publishes the changelog section as the release notes, and `just itch-mac` builds and pushes the Mac app from a Mac; `check` runs lint, tests and the audit on every pull request, tests on macOS and builds on Windows. The editor asks the GitHub releases API at most once a day (`updates.rs`, curl on a thread, off in the settings window) and, when a newer version is out, says so in the start window, the message line and About, with a link to what changed; it installs nothing. About's "check now" and `klad updates` check on demand (`updates::spawn`, a channel per check) and say why a check failed: no release published yet, no network, or a feed that does not parse.
### Stack
@@ -90,7 +90,7 @@ The CLI render and the editor must agree. Rules for `core`, `brush` and `render`
`docs/format.md` specifies everything below for other programs, byte by byte; this section is how klad itself uses it.
```
-art.draw/
+art.klad/
doc.json canonical document (pretty JSON, stable key order)
strokes/<layer>/<cel>.strokes stroke and fill records per cel (binary, zstd)
brushes/<id>.json every brush the document uses, embedded on first use
@@ -101,11 +101,11 @@ art.draw/
Committed: everything except `.cache/`. A fresh clone rebuilds the cache by replaying strokes and fills.
-### doc.json (format `draw-anything/9`)
+### doc.json (format `klad/1`)
```json
{
- "format": "draw-anything/7",
+ "format": "klad/1",
"rev": 42,
"canvas": { "width": 2048, "height": 2048, "background": "#f4efe6" },
"timeline": { "fps": 12, "frames": 24, "origin": [1024, 1800],
@@ -154,7 +154,7 @@ Committed: everything except `.cache/`. A fresh clone rebuilds the cache by repl
- **Masks.** `mask` is a paint layer kept under the layer it masks, with its own id, cels and stroke files (`strokes/<mask id>/<cel>.strokes`). Its alpha hides the layer: strokes and fills on the mask hide, the eraser shows the layer again, and an empty mask (or a frame without a mask cel) hides nothing. `visible: false` turns the mask off. A mask keeps opacity 1 and blend normal and has no mask or clip of its own. Paint, vector and group layers can have one. Internally a mask's layer path ends in `MASK`, so `locate`, `layer_at` and the history treat it as a layer.
- **Clipping.** `clip: true` shows a layer only where its base, the nearest layer below it in the same list without `clip`, has alpha. The base and the clipped layers above it draw as one group: each clipped layer blends onto the base with its own blend and opacity (masked by the base's alpha), then the group composites onto what is below with the base's blend and opacity, as in Photoshop with "blend clipped layers as group". A hidden base hides its clipped layers; the lowest layer of a list draws unclipped.
- **Lock alpha.** `lockAlpha: true` on a paint layer makes new strokes and fills land only where the layer already has alpha: they composite source-atop and leave alpha unchanged. The flag is recorded on each stroke and fill (stroke format 5), so turning it off later never changes what was drawn. An eraser stroke on a lock-alpha layer changes nothing (the editor refuses it).
-- `rev` increments on every write. Older formats are migrated on open (format, files, then the old files are removed); `/0` bundles from M0 upgrade this way. Format 2 (M2) changed no keys: it marks a bundle that embeds its brushes. `/1` bundles become `/2` by embedding the M1 version of every brush their strokes use (`crates/core/brushes/m1/`), so they render exactly as before. Format 3 (M2 batch 2) adds `palette` and marks a bundle whose paint cels may hold fills (stroke file version 4); `/2` bundles only change the format string, in memory until the next write. Format 4 (M2 batch 4) adds `mask`, `clip` and `lockAlpha`, and marks a bundle whose stroke files may be version 5; `/3` bundles only change the format string. Format 5 (M3 batch 3) adds a clip's `fps`, `timeline.origin` and `export.godot`; `/4` bundles only change the format string. Format 6 (M3 batch 4) adds a cel's `tween`; `/5` bundles only change the format string. History snapshots in older formats are migrated when undone.
+- `rev` increments on every write. `klad/1` (2026-11-06) is the first `.klad` format and starts clean: drawings from before it (`.draw` folders, `draw-anything/0` to `/9`, stroke files marked `DAST`) are refused on open with the reason and not converted (`migrate.rs` keeps the place where later migrations go). From here on a format change bumps the number and migrates older `.klad` drawings on open; history snapshots go through the same migration when undone.
### Edits
@@ -260,7 +260,7 @@ Every layer has `blend`, `opacity`, `visible`, `locked`, optional `mask`, `clip`
Pen samples are quantised the moment they arrive, and the brush draws from the quantised values, so a replay matches what was drawn exactly. Before quantising, the editor passes each sample through:
-1. **The pen's calibration curve**: lightest and heaviest raw pressure and a gamma, kept per pen device in the user's settings (`~/Library/Application Support/draw-anything/settings.json`, `$KLAD_SETTINGS` overrides). A touching pen never records below one pressure step, so 0 keeps meaning "no reading".
+1. **The pen's calibration curve**: lightest and heaviest raw pressure and a gamma, kept per pen device in the user's settings (`~/Library/Application Support/klad/settings.json`, `$KLAD_SETTINGS` overrides). A touching pen never records below one pressure step, so 0 keeps meaning "no reading".
2. **The brush's pressure smoothing**: an exponential average with a time constant in ms.
3. **The brush's stabiliser**: the position is the average of the raw positions of the last N ms. At pen up the window drains, so the line catches up to where the pen lifted.
@@ -273,7 +273,7 @@ Stored pressure is therefore device independent and replays need none of these s
| tilt x, y | 8 bit each (-1..1), delta |
| time | ms since previous sample, varint |
-A stroke header holds the stroke id, brush id, colour, base size, opacity, flow, seed, author, the channel mask and, when set, the taper (in and out lengths in px; stroke format 3, M2), then (stroke format 5, M2 batch 4) the lock alpha bit in the channel mask and, when the mark has cuts, the cuts. Fills carry the same two in the high bits of their source byte; a stroke or fill without them encodes byte for byte as in format 4. Samples are stored per channel (all x deltas, then all y deltas, ...) so zstd compresses them well. One file per cel. Since stroke format 4 (M2 batch 2) every record starts with a kind byte, stroke or fill, and strokes and fills share one id counter per cel; files of versions 1 to 3 hold strokes only and still load.
+A stroke file starts with `KLST` and its version (1). A stroke header holds the stroke id, brush id, colour, base size, opacity, flow, seed, author, the channel mask and, when set, the taper (in and out lengths in px), the lock alpha bit in the channel mask and, when the mark has cuts, the cuts, and the second colour. Fills carry lock and cuts in the high bits of their source byte. Samples are stored per channel (all x deltas, then all y deltas, ...) so zstd compresses them well. One file per cel. Every record starts with a kind byte, stroke or fill, and strokes and fills share one id counter per cel. `docs/format.md` has the bytes.
### Size budget
@@ -322,7 +322,7 @@ A brush is JSON. The library is built in (`crates/core/brushes/library/`: `ink`
```json
{
- "format": "draw-anything-brush/1",
+ "format": "klad-brush/1",
"name": "Every key, with example values",
"tip": { "round": { "hardness": 0.92 } },
"spacing": 0.04,
@@ -366,7 +366,7 @@ Stateless: read the bundle, apply, write atomically, optionally render. Output i
Every command with its options is in `docs/cli.md`, which `klad reference` (hidden) writes and a test keeps current. `klad-client` (`crates/client`) runs the commands from Rust: `Klad` finds the binary (`KLAD` or the path), `Drawing` applies op lines through `klad apply` and reads `ls`, `show`, `strokes`, `notes` and `selection` as JSON.
-An error is one line on stderr (`error: reading a.draw/doc.json: No such file or directory`) and exit code 1, whatever `RUST_BACKTRACE` says; a bug (a panic) is one line too, with where it happened and where to report it. `KLAD_BACKTRACE=1` prints the whole chain and the backtrace instead.
+An error is one line on stderr (`error: reading a.klad/doc.json: No such file or directory`) and exit code 1, whatever `RUST_BACKTRACE` says; a bug (a panic) is one line too, with where it happened and where to report it. `KLAD_BACKTRACE=1` prints the whole chain and the backtrace instead.
| Command | Purpose |
|---|---|
diff --git a/docs/cli.md b/docs/cli.md
index 721346f..9c92471 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -2,7 +2,7 @@ _Last updated: with the commands it lists. `just reference` writes it from `klad
# klad command reference
-Every command of the `klad` command line with its options, as `klad <command> --help` prints them. A drawing is a `.draw` folder (`docs/format.md`); `klad apply` takes the same edits as JSON lines, one transaction per call. `docs/skill/SKILL.md` explains how an agent uses them, and the `klad-client` crate (`crates/client`) runs them from Rust.
+Every command of the `klad` command line with its options, as `klad <command> --help` prints them. A drawing is a `.klad` folder (`docs/format.md`); `klad apply` takes the same edits as JSON lines, one transaction per call. `docs/skill/SKILL.md` explains how an agent uses them, and the `klad-client` crate (`crates/client`) runs them from Rust.
This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad itself.
@@ -26,7 +26,7 @@ This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad it
- [`klad ls`](#klad-ls): Layer tree with ids, kinds, contents and bounds at a frame, top layer first
- [`klad show`](#klad-show): One layer, cel, node, stroke or fill (<cel>:s<id>) in full (JSON)
- [`klad add`](#klad-add): Add a layer, cel or shape
-- [`klad set`](#klad-set): Change properties: klad set art.draw n4 fill=#ff0000 transform.rotate=15 (null removes)
+- [`klad set`](#klad-set): Change properties: klad set art.klad n4 fill=#ff0000 transform.rotate=15 (null removes)
- [`klad rm`](#klad-rm): Remove layers, cels or nodes
- [`klad transform`](#klad-transform): Move, rotate or scale strokes and fills (<cel>:s<id>)
- [`klad lasso`](#klad-lasso): Lasso strokes and fills on a paint layer; --cut also takes the parts crossing the edge
@@ -57,7 +57,7 @@ This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad it
- [`klad palette`](#klad-palette): The document palette: list, --add a colour (with --name), --rm a name, colour or index
- [`klad export`](#klad-export): Export PNGs, sprite sheets, numbered frames or a Godot SpriteFrames and scene
- [`klad brushes`](#klad-brushes): List brushes: the library, and with a bundle the ones it embeds
-- [`klad effect`](#klad-effect): List, add or remove a layer's effects: klad effect art.draw l3 glow radius=24 color=#ffd080
+- [`klad effect`](#klad-effect): List, add or remove a layer's effects: klad effect art.klad l3 glow radius=24 color=#ffd080
- [`klad reshape`](#klad-reshape): Bend a brush stroke along a new path; it keeps its pressure, tilt and timing (klad strokes --json gives each stroke's fitted path)
- [`klad undo`](#klad-undo): Undo the last change (from the CLI or the editor)
- [`klad redo`](#klad-redo): Redo the last undone change
@@ -148,8 +148,8 @@ Options:
```text
Insert or remove frames in every layer or the listed ones.
- klad frame art.draw insert 4 --count 2
- klad frame art.draw remove 4 --layers l3,l5
+ klad frame art.klad insert 4 --count 2
+ klad frame art.klad remove 4 --layers l3,l5
Insert: what showed at the frame now shows there and for the inserted frames too (that exposure lengthens), everything after moves later. Remove: exposures over the removed frames get shorter, drawings left with no frames go (links to them take them over), everything after moves earlier. On every layer, clips and the timeline length follow; on listed layers an insert lengthens the timeline only as far as their drawings need (a last drawing without a hold keeps its length).
@@ -193,8 +193,8 @@ Options:
```text
Track things across frames, the way an animator checks arcs and spacing: a mark (c4:s12, through the drawings that keep its id, as in-betweens do), a part (leaf, or lines:leaf: the centre of the part's marks in each drawing) or a point (x,y: carried by the stroke nearest to it). Prints each frame's position, the distance moved since the frame before, and the lowest point. --ground y (one for all tracks, or one per track) adds the frames where a track goes under the ground line or slides along it while touching it (for a cycle drawn in place, --travel gives the px per frame the planted foot should move back by); with two or more tracks, the frames where two of them swap sides (feet crossing) are listed. --check makes any of these an error, for scripts. klad render --overlay arcs --track ... draws the same paths.
- klad arcs walk.draw --track 'near foot' --track 'far foot' --clip walk --ground 610,598 --travel 7 --check
- klad arcs walk.draw --track c12:s4 --from 12 --to 27 --json
+ klad arcs walk.klad --track 'near foot' --track 'far foot' --clip walk --ground 610,598 --travel 7 --check
+ klad arcs walk.klad --track c12:s4 --from 12 --to 27 --json
Usage: klad arcs [OPTIONS] --track <TRACK> <BUNDLE>
@@ -243,9 +243,9 @@ Options:
```text
Name a group of marks in a drawing: a part such as leaf, near leg or body. In-betweens pair marks part by part first (in order within a part, nearest shape when the counts differ), whatever their ids; arcs track a part's centre. A mark is in one part at most; naming it again moves it. dup, copy and in-betweens keep parts. --name '' takes the marks out of their part.
- klad part art.draw c4:s14 c4:s15 --name leaf
- klad part art.draw c9:s17 c9:s18 --name leaf
- klad stroke art.draw lines --path "M..." --part leaf
+ klad part art.klad c4:s14 c4:s15 --name leaf
+ klad part art.klad c9:s17 c9:s18 --name leaf
+ klad stroke art.klad lines --path "M..." --part leaf
Also an op: {"op":"part","ids":["c4:s14","c4:s15"],"name":"leaf"}. klad strokes lists each mark's part.
@@ -283,7 +283,7 @@ Options:
```text
Duplicate a layer: its drawings, links, in-between marks and mask are copied with new ids, and the copy, named "<name> copy", goes right above it.
- klad duplicate art.draw l3
+ klad duplicate art.klad l3
Also an op in klad apply: {"op":"duplicate","layer":"l3"}.
@@ -318,11 +318,11 @@ Options:
```text
Make drawings on the timeline.
- klad cel art.draw new l3 --frame 4 a blank drawing on layer l3 at frame 4
- klad cel art.draw dup c4 [--frame 6] a copy of c4's drawing (default: right after c4's exposure)
- klad cel art.draw link c4 --frame 8 show c4's drawing again at frame 8
- klad cel art.draw unlink c9 turn the link c9 into a drawing of its own
- klad cel art.draw move c5 --frame 12 start c5 at frame 12, keeping its hold; drawings in the way are pushed along
+ klad cel art.klad new l3 --frame 4 a blank drawing on layer l3 at frame 4
+ klad cel art.klad dup c4 [--frame 6] a copy of c4's drawing (default: right after c4's exposure)
+ klad cel art.klad link c4 --frame 8 show c4's drawing again at frame 8
+ klad cel art.klad unlink c9 turn the link c9 into a drawing of its own
+ klad cel art.klad move c5 --frame 12 start c5 at frame 12, keeping its hold; drawings in the way are pushed along
Inside an exposure a new cel takes over the rest of it; elsewhere it lasts until the next cel, or --hold frames (dup and link default to their source's hold). --insert moves later cels of that layer back to make room (only at the start or end of an exposure). Strokes keep their ids in a dup.
@@ -369,9 +369,9 @@ Options:
```text
Copy strokes and fills (<cel>:s<id>) into another drawing. The copies get new ids, printed as a map (c1:s3 -> c9:s12), and land on top of that drawing in the order they had. --to names the drawing; --frame takes the drawing the layer shows at that frame (a new drawing on an empty frame or past the end; a frame that shows a link names its source instead). The marks' own layer unless --layer. The move, turn, scale and flip options are klad transform's, applied to the copies together about the middle of their bounds or --pivot. --cut keeps only the parts inside a polygon.
- klad copy art.draw c1:s3 c1:s4 --frame 4
- klad copy art.draw c1:s3 --to c9 --move 12,-4 --rotate 8
- klad copy art.draw c1:s3 --frame 6 --layer shade --flip h --pivot 512,400
+ klad copy art.klad c1:s3 c1:s4 --frame 4
+ klad copy art.klad c1:s3 --to c9 --move 12,-4 --rotate 8
+ klad copy art.klad c1:s3 --frame 6 --layer shade --flip h --pivot 512,400
Also a copy op in klad apply: {"op":"copy","ids":["c1:s3"],"frame":4,"x":12,"y":-4} (or "to":"c9").
@@ -438,11 +438,11 @@ Options:
```text
Retime frames FROM-TO (both included) on every layer, or on --layers (with their masks and children). The range is cut where any of those layers changes what it shows; each piece is one picture.
- klad retime art.draw 0-11 --on 2 every picture shows for 2 frames (ones to twos)
- klad retime art.draw 0-23 --on 1 and back to ones
- klad retime art.draw 0-11 --fit 16 the range becomes 16 frames; order and relative timing kept, at least one frame each
- klad retime art.draw 0-7 --reverse
- klad retime art.draw 0-7 --pingpong the pictures again backwards as links, the ends not repeated: a b c d c b
+ klad retime art.klad 0-11 --on 2 every picture shows for 2 frames (ones to twos)
+ klad retime art.klad 0-23 --on 1 and back to ones
+ klad retime art.klad 0-11 --fit 16 the range becomes 16 frames; order and relative timing kept, at least one frame each
+ klad retime art.klad 0-7 --reverse
+ klad retime art.klad 0-7 --pingpong the pictures again backwards as links, the ends not repeated: a b c d c b
Later cels move by the change in length; on every layer clips move and stretch with it and the timeline grows or shrinks; on listed layers clips stay and the timeline only grows. A drawing that ends up in two places is shown again by a link. One history step. Also a retime op: {"op":"retime","from":0,"to":11,"on":2,"layers":["l3"]} (or "fit":16, "reverse":true, "pingpong":true).
@@ -492,10 +492,10 @@ Options:
```text
Make in-betweens of two keys on paint layers: the drawings shown at --from and --to (the second key is the frame where a drawing starts; a link there names its source, so a loop's last in-betweens can lead back to its first drawing). By default a new cel on every frame between them; --count n spreads n of them, each holding until the next.
- klad inbetween art.draw --layers lines,colour --from 0 --to 6
- klad inbetween art.draw --layers lines --from 0 --to 8 --count 3 --spacing in-out
- klad inbetween art.draw --layers arm --from 4 --to 10 --match near --pair s3=s7
- klad inbetween art.draw --redo after a key changed
+ klad inbetween art.klad --layers lines,colour --from 0 --to 6
+ klad inbetween art.klad --layers lines --from 0 --to 8 --count 3 --spacing in-out
+ klad inbetween art.klad --layers arm --from 4 --to 10 --match near --pair s3=s7
+ klad inbetween art.klad --redo after a key changed
Strokes pair by id (a key duplicated from the other keeps its ids), by --match order or by nearest shape; --pair forces pairs (first key id = second key id). Each pair is resampled along its length; points, pressure, tilt, size, opacity, flow, taper and colour move at the spacing (colour evenly in OKLab, so colour the second key for its light and the in-betweens carry the change), and the pair turns and scales along an arc about the point its best-fit rotation turns around, so a swinging limb keeps its length. A line end that touches another line in both keys touches it in every in-between. Lasso fills are interpolated; flood fills are recomputed in each in-between from a seed carried with the lines next to it (the layers they fill against go first). Unpaired marks and fills that fail (a seed on a line, a leak) are left out and listed.
@@ -584,10 +584,10 @@ Options:
```text
Copy one of klad's fonts (by family, or family and style) or a font file (TTF or OTF) into the bundle's fonts folder, so text nodes render the same on every machine; a family that klad does not have yet but Google Fonts does is downloaded first. With no font, list the bundle's fonts. Text nodes also take a family name directly (font=Inter, font="Inter Bold") and copy it in themselves.
- klad font art.draw Cinzel
- klad font art.draw "Barlow Bold"
- klad font art.draw ~/fonts/Signage.ttf
- klad add art.draw text --in l4 text=INN font=Cinzel size=48 x=120 y=80 fill=#2b1d12
+ klad font art.klad Cinzel
+ klad font art.klad "Barlow Bold"
+ klad font art.klad ~/fonts/Signage.ttf
+ klad add art.klad text --in l4 text=INN font=Cinzel size=48 x=120 y=80 fill=#2b1d12
Usage: klad font <BUNDLE> [FONT]
@@ -639,11 +639,11 @@ Options:
## klad atmosphere
```text
-The atmosphere fades layers at the top of the stack that have a depth (klad set art.draw g2 depth=2) towards the fog colour, blurs them and takes colour out, more the deeper they are.
+The atmosphere fades layers at the top of the stack that have a depth (klad set art.klad g2 depth=2) towards the fog colour, blurs them and takes colour out, more the deeper they are.
- klad atmosphere art.draw
- klad atmosphere art.draw color=#9aa8b8 top=#d8e0e8 density=0.5 blur=1 desaturate=0.15
- klad atmosphere art.draw --off
+ klad atmosphere art.klad
+ klad atmosphere art.klad color=#9aa8b8 top=#d8e0e8 density=0.5 blur=1 desaturate=0.15
+ klad atmosphere art.klad --off
Usage: klad atmosphere [OPTIONS] <BUNDLE> [PROPS]...
@@ -679,10 +679,10 @@ Options:
```text
Show the timeline (fps, length, origin, clips) or set fps, length and origin.
- klad timeline art.draw
- klad timeline art.draw --fps 12 --frames 24
- klad timeline art.draw --origin 512,700 the canvas point a Godot export puts on the node's position
- klad timeline art.draw --origin centre back to the middle of the canvas (the default)
+ klad timeline art.klad
+ klad timeline art.klad --fps 12 --frames 24
+ klad timeline art.klad --origin 512,700 the canvas point a Godot export puts on the node's position
+ klad timeline art.klad --origin centre back to the middle of the canvas (the default)
Usage: klad timeline [OPTIONS] <BUNDLE>
@@ -721,12 +721,12 @@ Options:
```text
List, add, change, rename and remove clips: named frame ranges such as idle, run or attack. Exports turn each clip into an animation; a clip may have its own fps.
- klad clip art.draw list them
- klad clip art.draw --add run --from 0 --to 11 --loop --fps 12
- klad clip art.draw --set run --to 15 --no-loop
- klad clip art.draw --set run --name sprint rename
- klad clip art.draw --set run --fps doc use the document's fps again
- klad clip art.draw --rm run
+ klad clip art.klad list them
+ klad clip art.klad --add run --from 0 --to 11 --loop --fps 12
+ klad clip art.klad --set run --to 15 --no-loop
+ klad clip art.klad --set run --name sprint rename
+ klad clip art.klad --set run --fps doc use the document's fps again
+ klad clip art.klad --rm run
Frames inserted or removed on every layer move and stretch clips; a clip ends where the timeline ends.
@@ -826,10 +826,10 @@ Options:
```text
Add a layer, cel or shape.
- klad add art.draw layer vector name=sky
- klad add art.draw rect --in l2 x=0 y=0 w=2048 h=900 fill=#1b2a41
- klad add art.draw ellipse --in l2 cx=500 cy=300 rx=80 ry=80 'fill={"radial":{"center":[500,300],"radius":80,"stops":[[0,"#fff6d5"],[1,"#f3c76a"]]}}'
- klad add art.draw cel --in l3 frame=4 hold=2
+ klad add art.klad layer vector name=sky
+ klad add art.klad rect --in l2 x=0 y=0 w=2048 h=900 fill=#1b2a41
+ klad add art.klad ellipse --in l2 cx=500 cy=300 rx=80 ry=80 'fill={"radial":{"center":[500,300],"radius":80,"stops":[[0,"#fff6d5"],[1,"#f3c76a"]]}}'
+ klad add art.klad cel --in l3 frame=4 hold=2
Values are JSON when they parse as JSON, otherwise strings. Dotted keys nest: transform.rotate=15, stroke.width=3.
@@ -882,10 +882,10 @@ Options:
```text
Change properties of a layer, cel, shape, stroke or fill. Values are JSON when they parse as JSON, otherwise strings; null removes a key. Dotted keys nest.
- klad set art.draw n4 fill=#ff0000 transform.rotate=15
- klad set art.draw l2 opacity=0.5 blend=multiply
- klad set art.draw c4:s12 color=#c84a3a size=6 brush=pencil
- klad set art.draw c4:s7 color=skin opacity=0.8
+ klad set art.klad n4 fill=#ff0000 transform.rotate=15
+ klad set art.klad l2 opacity=0.5 blend=multiply
+ klad set art.klad c4:s12 color=#c84a3a size=6 brush=pencil
+ klad set art.klad c4:s7 color=skin opacity=0.8
Strokes take color, size, opacity, flow, brush and taper ([in,out] or null); fills take color and opacity. Colours may be palette names.
@@ -959,9 +959,9 @@ Options:
```text
Move, rotate or scale strokes and fills, addressed as <cel>:s<id> (klad strokes lists them). Rotation and scale turn about --pivot, by default the middle of the marks' bounds. Stroke sizes and tapers scale with them; fills move by whole pixels and are resampled when turned or scaled.
- klad transform art.draw c4:s12 c4:s13 --move 40,-10
- klad transform art.draw c4:s12 --rotate 15 --scale 1.2
- klad transform art.draw c4:s3 c4:s5 --sx -1 --pivot 512,400
+ klad transform art.klad c4:s12 c4:s13 --move 40,-10
+ klad transform art.klad c4:s12 --rotate 15 --scale 1.2
+ klad transform art.klad c4:s3 c4:s5 --sx -1 --pivot 512,400
Also a transform op in klad apply: {"op":"transform","ids":["c4:s12"],"x":40,"y":-10,"rotate":15,"sx":1.2,"sy":1.2}
@@ -1021,11 +1021,11 @@ Options:
```text
Select the strokes and fills of a paint layer inside a polygon and move, turn, scale, flip or delete them in one step. Without --cut only whole marks move: strokes whose points are all inside and fills whose pixels are. With --cut every stroke or fill crossing the edge is split at the edge: the part outside stays where it is and the part inside moves with the rest, so nothing outside the lasso changes. Without a move, turn, scale, flip or --rm it only lists what is inside and what crosses.
- klad lasso art.draw l3 --polygon '100,100 400,120 380,400 90,380'
- klad lasso art.draw l3 --polygon '100,100 400,120 380,400 90,380' --cut --move 60,-20
- klad lasso art.draw l3 --polygon '...' --cut --rotate 15 --scale 1.2
- klad lasso art.draw l3 --polygon '...' --flip h
- klad lasso art.draw l3 --polygon '...' --cut --rm
+ klad lasso art.klad l3 --polygon '100,100 400,120 380,400 90,380'
+ klad lasso art.klad l3 --polygon '100,100 400,120 380,400 90,380' --cut --move 60,-20
+ klad lasso art.klad l3 --polygon '...' --cut --rotate 15 --scale 1.2
+ klad lasso art.klad l3 --polygon '...' --flip h
+ klad lasso art.klad l3 --polygon '...' --cut --rm
Also a lasso op in klad apply: {"op":"lasso","layer":"l3","polygon":[[100,100],[400,120],[380,400]],"cut":true,"x":60,"y":-20} (or "rm":true).
@@ -1092,14 +1092,14 @@ Options:
```text
Without edit flags: list the points (anchors) of a path, rect or ellipse with their handles, numbered across subpaths. Coordinates are the shape's own, as in its d, before its transform. Any edit turns a rect or ellipse into a path that looks the same.
- klad path art.draw n7
- klad path art.draw n7 --move 3 412,230
- klad path art.draw n7 --nudge 3,4,5 0,-20
- klad path art.draw n7 --handle 3 out 430,210
- klad path art.draw n7 --insert 3,0.5 (split the segment after point 3)
- klad path art.draw n7 --add 418,236 (a point on the nearest segment)
- klad path art.draw n7 --rm 4,5 --corner 2 --smooth 6
- klad path art.draw n7 --simplify 1.5 (fewer, smooth points within 1.5 px)
+ klad path art.klad n7
+ klad path art.klad n7 --move 3 412,230
+ klad path art.klad n7 --nudge 3,4,5 0,-20
+ klad path art.klad n7 --handle 3 out 430,210
+ klad path art.klad n7 --insert 3,0.5 (split the segment after point 3)
+ klad path art.klad n7 --add 418,236 (a point on the nearest segment)
+ klad path art.klad n7 --rm 4,5 --corner 2 --smooth 6
+ klad path art.klad n7 --simplify 1.5 (fewer, smooth points within 1.5 px)
As ops: {"op":"path","id":"n7","move":3,"to":[412,230]}, "move":[3,4],"by":[0,-20]; "handle":3,"out":[430,210]; "insert":3,"t":0.5; "add":[418,236]; "rm":[4,5]; "corner":2; "smooth":6; "simplify":1.5. A smooth point keeps its handles in line unless "free":true.
@@ -1332,9 +1332,9 @@ Options:
```text
Paint with a brush along an SVG path (M, L, H, V, C, S, Q, T, Z; several subpaths make several strokes) or explicit points.
- klad stroke art.draw l3 --brush ink --size 14 --color #1b1b1b --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05
- klad stroke art.draw l3 --brush ink --size 6 --taper 12,30 --path 'M100 100 Q 200 40 300 120'
- klad stroke art.draw l3 --points '10,10,0.5 40,30,1 80,35,0.2'
+ klad stroke art.klad l3 --brush ink --size 14 --color #1b1b1b --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05
+ klad stroke art.klad l3 --brush ink --size 6 --taper 12,30 --path 'M100 100 Q 200 40 300 120'
+ klad stroke art.klad l3 --points '10,10,0.5 40,30,1 80,35,0.2'
Pressure is spread evenly along the stroke. --taper thins the first and last px of the line whatever the pressure. Brushes are a bundle brush id or a library brush (klad brushes). Strokes are marked as agent strokes.
@@ -1413,9 +1413,9 @@ Options:
```text
Fill a region of a paint layer. A flood fill starts at --at and spreads over pixels within --tolerance of that pixel in the reference: this layer (default), all (everything visible) or a layer id or name. --gap closes openings in the lines up to that many px wide; --expand grows the fill under the lines by that many px. --polygon fills a lasso polygon instead. The fill is stored with its coverage, so it renders the same later; klad refill recomputes it after the lines change.
- klad fill art.draw l2 --at 820,640 --ref lines --gap 4 --color '#c84a3a'
- klad fill art.draw l2 --at 820,640 --ref all --color skin
- klad fill art.draw l2 --polygon '100,100 400,120 260,380' --color '#20304a'
+ klad fill art.klad l2 --at 820,640 --ref lines --gap 4 --color '#c84a3a'
+ klad fill art.klad l2 --at 820,640 --ref all --color skin
+ klad fill art.klad l2 --polygon '100,100 400,120 260,380' --color '#20304a'
Colours are #rrggbb, #rrggbbaa or a palette name. Also a fill op in klad apply: {"op":"fill","layer":"l2","at":[820,640],"ref":"lines","gap":4,"color":"#c84a3a"}
@@ -1495,9 +1495,9 @@ Options:
```text
Ink the outlines of vector shapes (rects, ellipses, paths, groups of them; often on a hidden sketch layer) as strokes on a paint layer. An outline is split into separate strokes at corners sharper than --break degrees, each stroke tapers in and out, and its weight follows rules instead of pressure written by hand: heavier on the side facing away from the light, heavier on the silhouette (the outer edge of the shapes inked together) than on inner lines, thinner along tight curves, with a small seeded wobble.
- klad ink art.draw lines --from body,eye,leg --weight 6 --light -1,-1
- klad ink art.draw lines --from rock --weight 9 --break 45 --gap 3 --wobble 1
- klad ink art.draw lines --path "M10 10 C 80 0 120 60 200 40" --weight 4
+ klad ink art.klad lines --from body,eye,leg --weight 6 --light -1,-1
+ klad ink art.klad lines --from rock --weight 9 --break 45 --gap 3 --wobble 1
+ klad ink art.klad lines --path "M10 10 C 80 0 120 60 200 40" --weight 4
The strokes are ordinary agent strokes: klad set, klad transform and the editor edit them. Also an ink op: {"op":"ink","layer":"l3","from":["n5"],"weight":6,"light":[-1,-1],"break":60,"gap":0,"wobble":0.6}.
@@ -1584,8 +1584,8 @@ Options:
```text
Make the two lighting layers of the flat-colour recipe from the shapes: on --shade, the side of each shape facing away from the light (the shape minus itself moved towards the light by --depth, in --soft overlapping steps so the inner edge is soft); on --rim, a thin band along the edge facing the light. Both are lasso fills with a cut, so with the layers clipped to the flats (multiply for shade, screen or add for rim) the light follows the shapes.
- klad light art.draw --from body,head --light -1,-1 --shade shade --rim rim
- klad light art.draw --from rock --shade shade --depth 24 --soft 4 --shade-color '#3a2f50'
+ klad light art.klad --from body,head --light -1,-1 --shade shade --rim rim
+ klad light art.klad --from rock --shade shade --depth 24 --soft 4 --shade-color '#3a2f50'
Also a light op: {"op":"light","from":["n5"],"light":[-1,-1],"shade":"l5","rim":"l6","depth":14,"soft":3,"rimWidth":4}.
@@ -1660,8 +1660,8 @@ Options:
```text
Fill the area of closed vector shapes (or a polygon) with short tapered strokes, parallel at --angle or following the outline (--along), clipped to the area, with seeded variation.
- klad hatch art.draw shade --in body --angle 35 --spacing 7 --length 10-24
- klad hatch art.draw lines --in trunk --along --spacing 9 --weight 1.5 --color '#3b2a1e'
+ klad hatch art.klad shade --in body --angle 35 --spacing 7 --length 10-24
+ klad hatch art.klad lines --in trunk --along --spacing 9 --weight 1.5 --color '#3b2a1e'
Also a hatch op: {"op":"hatch","layer":"l5","in":["n5"],"angle":30,"spacing":6,"length":[12,30],"jitter":0.3,"weight":2}.
@@ -1751,9 +1751,9 @@ Strokes follow the form: along bands of equal light on round forms, along the ax
Paint on a layer clipped to the flats, or lock the flats layer and paint into it: then strokes run past the outline and a pass of short strokes along it cuts the edge in, so no flat colour shows at the rim. On a plain layer strokes stay inside the outline.
- klad paint art.draw paint --in rock --color '#8a8f96' --light -1,-1
- klad paint art.draw paint --in pillar --form cylinder --axis 90 --color '#c9b8a0' --lamp 200,600,150
- klad paint art.draw paint --in wall --form flat --facing 0,0,1 --angle 0 --weight 10
+ klad paint art.klad paint --in rock --color '#8a8f96' --light -1,-1
+ klad paint art.klad paint --in pillar --form cylinder --axis 90 --color '#c9b8a0' --lamp 200,600,150
+ klad paint art.klad paint --in wall --form flat --facing 0,0,1 --angle 0 --weight 10
Also a paint op: {"op":"paint","layer":"l5","in":["n5"],"color":"#5d6a78","light":[-1,-1],"weight":14,"form":"round"}.
@@ -1906,8 +1906,8 @@ Options:
```text
Replay every painted drawing shown in frames --from to --to (all frames by default) into the bundle's cache, so the editor and later renders read them instead of replaying their strokes. Run it after a big change made by the CLI, before the editor opens or plays the file.
- klad prepare art.draw
- klad prepare art.draw --from 0 --to 23
+ klad prepare art.klad
+ klad prepare art.klad --from 0 --to 23
Usage: klad prepare [OPTIONS] <BUNDLE>
@@ -1931,8 +1931,8 @@ Options:
```text
Scatter copies of a small mark (SVG path data around 0,0) inside closed vector shapes (or a polygon), avoiding other shapes, each copy scaled and turned a little (seeded).
- klad scatter art.draw lines --in ground --mark "M0 0 L0 -18" --count 40 --size 0.7-1.2 --turn -15,15
- klad scatter art.draw lines --in rock --mark "M0 0 L6 3 L10 -2" --spacing 22 --avoid moss
+ klad scatter art.klad lines --in ground --mark "M0 0 L0 -18" --count 40 --size 0.7-1.2 --turn -15,15
+ klad scatter art.klad lines --in rock --mark "M0 0 L6 3 L10 -2" --spacing 22 --avoid moss
Also a scatter op: {"op":"scatter","layer":"l3","in":["n5"],"mark":"M0 0 L0 -18","count":40,"size":[0.7,1.2],"turn":[-15,15],"avoid":["n9"]}.
@@ -2023,7 +2023,7 @@ Options:
```text
Build each closed shape out of leaves: leaf marks across the clump take their colour from a round form lit by --light (or a --lamp x,y,height), in a few value steps from --shade through --color to --lit (by default darker and cooler, lighter and warmer than --color), with the most variety in the light; then leaves along the outline, most on the side facing the light and the sky, a few glowing (--glow) at the shadow side's edge, so the silhouette breaks up and the sky shows between them. --mass names a shape around the whole crown, so every clump also turns with the big form. --leaf is the leaf size in px, --density how close the leaves sit. Fill a darker, slightly smaller core under each clump first and paint clumps back to front on one layer. The brush is leaves (several leaf shapes, one per dab).
- klad foliage tree.draw canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown
+ klad foliage tree.klad canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown
Also a foliage op: {"op":"foliage","layer":"canopy","in":["clump1"],"color":"#4d7a3b","light":[-0.6,-0.8],"leaf":16,"mass":"crown"}.
@@ -2109,12 +2109,12 @@ Options:
```text
Bones go on a paint layer or a group (a group's skeleton poses every paint layer in it together). A bone has a name, an optional parent, a head and a tail in canvas px; a child usually starts where its parent ends. Removing a bone removes its children.
- klad bone art.draw body --add hip --head 400,500 --tail 400,420
- klad bone art.draw body --add thigh --parent hip --head 400,500 --tail 410,620
- klad bone art.draw body --rename thigh --as femur
- klad bone art.draw body --move femur --tail 420,630
- klad bone art.draw body --reparent femur --parent pelvis
- klad bone art.draw body --rm femur
+ klad bone art.klad body --add hip --head 400,500 --tail 400,420
+ klad bone art.klad body --add thigh --parent hip --head 400,500 --tail 410,620
+ klad bone art.klad body --rename thigh --as femur
+ klad bone art.klad body --move femur --tail 420,630
+ klad bone art.klad body --reparent femur --parent pelvis
+ klad bone art.klad body --rm femur
Also a bone op: {"op":"bone","layer":"body","add":"thigh","parent":"hip","head":[400,500],"tail":[410,620]}.
@@ -2195,9 +2195,9 @@ Options:
```text
Every bone has a weight map over the rest drawing (a grid at a quarter of the canvas resolution); where weights blend, lines bend smoothly; a part held by one bone at weight 1 moves rigidly. --auto starts from the bones (by distance, blending across the joints). --set paints soft round dabs of a weight onto --bone: 'x,y,radius,weight ...'. --part makes a named part of the drawing (at --frame) fully that bone's (and no other's). --smooth blurs the maps a little. render --overlay weights:<bone> shows a bone's map.
- klad weights art.draw body --auto
- klad weights art.draw body --bone shin --set '400,600,30,1 410,640,20,0.8'
- klad weights art.draw body --bone head --part head
+ klad weights art.klad body --auto
+ klad weights art.klad body --bone shin --set '400,600,30,1 410,640,20,0.8'
+ klad weights art.klad body --bone head --part head
Also a weights op: {"op":"weights","layer":"body","bone":"shin","set":[[400,600,30,1]]}.
@@ -2253,7 +2253,7 @@ Options:
```text
A pose is a turn per bone (degrees from its rest angle, children follow their parent) and a move of the whole (--root). Every paint layer under the skeleton gets a new drawing at --to: each stroke point and fill moves by its bones' weighted blend, the same way Godot's Skeleton2D bends a Polygon2D. The pose is kept on the drawing; posing that frame again re-poses it from the same rest drawing, and posing from a posed drawing starts from its rest drawing. klad inbetween between two poses of one rest drawing turns the bones instead of matching strokes.
- klad pose art.draw body --from 0 --to 4 --bone thigh=25 --bone shin=-40 --root 0,6
+ klad pose art.klad body --from 0 --to 4 --bone thigh=25 --bone shin=-40 --root 0,6
Also a pose op: {"op":"pose","layer":"body","from":0,"to":4,"bones":{"thigh":25,"shin":-40},"root":[0,6]}.
@@ -2303,10 +2303,10 @@ Options:
```text
Keys animate a layer, a group or a vector shape without a drawing per frame: x and y (px), rotate (degrees), sx, sy or scale, and opacity, each with its own keys. Between two keys the value follows the first key's ease: linear, in, out, in-out, step, or a curve x1,y1,x2,y2 (as in CSS). Before the first key and after the last the value holds. A layer or group turns and scales about the canvas centre; a shape about its own pivot. --rm removes the keys at that frame (only the named properties, or all).
- klad key art.draw lantern --frame 0 y=0
- klad key art.draw lantern --frame 12 y=-14 --ease in-out
- klad key art.draw glow --frame 6 opacity=0.4
- klad key art.draw lantern --frame 12 --rm
+ klad key art.klad lantern --frame 0 y=0
+ klad key art.klad lantern --frame 12 y=-14 --ease in-out
+ klad key art.klad glow --frame 6 opacity=0.4
+ klad key art.klad lantern --frame 12 --rm
Also a key op: {"op":"key","id":"lantern","frame":12,"y":-14,"ease":"in-out"}.
@@ -2375,7 +2375,7 @@ Options:
```text
Render the drawing (or read a PNG or JPEG) at the reference's size and compare the two in OKLab: the value range (L at the 5th, 50th and 95th percentile), mean chroma, stroke texture (mean absolute Laplacian of L), edge sharpness (99th percentile of the gradient) and the mean colour difference, with what differs in words (lighter, bluer, busier, softer edges). --region adds a row per named rectangle; --heat writes a picture of where they differ most (black, red, yellow, white as the difference grows to 20).
- klad compare cafe.draw reference.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png
+ klad compare cafe.klad reference.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png
Usage: klad compare [OPTIONS] <DRAWING> <REFERENCE>
@@ -2410,8 +2410,8 @@ Repaint what is below a paint layer (or the layers in --from) with strokes on th
For animation, paint over one key, then carry it to the next with --like <cel>: every stroke moves with the marks under it, takes its colour from the new drawing, and strokes are only added (part "paint over added") where the new drawing needs them. The carried strokes keep their order, so klad inbetween pairs them part by part and nothing boils.
- klad paintover still.draw brushwork --sizes 32,16,8 --threshold 6
- klad paintover walk.draw brushwork --frame 4 --like c12
+ klad paintover still.klad brushwork --sizes 32,16,8 --threshold 6
+ klad paintover walk.klad brushwork --frame 4 --like c12
Also a paintover op, alone in its batch: {"op":"paintover","layer":"brushwork","sizes":[32,16,8],"threshold":6}.
@@ -2500,8 +2500,8 @@ Fill closed shapes with grass blades from the far (top) edge to the near (bottom
With a stroke brush (blade, the default, or any round or chalk tip) each blade is a tapered stroke whose colour runs from --color at the root to the lit colour at the tip when the brush blends to a second colour by pressure. With a picture brush (a tip made of pictures, like your own tufts) each blade is one stamp of the picture, turned to the blade. Build your own brush for your grass (klad brushes --picture, --set) and pass it with --brush: the op decides where the marks go and how they are lit, the brush decides what they look like.
- klad grass meadow.draw field --in field-shape --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22
- klad grass meadow.draw bank --in bank --brush my-tuft --blade 160 --density 0.1
+ klad grass meadow.klad field --in field-shape --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22
+ klad grass meadow.klad bank --in bank --brush my-tuft --blade 160 --density 0.1
Also a grass op: {"op":"grass","layer":"field","in":["field-shape"],"color":"#6f8a3c","blade":30,"far":0.22,"wind":12}.
@@ -2602,9 +2602,9 @@ Options:
```text
List the closed regions of a fill layer's reference (the lines its flood fills fill against) that no fill on the layer covers: pockets a fill missed, or drawings not coloured yet. Regions open to the canvas edge are the outside and do not count. Each pocket prints its bounds and size, and a render of the frame marks them in magenta with a box.
- klad gaps art.draw colour --frame 4
- klad gaps art.draw colour --sheet all
- klad gaps art.draw colour --sheet walk --ref lines --gap 4
+ klad gaps art.klad colour --frame 4
+ klad gaps art.klad colour --sheet all
+ klad gaps art.klad colour --sheet walk --ref lines --gap 4
The reference, gap and tolerance default to those of the layer's flood fills on those frames.
@@ -2690,10 +2690,10 @@ Options:
```text
The document palette, kept in doc.json. Named colours can be used wherever a colour goes (--color skin).
- klad palette art.draw
- klad palette art.draw --add '#f0c8a0' --name skin
- klad palette art.draw --add '#d0a080' --name skin (changes skin)
- klad palette art.draw --rm skin
+ klad palette art.klad
+ klad palette art.klad --add '#f0c8a0' --name skin
+ klad palette art.klad --add '#d0a080' --name skin (changes skin)
+ klad palette art.klad --rm skin
As ops: {"op":"palette","add":"#f0c8a0","name":"skin"}, {"op":"palette","rm":"skin"}, {"op":"palette","set":[{"color":"#1b1b1b","name":"ink"}]}
@@ -2734,17 +2734,17 @@ Options:
```text
Export a transparent PNG of the whole image or one layer or group, at a frame, at any scale from 1/16 to 8 (vectors stay sharp; paint layers are resampled). 8-bit PNGs are dithered from the 16-bit float pixels so gradients do not band; --depth 16 writes 16-bit PNGs. --background keeps the canvas background colour.
- klad export art.draw
- klad export art.draw --scale 2
- klad export art.draw --layer lines --scale 4 --depth 16 -o lines.png
+ klad export art.klad
+ klad export art.klad --scale 2
+ klad export art.klad --layer lines --scale 4 --depth 16 -o lines.png
Animations (each clip, or the whole timeline when there are no clips):
- klad export art.draw --sheet all [--scale 0.5] [--padding 2] [--max 4096]
+ klad export art.klad --sheet all [--scale 0.5] [--padding 2] [--max 4096]
a PNG holding each distinct picture once, trimmed to its pixels (more pages, art-sheet-2.png ..., when it does not fit --max), plus art-sheet.json in Aseprite's array layout: one entry per exposure with its duration in ms, frameTags for clips
- klad export art.draw --sheet run one clip; --sheet 0-11 a range
- klad export art.draw --frames run numbered full-size PNGs, one per frame (run-0000.png ...) in art-run/
- klad export art.draw --godot ../game/art the sheet, art.tres (SpriteFrames: one animation per clip with its fps, loop and per-frame durations) and art.tscn (an AnimatedSprite2D placed so the timeline's origin sits on the node's position). The first folder given is kept in the document (export.godot); later exports and the editor's button write there, and Godot uids are kept so scenes using them keep working. --store replaces a kept folder.
+ klad export art.klad --sheet run one clip; --sheet 0-11 a range
+ klad export art.klad --frames run numbered full-size PNGs, one per frame (run-0000.png ...) in art-run/
+ klad export art.klad --godot ../game/art the sheet, art.tres (SpriteFrames: one animation per clip with its fps, loop and per-frame durations) and art.tscn (an AnimatedSprite2D placed so the timeline's origin sits on the node's position). The first folder given is kept in the document (export.godot); later exports and the editor's button write there, and Godot uids are kept so scenes using them keep working. --store replaces a kept folder.
Usage: klad export [OPTIONS] <BUNDLE>
@@ -2817,8 +2817,8 @@ Options:
List brushes: the built-in library, and with a bundle the brushes it embeds (a document keeps every brush it uses in brushes/<id>.json, so it renders the same when the library changes).
klad brushes
- klad brushes art.draw
- klad brushes art.draw --show ink
+ klad brushes art.klad
+ klad brushes art.klad --show ink
Usage: klad brushes [OPTIONS] [BUNDLE]
diff --git a/docs/format.md b/docs/format.md
index cdeb949..b84ca56 100644
--- a/docs/format.md
+++ b/docs/format.md
@@ -1,8 +1,8 @@
-_Last updated: 2026-11-06 (format `draw-anything/9`, stroke files version 6, brushes `draw-anything-brush/1`)_
+_Last updated: 2026-11-06 (format `klad/1`, stroke files `KLST` version 1, brushes `klad-brush/1`)_
# The klad drawing format
-A klad drawing is a folder whose name ends in `.draw`, called a bundle. This document describes everything in it, so that any program can read, write and make klad drawings. It is licensed under the MIT License (`LICENSE-MIT`), unlike klad itself.
+A klad drawing is a folder whose name ends in `.klad`, called a bundle. This document describes everything in it, so that any program can read, write and make klad drawings. It is licensed under the MIT License (`LICENSE-MIT`), unlike klad itself.
klad is the reference: when this text and klad's renders disagree, klad is right and this text is wrong. The data is exact (every key, every byte); how pixels come out of it is described as far as a reader needs to draw a faithful approximation, not to match klad's renders bit for bit.
@@ -30,13 +30,13 @@ Writers replace files atomically (write a temporary file, then rename), so a rea
- **Colours** are `"#rrggbb"` or `"#rrggbbaa"`: sRGB, straight (not premultiplied) alpha.
- **Ids** are unique across the whole document and use letters, digits, `-` and `_`. klad makes new ones from a prefix (`l` layer, `c` cel, `n` node) and `nextId`. Ids are case sensitive.
- **JSON** is UTF-8, written pretty with a stable key order. Keys at their default value are left out; readers must take the defaults listed below for missing keys. Most objects reject keys they do not know, so writers must not add their own.
-- **Versions.** `format` names the version of `doc.json` and everything it implies. klad opens every older version and migrates it in memory (written back on the next change). A reader that meets a newer version than it knows should refuse to write the bundle.
+- **Versions.** `format` names the version of `doc.json` and everything it implies; this is `klad/1`, the first. Later versions will open older `klad/` drawings and migrate them in memory (written back on the next change). A reader that meets a newer version than it knows should refuse to write the bundle. Drawings from before `klad/1` (`.draw` folders, formats `draw-anything/0` to `/9`) do not open.
## doc.json
```json
{
- "format": "draw-anything/9",
+ "format": "klad/1",
"rev": 42,
"canvas": { "width": 2048, "height": 2048, "background": "#f4efe6" },
"timeline": { "fps": 12, "frames": 24, "origin": [1024, 1800],
@@ -60,7 +60,7 @@ Writers replace files atomically (write a temporary file, then rename), so a rea
| Key | Type | Default | Meaning |
|---|---|---|---|
-| `format` | string | | `"draw-anything/9"` |
+| `format` | string | | `"klad/1"` |
| `rev` | integer | | grows by one on every write |
| `canvas` | object | | `width`, `height` (px), `background` (a colour; none is transparent) |
| `timeline` | object | 12 fps, 1 frame | see below |
@@ -219,10 +219,10 @@ The file is one zstd frame (any level; klad uses 3). Inside:
| Bytes | What |
|---|---|
-| 4 | `DAST` |
-| 1 | the version, 6 now (klad reads 1 to 6) |
+| 4 | `KLST` |
+| 1 | the version: 1 |
| varint | the number of marks |
-| ... | each mark: a kind byte (0 stroke, 1 fill; from version 4, before that every mark is a stroke), then its record |
+| ... | each mark: a kind byte (0 stroke, 1 fill), then its record |
There must be nothing after the last mark.
@@ -240,10 +240,10 @@ Numbers: a **varint** is an unsigned LEB128 integer (7 bits per byte, low bits f
| flow | f32 | 0 to 1 |
| seed | u32 | the seed of the brush's randomness, so a stroke replays the same |
| channels | u8 | bits: 1 tilt, 2 time, 4 taper, 8 lock alpha, 16 cuts, 32 second colour |
-| author | u8 | 0 a person, 1 an agent (from version 2) |
-| taper | 2 f32 | if bit 4: px over which the start and end thin to a point, whatever the pressure (from version 3) |
-| cuts | cuts | if bit 16 (from version 5) |
-| second colour | colour | if bit 32: for brushes whose colour moves between two (from version 6) |
+| author | u8 | 0 a person, 1 an agent |
+| taper | 2 f32 | if bit 4: px over which the start and end thin to a point, whatever the pressure |
+| cuts | cuts | if bit 16 |
+| second colour | colour | if bit 32: for brushes whose colour moves between two |
| samples | varint | n, the number of samples |
| x, y | 2 columns | position in 1/16 px |
| pressure | column | 0 to 4095 |
@@ -260,7 +260,7 @@ A **column** is n signed varints, each the difference from the previous value (t
| colour | colour | |
| opacity | f32 | |
| author | u8 | 0 a person, 1 an agent |
-| source | u8 | low bits: 0 a flood fill, 1 a polygon; bit `0x80` lock alpha, bit `0x40` cuts (from version 5) |
+| source | u8 | low bits: 0 a flood fill, 1 a polygon; bit `0x80` lock alpha, bit `0x40` cuts |
| flood fill | f32 x, f32 y, u8 reference, 3 f32 | the seed point; what it filled from: 0 this layer, 1 everything visible, 2 a layer (then a string, its id); `tolerance`, `gap`, `expand` |
| polygon | varint n, n pairs of f32 | the polygon's points |
| coverage | see below | the pixels the fill covered when it was made |
@@ -278,7 +278,7 @@ When a lasso cuts across a mark, the mark is not split into new geometry: each p
| Key | Meaning |
|---|---|
-| `format` | `"draw-anything-brush/1"` |
+| `format` | `"klad-brush/1"` |
| `name` | |
| `tip` | `{"round": {"hardness": h}}`, `{"chalk": {"seed": n}}` or `{"image": {"image": name, "more": [names]}}` (several pictures take turns) |
| `spacing` | distance between dabs, as a share of the size |
@@ -319,14 +319,4 @@ Drawing a stroke: walk the samples, interpolate between them, stamp the tip ever
| Format | Change |
|---|---|
-| 0, 1 | the first versions: brushes were not embedded (klad embeds the brushes of that time when it opens one) |
-| 2 | every brush a stroke uses is embedded in `brushes/` |
-| 3 | `palette`; paint drawings may hold fills (stroke files version 4) |
-| 4 | `mask`, `clip`, `lockAlpha`; stroke files version 5 (lock and cuts) |
-| 5 | a clip's `fps`, `timeline.origin`, `export.godot` |
-| 6 | a cel's `tween` |
-| 7 | a cel's `parts`, a tween's `unpaired` |
-| 8 | `effects`; adjustment layers, `depth`, `atmosphere`, `reference` and the `image`, `text`, `rays`, `scatter`, `repeat` and `mirror` nodes came while the format was 8 |
-| 9 | `bones` on layers, `pose` on cels, `keys`, weights files |
-
-klad migrates any older bundle on open.
+| `klad/1` | the first `.klad` format (2026-11). Drawings from before it, `.draw` folders in formats `draw-anything/0` to `/9` with stroke files marked `DAST`, do not open. |
diff --git a/docs/skill/SKILL.md b/docs/skill/SKILL.md
index 8dcd3df..efe7ba1 100644
--- a/docs/skill/SKILL.md
+++ b/docs/skill/SKILL.md
@@ -1,18 +1,18 @@
---
name: klad
license: MIT (LICENSE-MIT in the klad repository)
-description: Make and edit 2D art with the klad CLI (`klad`) in a `.draw` bundle that the user can open in the editor at the same time. Use for any drawing, illustration, game asset, icon, background or sprite work in klad, for reading what the user drew or asked for (strokes, selection, pinned notes), and for scripting art generators that emit `klad apply` ops.
+description: Make and edit 2D art with the klad CLI (`klad`) in a `.klad` bundle that the user can open in the editor at the same time. Use for any drawing, illustration, game asset, icon, background or sprite work in klad, for reading what the user drew or asked for (strokes, selection, pinned notes), and for scripting art generators that emit `klad apply` ops.
---
# klad
-A `.draw` bundle is a folder: `doc.json` (layers, cels, vector nodes, palette), `strokes/<layer>/<cel>.strokes` (paint strokes and fills as data), `brushes/<id>.json` (every brush its strokes use) and `.cache/` (renders, history, notes, tiles). The `klad` CLI edits it; the user edits the same bundle in the editor (`klad open`, or the klad app). Both see each other's changes within a second. The user starts and opens drawings from the editor's start window (cmd N, cmd O, recent) and can copy a drawing's path from the document menu at the bottom of the tool strip to hand it to you. To start one yourself: `klad new art.draw --width 1600 --height 1200 --background '#e9e4da' --sketch` (one paint layer, `l1`, and a vector layer named sketch on top, `l3`). If `klad` is not on the path, the user can run "install the klad command" from that menu (or `klad install` from the folder they unpacked); `klad skill` prints these instructions, matching the version installed.
+A `.klad` bundle is a folder: `doc.json` (layers, cels, vector nodes, palette), `strokes/<layer>/<cel>.strokes` (paint strokes and fills as data), `brushes/<id>.json` (every brush its strokes use) and `.cache/` (renders, history, notes, tiles). The `klad` CLI edits it; the user edits the same bundle in the editor (`klad open`, or the klad app). Both see each other's changes within a second. The user starts and opens drawings from the editor's start window (cmd N, cmd O, recent) and can copy a drawing's path from the document menu at the bottom of the tool strip to hand it to you. To start one yourself: `klad new art.klad --width 1600 --height 1200 --background '#e9e4da' --sketch` (one paint layer, `l1`, and a vector layer named sketch on top, `l3`). If `klad` is not on the path, the user can run "install the klad command" from that menu (or `klad install` from the folder they unpacked); `klad skill` prints these instructions, matching the version installed.
Working on klad itself: the repository's `CLAUDE.md`, `CONTRIBUTING.md` and `docs/DESIGN.md` are the source of truth. Build the CLI with `just build`; the binary is `target/release/klad` on macOS and `target/linux/release/klad` on Linux.
## The loop
-1. Look: `klad ls art.draw` (tree, top layer first, ids and bounds) and `klad render art.draw --scale 0.5 --overlay ids,bbox`. Read the PNG it prints.
+1. Look: `klad ls art.klad` (tree, top layer first, ids and bounds) and `klad render art.klad --scale 0.5 --overlay ids,bbox`. Read the PNG it prints.
2. Change: `klad add`, `klad set`, `klad rm`, `klad mv`, `klad stroke`, `klad fill`, `klad transform`, `klad lasso`, `klad path`, `klad palette`, or many at once with `klad apply` (JSON lines, one transaction).
3. Check: add `--render` (preview, longest side 1024) and `--overlay ids,bbox` to the edit, or `klad diff` (before and after, side by side), or `klad render --focus <id>` for a close-up.
4. Undo freely: `klad undo`, `klad redo`, `klad log`. History is shared with the editor.
@@ -21,18 +21,18 @@ Keep renders small unless detail matters: `--scale 0.5` or `--focus <id>` costs
## What the user wants
-- `klad notes art.draw`: notes the user pinned on the canvas, each with a `--region` render command. Do the work, then `klad notes art.draw --done <id>`; the editor shows the pin as done at once and lists it under done in the Notes pane, so mark a note done only when it is.
-- `klad selection art.draw`: the layer, shapes, path and strokes the user selected in the editor (strokes as `<cel>:s<id>`), with bounds and a `--focus` command.
-- `klad strokes art.draw <layer> --json`: the user's strokes with points and pressure, to trace their shapes (a ridge line and tree positions from a pen sketch, for example).
+- `klad notes art.klad`: notes the user pinned on the canvas, each with a `--region` render command. Do the work, then `klad notes art.klad --done <id>`; the editor shows the pin as done at once and lists it under done in the Notes pane, so mark a note done only when it is.
+- `klad selection art.klad`: the layer, shapes, path and strokes the user selected in the editor (strokes as `<cel>:s<id>`), with bounds and a `--focus` command.
+- `klad strokes art.klad <layer> --json`: the user's strokes with points and pressure, to trace their shapes (a ridge line and tree positions from a pen sketch, for example).
## Vector nodes
Layers: `paint` (strokes), `vector` (nodes), `group` (children). Add a vector layer, then nodes into it:
```
-klad add art.draw layer vector name=sky
-klad add art.draw rect --in l1 x=0 y=0 w=2048 h=900 'fill={"linear":{"from":[0,0],"to":[0,900],"stops":[[0,"#20304f"],[1,"#d98b5f"]]}}'
-klad set art.draw n3 transform.rotate=-8 opacity=0.8 blur=4
+klad add art.klad layer vector name=sky
+klad add art.klad rect --in l1 x=0 y=0 w=2048 h=900 'fill={"linear":{"from":[0,0],"to":[0,900],"stops":[[0,"#20304f"],[1,"#d98b5f"]]}}'
+klad set art.klad n3 transform.rotate=-8 opacity=0.8 blur=4
```
- Types: `rect` (x, y, w, h, radius), `ellipse` (cx, cy, rx, ry), `path` (SVG `d`), `group` (children).
@@ -45,13 +45,13 @@ klad set art.draw n3 transform.rotate=-8 opacity=0.8 blur=4
## Painting
```
-klad stroke art.draw l4 --brush ink --size 14 --color '#1b1b1b' --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05
-klad stroke art.draw l4 --brush ink --size 5 --taper 8,20 --path 'M100 100 L140 220'
+klad stroke art.klad l4 --brush ink --size 14 --color '#1b1b1b' --path 'M100 400 C 300 200 500 600 700 400' --pressure 0.1,1,0.05
+klad stroke art.klad l4 --brush ink --size 5 --taper 8,20 --path 'M100 100 L140 220'
```
-- `klad brushes art.draw` lists the brushes: the ones the bundle embeds and the library (`ink` inking pen, `pencil`, `marker`, `airbrush`, `soft`, `chalk`, `eraser`, and for painting `flat-bristle`, `round-bristle`, `sponge`, `fog`, `leaves`, `grass`, `splatter`, `wet`, `smudge`, `blender`, `dry-brush`, `two-tone`); the tip column says `+dual`, `+texture`, `+colour`, `+wet`, `+smudge`, `+blend` or `+body`. `--show <id>` prints one as JSON. A bundle keeps every brush it uses, so `ink` in an older bundle can be the older ink; `--brush` takes any id from that list.
+- `klad brushes art.klad` lists the brushes: the ones the bundle embeds and the library (`ink` inking pen, `pencil`, `marker`, `airbrush`, `soft`, `chalk`, `eraser`, and for painting `flat-bristle`, `round-bristle`, `sponge`, `fog`, `leaves`, `grass`, `splatter`, `wet`, `smudge`, `blender`, `dry-brush`, `two-tone`); the tip column says `+dual`, `+texture`, `+colour`, `+wet`, `+smudge`, `+blend` or `+body`. `--show <id>` prints one as JSON. A bundle keeps every brush it uses, so `ink` in an older bundle can be the older ink; `--brush` takes any id from that list.
- Painting brushes: `wet` picks up the colour under it and mixes it in, `smudge` pulls paint along, `blender` softens what it crosses; all three read only the layer they paint on (paint the colours to mix on one layer). `leaves`, `grass` and `splatter` scatter their picture tips with jittered colour (`leaves` picks one of several leaf shapes per dab: `leaf`, `leaf-oval`, `leaf-lance`, `leaf-twig`; a tip takes more pictures as `{"image":{"image":"leaf","more":["leaf-oval","leaf-lobed"]}}`); `two-tone` paints `--second` at a light press and `--color` at a full one. `--second '#e0a040'` (`"second"` in `apply`) is the second colour for brushes with colour dynamics.
-- New brushes: write the JSON (copy one from `--show`; keys `tip` (`round`, `chalk` or `{"image":{"image":"name"}}`), `dual`, `grain` (`paper` or `image`, `strength`, `scale`, `contrast`, `pressure`), `color` (`hue`, `saturation`, `value`, `strokeHue`, ..., `pressure`, `along`), `paint` (`wet`, `smudge`, `blend`)) and `klad brushes art.draw --set my-oil brush.json` (`-` reads stdin). Pictures for tips and textures: `klad brushes art.draw --picture bark bark.png` (dark is paint, or the alpha). Ids and pictures are fixed once in the bundle, since strokes keep their brush.
+- New brushes: write the JSON (copy one from `--show`; keys `tip` (`round`, `chalk` or `{"image":{"image":"name"}}`), `dual`, `grain` (`paper` or `image`, `strength`, `scale`, `contrast`, `pressure`), `color` (`hue`, `saturation`, `value`, `strokeHue`, ..., `pressure`, `along`), `paint` (`wet`, `smudge`, `blend`)) and `klad brushes art.klad --set my-oil brush.json` (`-` reads stdin). Pictures for tips and textures: `klad brushes art.klad --picture bark bark.png` (dark is paint, or the alpha). Ids and pictures are fixed once in the bundle, since strokes keep their brush.
- `--taper in,out` thins the first and last px of the line to a point whatever the pressure; without it the brush's taper applies (`ink` is `10,24`), `--taper 0,0` gives round ends. Short hatching wants about `8,20`, long contours `30,80`.
- `--pressure` spreads values evenly along the stroke; several subpaths in `--path` make several strokes. `--points 'x,y,p x,y,p'` gives explicit samples.
- In `apply`: `{"op":"stroke","layer":"l4","brush":"ink","size":14,"color":"#1b1b1b","path":"M...","pressure":[0.1,1,0.05],"taper":[12,30]}`.
@@ -59,19 +59,19 @@ klad stroke art.draw l4 --brush ink --size 5 --taper 8,20 --path 'M100 100 L140
## Editing strokes and fills
-Every stroke and fill has an address `<cel>:s<id>` (fills share the id counter with strokes). `klad strokes art.draw <layer>` lists them with the cel id on top.
+Every stroke and fill has an address `<cel>:s<id>` (fills share the id counter with strokes). `klad strokes art.klad <layer>` lists them with the cel id on top.
```
-klad set art.draw c4:s12 color=#c84a3a size=6 brush=pencil
-klad set art.draw c4:s7 color=skin opacity=0.8
-klad rm art.draw c4:s12 c4:s13
-klad transform art.draw c4:s3 c4:s5 --move 40,-10 --rotate 15 --scale 1.2
-klad show art.draw c4:s12
-klad render art.draw --focus c4:s12
+klad set art.klad c4:s12 color=#c84a3a size=6 brush=pencil
+klad set art.klad c4:s7 color=skin opacity=0.8
+klad rm art.klad c4:s12 c4:s13
+klad transform art.klad c4:s3 c4:s5 --move 40,-10 --rotate 15 --scale 1.2
+klad show art.klad c4:s12
+klad render art.klad --focus c4:s12
```
- Strokes take `color`, `size`, `opacity`, `flow`, `brush`, `taper` (`[in,out]` or `null`) and `path`; fills take `color` and `opacity`. The stroke keeps its path, pressure and seed, so a recoloured stroke is the same mark in a new colour.
-- Bending a stroke: `klad strokes --json` gives each stroke a fitted `path` (a few points); edit it and `klad reshape art.draw c4:s12 --path 'M...'` (or `set` with `path`). Every sample keeps its pressure, tilt and timing at the same fraction of the length, so the line keeps its weight and taper. The user does the same with A in the editor.
+- Bending a stroke: `klad strokes --json` gives each stroke a fitted `path` (a few points); edit it and `klad reshape art.klad c4:s12 --path 'M...'` (or `set` with `path`). Every sample keeps its pressure, tilt and timing at the same fraction of the length, so the line keeps its weight and taper. The user does the same with A in the editor.
- `transform` moves, rotates (degrees, clockwise) and scales about `--pivot` (default: the middle of the marks' bounds). Stroke sizes and tapers scale with them; fills move by whole pixels and are resampled when turned or scaled. Ids in several cels need a `--pivot`.
- In `apply`: `{"op":"set","id":"c4:s12","color":"#c84a3a"}`, `{"op":"rm","ids":["c4:s12"]}`, `{"op":"transform","ids":["c4:s3","c4:s5"],"x":40,"y":-10,"rotate":15,"sx":1.2,"sy":1.2}`.
- Edits redraw only the tiles the marks touch, from the nearest checkpoint, so they are cheap on large cels.
@@ -79,11 +79,11 @@ klad render art.draw --focus c4:s12
## Lasso
```
-klad lasso art.draw l4 --polygon '600,600 1400,560 1450,1300 640,1380'
-klad lasso art.draw l4 --polygon '600,600 1400,560 1450,1300 640,1380' --cut --move 40,-25
-klad lasso art.draw l4 --polygon '...' --cut --rotate 12 --scale 1.1
-klad lasso art.draw l4 --polygon '...' --flip h
-klad lasso art.draw l4 --polygon '...' --cut --rm
+klad lasso art.klad l4 --polygon '600,600 1400,560 1450,1300 640,1380'
+klad lasso art.klad l4 --polygon '600,600 1400,560 1450,1300 640,1380' --cut --move 40,-25
+klad lasso art.klad l4 --polygon '...' --cut --rotate 12 --scale 1.1
+klad lasso art.klad l4 --polygon '...' --flip h
+klad lasso art.klad l4 --polygon '...' --cut --rm
```
- Without a move, turn, scale, flip or `--rm` it lists the strokes and fills inside the polygon and those crossing its edge.
@@ -94,28 +94,28 @@ klad lasso art.draw l4 --polygon '...' --cut --rm
## Masks, clipping and lock alpha
```
-klad set art.draw l5 clip=true blend=multiply
-klad set art.draw l3 lockAlpha=true
-klad add art.draw mask --in l5
-klad stroke art.draw l9 --brush airbrush --size 180 --path 'M600 600 L 640 700'
-klad set art.draw l9 visible=false
-klad rm art.draw l9
+klad set art.klad l5 clip=true blend=multiply
+klad set art.klad l3 lockAlpha=true
+klad add art.klad mask --in l5
+klad stroke art.klad l9 --brush airbrush --size 180 --path 'M600 600 L 640 700'
+klad set art.klad l9 visible=false
+klad rm art.klad l9
```
- `clip=true` shows a layer only where the nearest unclipped layer below it (its base) has paint. Clipped layers blend onto the base with their own blend; the group takes the base's opacity and blend. This is how shading stays inside flat colour: flats on one layer, a multiply shade layer and a rim light layer above it, both clipped.
-- `klad add art.draw mask --in <layer>` gives a layer a mask and prints its id. The mask is a paint layer of its own (`klad ls` shows it under its layer): strokes and fills on it hide the layer, the eraser brings it back, an empty mask hides nothing. `hide=true` starts it hiding everything. `visible=false` on the mask turns it off; `klad rm` on its id removes it.
+- `klad add art.klad mask --in <layer>` gives a layer a mask and prints its id. The mask is a paint layer of its own (`klad ls` shows it under its layer): strokes and fills on it hide the layer, the eraser brings it back, an empty mask hides nothing. `hide=true` starts it hiding everything. `visible=false` on the mask turns it off; `klad rm` on its id removes it.
- `lockAlpha=true` on a paint layer: new strokes and fills only land where the layer already has paint, which recolours line art (a big soft stroke over lines tints only the lines). It is recorded per stroke, so set it back to false when done, or the user's next pen strokes on that layer only land on existing paint. The eraser does nothing on a lock-alpha layer.
- In `apply`: `{"op":"add","mask":{"name":"light"},"in":"l5"}`, `{"op":"set","id":"l5","clip":true}`.
## Light, effects and adjustments
```
-klad effect art.draw l3 glow radius=24 color=#ffd080
-klad effect art.draw l3 outline width=4 color=#101418
-klad effect art.draw l3 # lists them; --rm 1 removes the second, --clear all
-klad add art.draw layer adjust curves 'points=[[0,0],[0.5,0.3],[1,0.85]]' 'blue=[[0,0.12],[1,1]]' name=dusk
-klad add art.draw rays --in l7 x=430 y=0 angle=95 spread=40 count=9 length=600 start=120 fill=#fff0c0c0 blur=6
-klad set art.draw l5 blend=soft-light
+klad effect art.klad l3 glow radius=24 color=#ffd080
+klad effect art.klad l3 outline width=4 color=#101418
+klad effect art.klad l3 # lists them; --rm 1 removes the second, --clear all
+klad add art.klad layer adjust curves 'points=[[0,0],[0.5,0.3],[1,0.85]]' 'blue=[[0,0.12],[1,1]]' name=dusk
+klad add art.klad rays --in l7 x=430 y=0 angle=95 spread=40 count=9 length=600 start=120 fill=#fff0c0c0 blur=6
+klad set art.klad l5 blend=soft-light
```
- Effects are settings on a layer (or group), applied in order when it composes and always editable: `blur` (radius), `glow` (radius, strength, threshold: 0 glows from every pixel, about 0.7 only from the bright ones, as bloom; color tints it; blend: screen by default, add for hard light, normal lays it like paint), `outline` (width, color, inside=true), `shadow` (x, y, radius, color with alpha), `noise` (amount, size, seed, mono=false for coloured grain), `displace` (amount, size, seed; by=<layer> pushes with that layer's red across and green down, grey stays put; a hidden layer works as the map), `relief` (strength, light=x,y as in `paint --light`, highlight, shade, softness: lights the paint's thickness, so ridges and stroke edges facing the light catch it and the others darken; only strokes from brushes with `body` have thickness). In `apply` or `set`: `effects=[{"glow":{"radius":24}},{"outline":{"width":3}}]`.
@@ -128,20 +128,20 @@ klad set art.draw l5 blend=soft-light
## Depth, pictures, generators and text
```
-klad set art.draw g2 depth=2.5 a plane (a layer at the top of the stack): 0 is near
-klad atmosphere art.draw color=#8fa3b8 top=#d3dde7 density=0.55 blur=1.2 desaturate=0.25
-klad add art.draw layer image src=photo.jpg reference=true
-klad add art.draw repeat --in l4 count=8 'step=[60,0]' 'children=[{"type":"rect","x":0,"y":400,"w":12,"h":80,"fill":"#3a2a1a"}]'
-klad add art.draw scatter --in l4 x=0 y=700 w=1600 h=150 count=40 seed=7 'size=[0.6,1.6]' 'turn=[-30,30]' 'children=[{"type":"ellipse","cx":0,"cy":0,"rx":20,"ry":11,"fill":"#3a4450"}]'
-klad add art.draw mirror --in l4 x=800 angle=90 'children=[{"type":"path","d":"M560 900 L560 560 L760 410 Z","fill":"#0d1117"}]'
+klad set art.klad g2 depth=2.5 a plane (a layer at the top of the stack): 0 is near
+klad atmosphere art.klad color=#8fa3b8 top=#d3dde7 density=0.55 blur=1.2 desaturate=0.25
+klad add art.klad layer image src=photo.jpg reference=true
+klad add art.klad repeat --in l4 count=8 'step=[60,0]' 'children=[{"type":"rect","x":0,"y":400,"w":12,"h":80,"fill":"#3a2a1a"}]'
+klad add art.klad scatter --in l4 x=0 y=700 w=1600 h=150 count=40 seed=7 'size=[0.6,1.6]' 'turn=[-30,30]' 'children=[{"type":"ellipse","cx":0,"cy":0,"rx":20,"ry":11,"fill":"#3a4450"}]'
+klad add art.klad mirror --in l4 x=800 angle=90 'children=[{"type":"path","d":"M560 900 L560 560 L760 410 Z","fill":"#0d1117"}]'
klad fonts the fonts that come with klad, by group, with their styles
klad fonts --search slab every open font on Google Fonts that matches; --get <family> downloads one
-klad add art.draw text --in l4 'text=THE CROOKED INN' 'font=Cinzel Bold' size=46 x=340 y=96 align=center tracking=4 fill=#f3d9a4
-klad set art.draw t3 'font=Pirata One'
-klad font art.draw ~/fonts/Signage.ttf a font file of your own
+klad add art.klad text --in l4 'text=THE CROOKED INN' 'font=Cinzel Bold' size=46 x=340 y=96 align=center tracking=4 fill=#f3d9a4
+klad set art.klad t3 'font=Pirata One'
+klad font art.klad ~/fonts/Signage.ttf a font file of your own
```
-- Depth: give each top-level group (plane) a `depth`; with an atmosphere every plane fades towards the fog (and the `top` colour higher up), blurs and loses colour, more the deeper it is. Near planes keep depth 0. The user previews the parallax by holding D. `haze` is also an effect of its own (`klad effect art.draw l3 haze amount=0.4 color=#9aa8b8`).
+- Depth: give each top-level group (plane) a `depth`; with an atmosphere every plane fades towards the fog (and the `top` colour higher up), blurs and loses colour, more the deeper it is. Near planes keep depth 0. The user previews the parallax by holding D. `haze` is also an effect of its own (`klad effect art.klad l3 haze amount=0.4 color=#9aa8b8`).
- References: `reference=true` on any layer keeps it visible in the editor but out of `klad render`, `klad hash` and `klad export` (add `--references` to see it). Pictures to trace over go there.
- Pictures: `layer image src=<PNG or JPEG>` copies the file into the bundle (`images/<hash>.png`) and places it on a new vector layer, fitted inside the canvas; `x=`, `y=`, `w=`, `h=` place it. The node is `{"type":"image",...}`, moved and scaled like any shape.
- Generators keep their settings: `repeat` (count, step, turn and pivot for an arc, scale, columns and row for a grid), `scatter` (region x, y, w, h, count, seed, size and turn ranges, `avoid`: SVG paths no copy lands in), `mirror` (x, y, angle of the axis). Children are drawn once per copy; for scatter draw the child around 0,0. `klad add <bundle> <shape> --in <generator id>` adds more children.
@@ -151,13 +151,13 @@ klad font art.draw ~/fonts/Signage.ttf a font file of your own
## Path points
```
-klad path art.draw n7
-klad path art.draw n7 --move 3 412,230
-klad path art.draw n7 --nudge 3,4,5 0,-20
-klad path art.draw n7 --handle 3 out 430,210
-klad path art.draw n7 --add 418,236
-klad path art.draw n7 --rm 4,5 --corner 2 --smooth 6
-klad path art.draw n7 --simplify 1.5
+klad path art.klad n7
+klad path art.klad n7 --move 3 412,230
+klad path art.klad n7 --nudge 3,4,5 0,-20
+klad path art.klad n7 --handle 3 out 430,210
+klad path art.klad n7 --add 418,236
+klad path art.klad n7 --rm 4,5 --corner 2 --smooth 6
+klad path art.klad n7 --simplify 1.5
```
- Without flags it lists the points (anchors) of a path, rect or ellipse, numbered across subpaths, with handles and corner/smooth/curve. Coordinates are the shape's own (as in its `d`, before its transform). After an edit it lists them again; numbers shift after inserts and removals.
@@ -168,13 +168,13 @@ klad path art.draw n7 --simplify 1.5
## Colour and fills
```
-klad palette art.draw --add '#f0c8a0' --name skin
-klad fill art.draw l2 --at 820,640 --ref lines --gap 4 --color skin
-klad fill art.draw l2 --polygon '100,100 400,120 260,380' --color '#20304a'
-klad refill art.draw l2
+klad palette art.klad --add '#f0c8a0' --name skin
+klad fill art.klad l2 --at 820,640 --ref lines --gap 4 --color skin
+klad fill art.klad l2 --polygon '100,100 400,120 260,380' --color '#20304a'
+klad refill art.klad l2
```
-- The palette lives in `doc.json`. Any colour argument takes `#rrggbb`, `#rrggbbaa` or a palette name. `klad palette art.draw` lists it; `--add` with an existing `--name` changes that colour; `--rm` takes a name, a colour or an index.
+- The palette lives in `doc.json`. Any colour argument takes `#rrggbb`, `#rrggbbaa` or a palette name. `klad palette art.klad` lists it; `--add` with an existing `--name` changes that colour; `--rm` takes a name, a colour or an index.
- A flood fill starts at `--at` and spreads over pixels within `--tolerance` (0 to 1, default 0.1) of the seed pixel in the reference: `this` layer (default), `all` (everything visible, background included) or a layer id or name. Put flat colour on a layer under the lines and use `--ref <lines layer>`; a fill on the line layer itself covers the inside edge of the lines.
- `--gap` closes openings in the lines up to that many px wide (inked shapes with small gaps); `--expand` (default 2) tucks the fill under the lines so no paper shows between line and colour.
- Fills are records next to the strokes, with their coverage stored, so they render the same later. When the lines change, `klad refill <bundle> <layer>` recomputes every flood fill of that cel (`--id` for one).
@@ -185,29 +185,29 @@ klad refill art.draw l2
Describe a piece instead of programming it: block the subject in as vector shapes on a hidden sketch layer (rects, ellipses, paths, groups; give them ids so later ops can name them), then let these commands draw on paint layers. Everything they make is ordinary strokes and fills, so `klad set`, `klad transform` and the user's pen edit it afterwards.
```bash
-klad add art.draw layer vector name=sketch visible=false
+klad add art.klad layer vector name=sketch visible=false
echo '{"op":"add","node":{"id":"body","type":"ellipse","cx":400,"cy":420,"rx":160,"ry":120},"in":"<sketch id>","frame":0}
-{"op":"add","node":{"id":"eye","type":"ellipse","cx":450,"cy":380,"rx":18,"ry":18},"in":"<sketch id>","frame":0}' | klad apply art.draw
-klad fill art.draw flats --shape body --color skin # exactly the shape's area, grown 2 px under the ink
-klad light art.draw --from body --light -1,-1 --shade shade --rim rim --depth 20 # shade away from the light, a rim towards it
-klad ink art.draw lines --from body,eye --weight 7 --light -1,-1 # tapered strokes, weight from rules
-klad hatch art.draw shade --in body --angle 30 --spacing 8 --length 10-24 --color shadow
-klad scatter art.draw lines --in ground --mark "M0 0 Q 3 -22 8 -40" --count 20 --turn -25,25
-klad paint art.draw paint --in body --color skin --light -1,-1 --weight 12 # a round form, painted from a light model
-klad paint art.draw paint --in pillar --form cylinder --axis 90 --lamp 200,600,150 --color '#c9b8a0'
-klad foliage art.draw canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown # a clump built from lit leaves
-klad grass art.draw field --in field --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22 --wind 12 # blades lit by rolling ground
-klad prepare art.draw # buffer every drawing before the user opens it
-```
-
-- Painting a form: after the flats, `klad paint` paints each shape as a form. `--form round` (default) bulges any closed shape like a pillow, its height growing with the distance to the outline; `flat` is a plane facing `--facing x,y,z` (z toward the viewer, y down); `cylinder` is round across `--axis` degrees. The light model is a key light from `--light x,y` at `--elevation` (or `--lamp x,y,height` in canvas px: the shape nearest the lamp gets the full key light, farther ones less by inverse square, so paint a cluster in one op), cool fill from above (`--fill`, `--fill-strength`), warm bounce from below (`--bounce`, `--bounce-strength`) and a darker core just past the terminator (`--core`); `--color` is the local colour in full light, so the lit side comes out at that colour and the shadow side about four value steps under it. The lights multiply the local colour, so a warm colour goes darker and browner in shadow; `--shadow <colour>` (`"shadow"` in `apply`) turns the side out of the key light towards that colour's hue and chroma while keeping the values the model gives it, by `--shadow-mix` (default 0.7) and less in the halftones, with the chroma lowered in the darkest parts. A cool lavender or blue grey keeps shadows from going brown or grey; raise `--fill-strength` (0.3 or so) for lighter shadow sides. Every colour option of `paint` takes palette names. Strokes follow the form (along bands of equal light on round forms, along the axis on cylinders, at `--angle` on planes), take their colour from the model where they lie and stop where the light changes, so none carries the lit colour into the shadow. Thick paint: `oil` and `oil-load` have `body` (a brush key, 0 to 1), so their strokes lay paint height: flat in the middle with bristle grooves, lips at the sides, thinner at light pressure, taller for bigger brushes; new paint pushes most of the wet paint under it aside, so it builds up only a little where strokes cross. `smudge` and `wet` drag it, `blender` flattens it, the eraser takes it. It shows only through a `relief` effect on the layer (`klad effect art.draw <layer> relief strength=4 softness=3.5 light=-1,-1`): strength about 4 to 5 for fruit or a figure, 1 to 2 for a table or a wall; softness about a fifth of the stroke size (3 to 4.5 for strokes of 15 to 20 px). Below 1, a surface built from many small strokes shows every stroke's ridges and reads as wrinkled leather, not paint. Without the effect body changes no pixel. Passes go from twice `--weight` down to half of it (the small ones only where the form turns), then a decisive pass with `--bold` (`oil-load`) in the lights and a few quiet strokes in the shadows (`--decisive 0` skips both); `--vary` lets each stroke stray in value and temperature. Paint on a layer clipped to the flats, or lock the flats layer and paint into it: strokes then run past the outline and short strokes along it cut the edge in; on a plain layer they stay inside it and the flats show at the rim.
+{"op":"add","node":{"id":"eye","type":"ellipse","cx":450,"cy":380,"rx":18,"ry":18},"in":"<sketch id>","frame":0}' | klad apply art.klad
+klad fill art.klad flats --shape body --color skin # exactly the shape's area, grown 2 px under the ink
+klad light art.klad --from body --light -1,-1 --shade shade --rim rim --depth 20 # shade away from the light, a rim towards it
+klad ink art.klad lines --from body,eye --weight 7 --light -1,-1 # tapered strokes, weight from rules
+klad hatch art.klad shade --in body --angle 30 --spacing 8 --length 10-24 --color shadow
+klad scatter art.klad lines --in ground --mark "M0 0 Q 3 -22 8 -40" --count 20 --turn -25,25
+klad paint art.klad paint --in body --color skin --light -1,-1 --weight 12 # a round form, painted from a light model
+klad paint art.klad paint --in pillar --form cylinder --axis 90 --lamp 200,600,150 --color '#c9b8a0'
+klad foliage art.klad canopy --in clump1 --color '#4d7a3b' --light -0.6,-0.8 --leaf 16 --mass crown # a clump built from lit leaves
+klad grass art.klad field --in field --color '#6f8a3c' --light -0.9,-0.45 --blade 30 --far 0.22 --wind 12 # blades lit by rolling ground
+klad prepare art.klad # buffer every drawing before the user opens it
+```
+
+- Painting a form: after the flats, `klad paint` paints each shape as a form. `--form round` (default) bulges any closed shape like a pillow, its height growing with the distance to the outline; `flat` is a plane facing `--facing x,y,z` (z toward the viewer, y down); `cylinder` is round across `--axis` degrees. The light model is a key light from `--light x,y` at `--elevation` (or `--lamp x,y,height` in canvas px: the shape nearest the lamp gets the full key light, farther ones less by inverse square, so paint a cluster in one op), cool fill from above (`--fill`, `--fill-strength`), warm bounce from below (`--bounce`, `--bounce-strength`) and a darker core just past the terminator (`--core`); `--color` is the local colour in full light, so the lit side comes out at that colour and the shadow side about four value steps under it. The lights multiply the local colour, so a warm colour goes darker and browner in shadow; `--shadow <colour>` (`"shadow"` in `apply`) turns the side out of the key light towards that colour's hue and chroma while keeping the values the model gives it, by `--shadow-mix` (default 0.7) and less in the halftones, with the chroma lowered in the darkest parts. A cool lavender or blue grey keeps shadows from going brown or grey; raise `--fill-strength` (0.3 or so) for lighter shadow sides. Every colour option of `paint` takes palette names. Strokes follow the form (along bands of equal light on round forms, along the axis on cylinders, at `--angle` on planes), take their colour from the model where they lie and stop where the light changes, so none carries the lit colour into the shadow. Thick paint: `oil` and `oil-load` have `body` (a brush key, 0 to 1), so their strokes lay paint height: flat in the middle with bristle grooves, lips at the sides, thinner at light pressure, taller for bigger brushes; new paint pushes most of the wet paint under it aside, so it builds up only a little where strokes cross. `smudge` and `wet` drag it, `blender` flattens it, the eraser takes it. It shows only through a `relief` effect on the layer (`klad effect art.klad <layer> relief strength=4 softness=3.5 light=-1,-1`): strength about 4 to 5 for fruit or a figure, 1 to 2 for a table or a wall; softness about a fifth of the stroke size (3 to 4.5 for strokes of 15 to 20 px). Below 1, a surface built from many small strokes shows every stroke's ridges and reads as wrinkled leather, not paint. Without the effect body changes no pixel. Passes go from twice `--weight` down to half of it (the small ones only where the form turns), then a decisive pass with `--bold` (`oil-load`) in the lights and a few quiet strokes in the shadows (`--decisive 0` skips both); `--vary` lets each stroke stray in value and temperature. Paint on a layer clipped to the flats, or lock the flats layer and paint into it: strokes then run past the outline and short strokes along it cut the edge in; on a plain layer they stay inside it and the flats show at the rim.
- Every stroke the shape ops make is drawn like a hand (`--hand 1`, the default; `0` gives the old even strokes): its own pressure curve (a press-in, a peak, a longer lift-off), tapers that are a share of its length, a width that varies from stroke to stroke, and a slight bow on hatching and flat planes. Brushes for it: `oil` (soft edge, size and opacity from pressure) for building forms, `oil-load` (harder edge, more grain) for strokes that should stay visible.
- `klad light` takes `--lamp x,y,height` too: each shape is shaded away from the lamp instead of one direction for all.
-- `klad prepare art.draw [--from 0 --to 23]` replays every painted drawing of those frames into the cache after a big CLI change, so the editor opens and plays it without replaying strokes. The editor still makes its frame pictures itself, quickly, from the cached drawings.
+- `klad prepare art.klad [--from 0 --to 23]` replays every painted drawing of those frames into the cache after a big CLI change, so the editor opens and plays it without replaying strokes. The editor still makes its frame pictures itself, quickly, from the cached drawings.
- Foliage: never one leaf picture scattered evenly, and never a smooth blob with leaves sprinkled on its edge; both look fake. Block the crown in as 6 to 12 clump shapes (irregular blobs with lobes) plus one `crown` shape around them all, then for each clump from back to front: fill a darker, slightly smaller core (about 0.82 of the clump, so the sky shows between the edge leaves) and run `foliage` on it with `mass: "crown"`. Every leaf takes its colour from the clump lit as a round form and turned with the whole crown, in three value families from a cool shade through `--color` to a warm `--lit`, with the most variety in the light; leaves along the outline break the silhouette, most where light and sky reach, a few glowing at the shadow edge. Back clumps a darker colour, front ones lighter; leaf size about a fiftieth of the crown's width (`samples/tree`). Far canopies stay soft vector masses.
- Grass: `grass` grows blades from the far (top) edge of a shape to the near one, smaller and denser far off (`--far`), leaning with `--wind`, each from a dark root to a lit tip over ground that rolls in soft light patches, with taller blades breaking the top edge and thin glints on lit blades. One kind of blade everywhere looks plastic: grass is a mix of species, each growing in its own patches. Without `kinds` the op grows a meadow mix (fine blades, broad flopping ones, dry straw, stalks with seed heads, clover low between them); give your own with `kinds` (JSON: `name`, `share`, `brush`, `length` and `width` against the blade, `curl`, `spread`, `color` or `hue`, `head` a picture brush stamped at the tip with `head_size`, `low` for rosettes and clover, `patchy` 0 to 1). Seed heads and low plants thin out with distance. Fill the shape a dark green first so gaps read as depth. A field with short blades and a near bank with long ones make a meadow; rare accents (your own tufts or flowers) are a species with a small share. Distant grass is a soft mass, not blades.
-- The shape ops decide where marks go and how light colours them; the brush decides what a mark looks like, and it should be yours when the subject needs it. `foliage`, `grass`, `scatter` and `paint` all take `--brush`: a stroke brush (round or chalk tip) draws each leaf or blade as a stroke, a picture brush stamps one picture per mark, turned to it. To make one, draw the shape in a small drawing of its own (black on transparent, pointing right for brushes whose angle follows the stroke), `klad render` it to a PNG, add it with `klad brushes art.draw --picture tuft tuft.png`, and define the brush with `klad brushes art.draw --set tuft tuft.json` (`{"tip":{"image":{"image":"tuft","more":["tuft-b"]}},"angle":"follow","spacing":1}`; several pictures give variety). `samples/meadow/build.sh` does exactly this. Make a new leaf or tuft for each species and style instead of reusing the library's for everything.
+- The shape ops decide where marks go and how light colours them; the brush decides what a mark looks like, and it should be yours when the subject needs it. `foliage`, `grass`, `scatter` and `paint` all take `--brush`: a stroke brush (round or chalk tip) draws each leaf or blade as a stroke, a picture brush stamps one picture per mark, turned to it. To make one, draw the shape in a small drawing of its own (black on transparent, pointing right for brushes whose angle follows the stroke), `klad render` it to a PNG, add it with `klad brushes art.klad --picture tuft tuft.png`, and define the brush with `klad brushes art.klad --set tuft tuft.json` (`{"tip":{"image":{"image":"tuft","more":["tuft-b"]}},"angle":"follow","spacing":1}`; several pictures give variety). `samples/meadow/build.sh` does exactly this. Make a new leaf or tuft for each species and style instead of reusing the library's for everything.
- Ink rules: heavier on the side away from `--light` (the direction the light comes from, -1,-1 is top left), heavier on the silhouette than on inner lines (an outline inside another shape given in the same call), thinner on tight curves, a seeded wobble (`--wobble 0` for none). Outlines split into separate strokes at corners sharper than `--break` (60 degrees); `--gap 3` leaves inkers' gaps where lines meet. Open details (folds, cracks, ribs) go through `--path "M..."`.
- `klad light` writes lasso fills with a cut: on the shade layer the shape minus itself moved towards the light (`--soft 3` overlapping steps soften the inner edge), on the rim layer a band along the lit edge. Clip the shade layer (multiply) and the rim layer to the flats, as in `samples/lantern/`.
- `samples/lantern/generate.py` is the whole recipe for a prop in about 100 lines; `samples/ink-shapes/` shows the ink options side by side.
@@ -219,16 +219,16 @@ klad prepare art.draw
Draw a character once and pose it, instead of redrawing every frame. Put its paint layers (lines, colour, shading) in a group and give the group bones: the skeleton poses every layer in it together. Name parts as you draw (`"part"` on strokes and fills): they are what weights and the rig export use.
```bash
-klad bone art.draw figure --add body --head 400,590 --tail 400,360
-klad bone art.draw figure --add upper --parent body --head 452,392 --tail 560,360 # a child starts at its parent's end, or anywhere
-klad weights art.draw figure --auto # blend from the bones
-klad weights art.draw figure --bone head --part head # a part held rigidly by one bone
-klad weights art.draw figure --bone upper --set '470,380,20,1 500,370,16,0.8' # soft dabs: x,y,radius,weight
-klad pose art.draw figure --from 0 --to 4 --bone upper=-35 --bone fore=-55 --hold 4
-klad inbetween art.draw --layers colour,lines --from 0 --to 4 # poses of one rest drawing in-between on the bones
-klad render art.draw --frame 4 --overlay bones # or --overlay weights:upper
-klad key art.draw lantern --frame 0 y=0 --ease in-out; klad key art.draw lantern --frame 12 y=-18
-klad export art.draw --godot-rig game/art --godot-scene game/art
+klad bone art.klad figure --add body --head 400,590 --tail 400,360
+klad bone art.klad figure --add upper --parent body --head 452,392 --tail 560,360 # a child starts at its parent's end, or anywhere
+klad weights art.klad figure --auto # blend from the bones
+klad weights art.klad figure --bone head --part head # a part held rigidly by one bone
+klad weights art.klad figure --bone upper --set '470,380,20,1 500,370,16,0.8' # soft dabs: x,y,radius,weight
+klad pose art.klad figure --from 0 --to 4 --bone upper=-35 --bone fore=-55 --hold 4
+klad inbetween art.klad --layers colour,lines --from 0 --to 4 # poses of one rest drawing in-between on the bones
+klad render art.klad --frame 4 --overlay bones # or --overlay weights:upper
+klad key art.klad lantern --frame 0 y=0 --ease in-out; klad key art.klad lantern --frame 12 y=-18
+klad export art.klad --godot-rig game/art --godot-scene game/art
```
- Angles are degrees from the rest pose, positive turning clockwise on screen; a child follows its parent. Pose from the rest drawing (`--from` its frame); posing a frame again re-poses it.
@@ -241,10 +241,10 @@ klad export art.draw --godot-rig game/art --godot-scene game/art
`paintover` turns a flat or smooth picture into a painted one: it renders what is below a paint layer (or `--from` layers) and lays brush strokes on that layer, big to small. Each stroke takes the source's colour where it starts and runs along the forms (across the colour gradient) until the colour under it changes; smaller brushes only go where the painting still differs from the source by more than `--threshold`, so detail lands where the source has it. Flat areas get broad, mostly level strokes. The strokes are ordinary strokes in the part `paint over`, so `body` and `relief` light them and the user can edit them.
```bash
-klad add art.draw layer paint name=brushwork # on top of the drawing
-klad paintover art.draw brushwork --sizes 32,16,8 --threshold 6 [--in rock] [--focus face] [--brush oil-load] [--curve 0.5] [--length 1,8]
-klad paintover walk.draw brushwork --frame 0 --sizes 14,7
-klad paintover walk.draw brushwork --like c37 --frames 0-27 # carry it drawing to drawing through an animation
+klad add art.klad layer paint name=brushwork # on top of the drawing
+klad paintover art.klad brushwork --sizes 32,16,8 --threshold 6 [--in rock] [--focus face] [--brush oil-load] [--curve 0.5] [--length 1,8]
+klad paintover walk.klad brushwork --frame 0 --sizes 14,7
+klad paintover walk.klad brushwork --like c37 --frames 0-27 # carry it drawing to drawing through an animation
```
- Block in and light the picture first (flats, `paint`, shadows), then paint over it: the paint-over keeps your values and edges and adds the hand. Keep the source layers under the brushwork; hide them or not.
@@ -255,7 +255,7 @@ klad paintover walk.draw brushwork --like c37 --frames 0-27 # carry it drawin
`compare` measures your drawing against a reference picture, so a critique is numbers as well as a look: the value range (L at the 5th, 50th and 95th percentile), saturation, stroke texture, edge sharpness and mean colour difference, with what differs in words, plus a row per `--region` and a heat map of where they differ most.
```bash
-klad compare art.draw study.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png
+klad compare art.klad study.png --region shade=40,300,200,120 --region cup=610,180,90,120 --heat diff.png
```
Read the words ("lighter by 4 L", "bluer", "33% busier", "softer edges") and fix the biggest first. In the editor, "compare with the reference" (View) does the same against the drawing's reference picture layer.
@@ -276,14 +276,14 @@ When a piece needs more than `klad paint` gives, paint it stroke by stroke in a
## Studying a reference
-To recreate a picture (a reference study): `klad add art.draw layer image src=ref.jpg reference=true`, then size it to the canvas with `klad set art.draw <node> x=0 y=0 w=<width> h=<height>` (a picture smaller than the canvas is placed at its own size). Read the reference in quarters with `klad render art.draw --references --region x,y,w,h` (a reference under an opaque background is covered: hide the background or render the reference alone), and take coordinates from those crops. Build in planes from back to front, compare often on one sheet (a bundle holding the reference picture above the render), and fix values before details: the first passes of a cave study were too bright everywhere, not too plain.
+To recreate a picture (a reference study): `klad add art.klad layer image src=ref.jpg reference=true`, then size it to the canvas with `klad set art.klad <node> x=0 y=0 w=<width> h=<height>` (a picture smaller than the canvas is placed at its own size). Read the reference in quarters with `klad render art.klad --references --region x,y,w,h` (a reference under an opaque background is covered: hide the background or render the reference alone), and take coordinates from those crops. Build in planes from back to front, compare often on one sheet (a bundle holding the reference picture above the render), and fix values before details: the first passes of a cave study were too bright everywhere, not too plain.
- Light layers and mist on `screen` go behind the planes they light from behind; above a plane they turn its forms milky.
## Export
```
-klad export art.draw --scale 2
-klad export art.draw --layer hero --scale 4 --depth 16 -o hero.png
+klad export art.klad --scale 2
+klad export art.klad --layer hero --scale 4 --depth 16 -o hero.png
```
Transparent PNG of the image or one layer or group, next to the bundle unless `-o`. 8-bit exports are dithered so gradients do not band; `--depth 16` keeps 16 bits; `--background` keeps the canvas colour. Vectors stay sharp at any scale, and above full size `klad export` draws the strokes again at that size, so lines stay crisp and textures keep their size (it replays every mark, so it takes a few seconds on a dense painting). Sprite sheets, numbered frames and Godot exports are under Time, Animation exports.
@@ -299,15 +299,15 @@ For anything with more than a handful of shapes, write a generator that prints o
`timeline` has `fps` and `frames`; each layer has cels (`frame`, optional `hold`, optional `link` to reuse another cel). A cel that is not a link is a drawing; the frames it shows on are its exposure (from `frame` for `hold` frames, or until the next cel). `--frame n` on `ls`, `render`, `stroke`, `fill`, `lasso` and `add` picks the frame; a stroke or fill paints into the drawing exposed there.
```
-klad frames art.draw # exposure sheet: c4 = a drawing starts, | still showing, c9->c4 a link, . blank
-klad timeline art.draw --fps 12 --frames 24 # length and speed (no flags: show them, the origin, the Godot folder and the clips)
-klad cel art.draw new l3 --frame 4 # blank drawing; inside an exposure it takes over the rest of it
-klad cel art.draw dup c4 [--frame 6] [--insert] # copy (strokes keep their ids); default right after c4; --insert moves later cels back
-klad cel art.draw link c4 --frame 8 --hold 2 # show c4 again
-klad cel art.draw unlink c9 # the link becomes a drawing of its own
-klad frame art.draw insert 4 [--count 2] [--layers l3] # what showed at 4 shows longer, the rest moves back
-klad frame art.draw remove 4 [--count 2] [--layers l3]
-klad hash art.draw --all # one pixel hash per frame
+klad frames art.klad # exposure sheet: c4 = a drawing starts, | still showing, c9->c4 a link, . blank
+klad timeline art.klad --fps 12 --frames 24 # length and speed (no flags: show them, the origin, the Godot folder and the clips)
+klad cel art.klad new l3 --frame 4 # blank drawing; inside an exposure it takes over the rest of it
+klad cel art.klad dup c4 [--frame 6] [--insert] # copy (strokes keep their ids); default right after c4; --insert moves later cels back
+klad cel art.klad link c4 --frame 8 --hold 2 # show c4 again
+klad cel art.klad unlink c9 # the link becomes a drawing of its own
+klad frame art.klad insert 4 [--count 2] [--layers l3] # what showed at 4 shows longer, the rest moves back
+klad frame art.klad remove 4 [--count 2] [--layers l3]
+klad hash art.klad --all # one pixel hash per frame
```
In `apply`: `{"op":"cel","new":"lines","frame":4,"hold":2,"id":"ball4"}` (the `id` lets later ops in the same batch name it), `{"op":"cel","link":"ball0","frame":15}`, `{"op":"frames","insert":4,"count":2}`, `{"op":"timeline","frames":24}`. For an animation script: make every drawing's cel first (`cel new` with an `id`), then its strokes and fills at that frame. `samples/bounce/generate.py` is the pattern: lines, colour filled against the lines, a multiply shadow, a held floor, the rest pose as links.
@@ -316,21 +316,21 @@ Strokes copied by `dup` keep their ids, so `c7:s3` in the copy is the same line
### Keys, in-betweens, colour and timing
-Animate by keys: draw the key poses with their parts named, check the keys' arcs, let `klad inbetween` make the drawings between them, colour every drawing from the first with `klad fill --like`, check with `klad gaps`, set the timing with `klad retime`, check the arcs again. `samples/creature/` (`generate.py` and `build.sh`, which writes `creature.draw`) is the pattern: an idle and a walk on six layers (shadow, far leg, colour, a clipped multiply shade, a clipped rim light, lines), parts body, sprout, leaf, second leaf, near leg and far leg, `klad arcs --check` before and after in-betweening, the loop closed with `--loop`.
+Animate by keys: draw the key poses with their parts named, check the keys' arcs, let `klad inbetween` make the drawings between them, colour every drawing from the first with `klad fill --like`, check with `klad gaps`, set the timing with `klad retime`, check the arcs again. `samples/creature/` (`generate.py` and `build.sh`, which writes `creature.klad`) is the pattern: an idle and a walk on six layers (shadow, far leg, colour, a clipped multiply shade, a clipped rim light, lines), parts body, sprout, leaf, second leaf, near leg and far leg, `klad arcs --check` before and after in-betweening, the loop closed with `--loop`.
```
-klad copy art.draw c1:s3 c1:s4 --frame 6 [--layer shade] [--move 12,-4 --rotate 8 --pivot 512,400] [--cut 'x,y ...']
-klad inbetween art.draw --layers lines,colour,shade --from 0 --to 6 [--count 2] [--spacing in-out] [--match near] [--pair s3=s7]
-klad inbetween art.draw --layers lines,colour --from 9 --loop # the loop's last in-betweens, towards its first drawing
-klad inbetween art.draw --layers lines --from 0 --to 6 --unpaired pop|fade|draw-on [--at 0.3]
-klad inbetween art.draw --redo [--layers lines] [--keep-drawn | --force]
-klad part art.draw c4:s14 c4:s15 --name leaf # or --part leaf on stroke, fill, ink, hatch, scatter
-klad arcs art.draw --track 'lines:near leg' --track 'far:far leg' --clip walk --ground 823,811 --travel 7 --check
-klad render art.draw --frame 20 --track 'lines:near leg' --region 420,720,200,120 --scale 4 # the paths drawn
-klad render art.draw --sheet walk --drawings --overlay parts
-klad fill art.draw colour --like colour0 --frames all
-klad gaps art.draw colour --sheet all # closed regions no fill covers, with a render marking them; naming the lines layer checks the layer that fills from it
-klad retime art.draw 0-11 --on 2 # or --on 1, --fit 16, --reverse, --pingpong; [--layers l3]
+klad copy art.klad c1:s3 c1:s4 --frame 6 [--layer shade] [--move 12,-4 --rotate 8 --pivot 512,400] [--cut 'x,y ...']
+klad inbetween art.klad --layers lines,colour,shade --from 0 --to 6 [--count 2] [--spacing in-out] [--match near] [--pair s3=s7]
+klad inbetween art.klad --layers lines,colour --from 9 --loop # the loop's last in-betweens, towards its first drawing
+klad inbetween art.klad --layers lines --from 0 --to 6 --unpaired pop|fade|draw-on [--at 0.3]
+klad inbetween art.klad --redo [--layers lines] [--keep-drawn | --force]
+klad part art.klad c4:s14 c4:s15 --name leaf # or --part leaf on stroke, fill, ink, hatch, scatter
+klad arcs art.klad --track 'lines:near leg' --track 'far:far leg' --clip walk --ground 823,811 --travel 7 --check
+klad render art.klad --frame 20 --track 'lines:near leg' --region 420,720,200,120 --scale 4 # the paths drawn
+klad render art.klad --sheet walk --drawings --overlay parts
+klad fill art.klad colour --like colour0 --frames all
+klad gaps art.klad colour --sheet all # closed regions no fill covers, with a render marking them; naming the lines layer checks the layer that fills from it
+klad retime art.klad 0-11 --on 2 # or --on 1, --fit 16, --reverse, --pingpong; [--layers l3]
```
- Name parts as you draw keys (`--part`, or `"part"` in ops): in-betweens pair part by part first, whatever the ids, so keys drawn separately, or redrawn, or with the user's strokes in between, still pair. Give each piece that moves on its own its own part (one per leaf, per limb): within a part marks pair in drawing order. Without parts keys pair by mark id, so make every key with the same ops in the same order, or `cel dup` a key and change the copy. `--match near` pairs drawings made separately (and turns strokes drawn backwards); `--pair` forces the odd one. Unpaired marks are left out and listed by default: read that list, or let them `--unpaired pop|fade|draw-on`.
@@ -351,11 +351,11 @@ klad retime art.draw 0-11 --on 2 # or --on 1, --fit 16, --reverse,
A clip is a named frame range (both ends included) that exports as one animation: `idle`, `run`, `attack`. It loops or plays once, and may have its own fps (otherwise the document's).
```
-klad clip art.draw # list: frames, length in s at its fps, loops or once
-klad clip art.draw --add run --from 0 --to 11 --loop --fps 24
-klad clip art.draw --set run --to 15 --no-loop # change; --name sprint renames, --fps doc drops its own fps
-klad clip art.draw --rm run
-klad timeline art.draw --origin 512,700 # the canvas point a Godot export puts on the node (default the centre)
+klad clip art.klad # list: frames, length in s at its fps, loops or once
+klad clip art.klad --add run --from 0 --to 11 --loop --fps 24
+klad clip art.klad --set run --to 15 --no-loop # change; --name sprint renames, --fps doc drops its own fps
+klad clip art.klad --rm run
+klad timeline art.klad --origin 512,700 # the canvas point a Godot export puts on the node (default the centre)
```
In `apply`: `{"op":"clip","add":"run","from":0,"to":11,"loop":true,"fps":24}`, `{"op":"clip","set":"run","name":"sprint","fps":null}`, `{"op":"clip","rm":"run"}`, `{"op":"timeline","origin":[512,700]}`. Frames inserted or removed on every layer move and stretch clips (an insert inside a clip lengthens it); on listed layers they leave clips alone. `klad frames` marks clips on the right (`[run` first frame, `run]` last) and lists them under the sheet. In the editor clips are bars on the strip above the frame numbers, and Return plays the clip under the playhead at its fps.
@@ -363,11 +363,11 @@ In `apply`: `{"op":"clip","add":"run","from":0,"to":11,"loop":true,"fps":24}`, `
### Animation exports
```
-klad export art.draw --sheet all [--scale 0.5] [--padding 2] [--max 4096] [--depth 16]
-klad export art.draw --sheet run -o out/run.png
-klad export art.draw --frames run # run-0000.png ... full size, one per frame, in art-run/
-klad export art.draw --godot ../game/art/hero # first time: the folder is kept in the document
-klad export art.draw --godot # later: the kept folder (the editor's button does the same)
+klad export art.klad --sheet all [--scale 0.5] [--padding 2] [--max 4096] [--depth 16]
+klad export art.klad --sheet run -o out/run.png
+klad export art.klad --frames run # run-0000.png ... full size, one per frame, in art-run/
+klad export art.klad --godot ../game/art/hero # first time: the folder is kept in the document
+klad export art.klad --godot # later: the kept folder (the editor's button does the same)
```
- `--sheet all` exports every clip (or the whole timeline as `default` when there are none), `--sheet <clip>` one, `--sheet 0-11` a range. The PNG holds each distinct picture once (holds, links and frames that render the same share one), trimmed to its pixels, in order of first appearance; beyond `--max` it goes to more pages (`art-sheet-2.png`, ...). The JSON is Aseprite's array layout: one entry per exposure with `duration` in ms at the clip's fps (a clip's durations add up to its length), `frame` (rect in the page), `spriteSourceSize` (the trim) and `sourceSize`, plus `frameTags` per clip (`repeat: "1"` when it plays once). Entries on later pages carry `image`.
@@ -377,12 +377,12 @@ klad export art.draw --godot # later: the kept fo
See the motion before reading single frames:
```
-klad render art.draw --sheet all # every frame in one grid: frame number, drawing ids, holds
-klad render art.draw --sheet 0-11 --drawings # one cell per drawing: frames that look the same share a cell ("4-5")
-klad render art.draw --sheet run --cell 192 # a clip by name; --cell is the longest side of a cell, --columns n
-klad render art.draw --frame 5 --overlay onion # drawings before (red) and after (green) under each layer
-klad render art.draw --frame 5 --onion 1,3 --onion-layers lines --onion-by frames --no-tint
-klad render art.draw --sheet 0-7 --overlay onion --onion-loop 0-7 # onion in every cell, wrapping inside a loop
+klad render art.klad --sheet all # every frame in one grid: frame number, drawing ids, holds
+klad render art.klad --sheet 0-11 --drawings # one cell per drawing: frames that look the same share a cell ("4-5")
+klad render art.klad --sheet run --cell 192 # a clip by name; --cell is the longest side of a cell, --columns n
+klad render art.klad --frame 5 --overlay onion # drawings before (red) and after (green) under each layer
+klad render art.klad --frame 5 --onion 1,3 --onion-layers lines --onion-by frames --no-tint
+klad render art.klad --sheet 0-7 --overlay onion --onion-loop 0-7 # onion in every cell, wrapping inside a loop
```
Cell labels read like `klad frames`: `c5` starts a drawing, `|c5` holds it, `c9>c1` shows c1 again through a link, `.` is blank, and a grey title with `hold` means the frame looks exactly like the one before. Onion skin is under the layer it belongs to, faded with distance (counted in drawings unless `--onion-by frames`); without `--onion-layers` every layer with more than one drawing shows its own. A sheet of 24 frames of a 2048 canvas takes about 0.3 s; onion in a sheet costs more (about 0.8 s for one layer, 2 s for four). Render prints a pixel hash on its second line, handy for comparing with the Mac.
diff --git a/justfile b/justfile
index d8e6e9f..2ded6e5 100644
--- a/justfile
+++ b/justfile
@@ -56,17 +56,17 @@ fmt:
bench *args: build
{{klad}} bench {{args}}
-demo bundle="scratch/demo.draw": build
+demo bundle="scratch/demo.klad": build
{{klad}} demo {{bundle}} --force
{{klad}} render {{bundle}}
-hash bundle="scratch/demo.draw": build
+hash bundle="scratch/demo.klad": build
{{klad}} hash {{bundle}} --no-cache
-open bundle="scratch/pen.draw": build
+open bundle="scratch/pen.klad": build
{{klad}} open {{bundle}}
-stress bundle="scratch/stress.draw": build
+stress bundle="scratch/stress.klad": build
{{klad}} stress {{bundle}}
ui-pictures:
diff --git a/packaging/icon/build.sh b/packaging/icon/build.sh
index 91bb55d..6d40f9f 100755
--- a/packaging/icon/build.sh
+++ b/packaging/icon/build.sh
@@ -4,11 +4,11 @@ here="$(cd "$(dirname "$0")" && pwd)"
klad="${KLAD:?set KLAD to the klad binary, or run just icon}"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
-"$klad" new "$work/icon.draw" --width 1024 --height 1024 --layers 0 >/dev/null
-python3 "$here/generate.py" | "$klad" apply "$work/icon.draw" >/dev/null
-"$klad" render "$work/icon.draw" --out "$here/icon.png" >/dev/null
+"$klad" new "$work/icon.klad" --width 1024 --height 1024 --layers 0 >/dev/null
+python3 "$here/generate.py" | "$klad" apply "$work/icon.klad" >/dev/null
+"$klad" render "$work/icon.klad" --out "$here/icon.png" >/dev/null
for size in 16 24 32 48 64 128 256 512 1024; do
- "$klad" render "$work/icon.draw" --scale "$(python3 -c "print($size/1024)")" --out "$work/icon-$size.png" >/dev/null
+ "$klad" render "$work/icon.klad" --scale "$(python3 -c "print($size/1024)")" --out "$work/icon-$size.png" >/dev/null
done
python3 "$here/pack.py" "$work" "$here/klad.icns" "$here/klad.ico"
echo "$here/icon.png $here/klad.icns $here/klad.ico"
diff --git a/packaging/macos/Info.plist b/packaging/macos/Info.plist
index ade9f6b..0387772 100644
--- a/packaging/macos/Info.plist
+++ b/packaging/macos/Info.plist
@@ -63,7 +63,7 @@
<dict>
<key>public.filename-extension</key>
<array>
- <string>draw</string>
+ <string>klad</string>
</array>
</dict>
</dict>
diff --git a/samples/README.md b/samples/README.md
index 8f6b31f..fba8a72 100644
--- a/samples/README.md
+++ b/samples/README.md
@@ -18,4 +18,4 @@ Drawings made from scratch with the `klad` CLI, each from a generator that print
| `rig` | Bones instead of a drawing per frame: a figure in a group with a skeleton, weights from the bones with the head, body and hand held rigidly by their parts, a wave posed at four keys and in-betweened on the bones, a lantern floating on keys, a far plane for parallax, and the Godot rig and parallax scene (`rig-godot/`) |
| `solids` | Painting stroke by stroke: a sphere, a cube and a cylinder built in 3D with `docs/skill/drawkit.py`, lit, painted with natural strokes |
-The generated `.draw` bundles and pictures stay out of git.
+The generated `.klad` bundles and pictures stay out of git.
diff --git a/samples/bounce/build.sh b/samples/bounce/build.sh
index 3bcec27..8934a29 100755
--- a/samples/bounce/build.sh
+++ b/samples/bounce/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/bounce.draw}"
+out="${1:-$here/bounce.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,14 +16,14 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1024 --height 768 --layers 0 --fps 12 --frames 20 --background '#f4efe6' >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" --frame 7 -o "${out%.draw}.png"
+"$klad" render "$out" --frame 7 -o "${out%.klad}.png"
"$klad" frames "$out"
"$klad" hash "$out" --all --no-cache
echo "sheet and onion (the hash is on each second line):"
-"$klad" render "$out" --sheet all -o "${out%.draw}-sheet.png"
-"$klad" render "$out" --sheet all --drawings -o "${out%.draw}-drawings.png"
-"$klad" render "$out" --frame 5 --overlay onion -o "${out%.draw}-onion.png"
+"$klad" render "$out" --sheet all -o "${out%.klad}-sheet.png"
+"$klad" render "$out" --sheet all --drawings -o "${out%.klad}-drawings.png"
+"$klad" render "$out" --frame 5 --overlay onion -o "${out%.klad}-onion.png"
echo "sprite sheets at 1x and 0.5x and a Godot export (hashes on the lines starting with hash):"
-"$klad" export "$out" --sheet all -o "${out%.draw}-sprites.png"
-"$klad" export "$out" --sheet all --scale 0.5 -o "${out%.draw}[email protected]"
-"$klad" export "$out" --godot "${out%.draw}-godot" >/dev/null
+"$klad" export "$out" --sheet all -o "${out%.klad}-sprites.png"
+"$klad" export "$out" --sheet all --scale 0.5 -o "${out%.klad}[email protected]"
+"$klad" export "$out" --godot "${out%.klad}-godot" >/dev/null
diff --git a/samples/courier/build.sh b/samples/courier/build.sh
index affc19d..e4d3b6e 100755
--- a/samples/courier/build.sh
+++ b/samples/courier/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/courier.draw}"
+out="${1:-$here/courier.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -19,7 +19,7 @@ python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
"$klad" clip "$out" --add idle --from 0 --to 7 --loop >/dev/null
"$klad" clip "$out" --add run --from 8 --to 15 --loop >/dev/null
"$klad" timeline "$out" --origin 300,500 >/dev/null
-"$klad" render "$out" --sheet idle --drawings --cell 280 -o "${out%.draw}-idle.png"
-"$klad" render "$out" --sheet run --drawings --cell 280 -o "${out%.draw}-run.png"
+"$klad" render "$out" --sheet idle --drawings --cell 280 -o "${out%.klad}-idle.png"
+"$klad" render "$out" --sheet run --drawings --cell 280 -o "${out%.klad}-run.png"
"$klad" hash "$out" --all --no-cache
-"$klad" export "$out" --godot "${out%.draw}-godot" >/dev/null
+"$klad" export "$out" --godot "${out%.klad}-godot" >/dev/null
diff --git a/samples/creature/build.sh b/samples/creature/build.sh
index d114dd3..52fe812 100755
--- a/samples/creature/build.sh
+++ b/samples/creature/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/creature.draw}"
+out="${1:-$here/creature.klad}"
if ! "$klad" arcs --help >/dev/null 2>&1; then
echo "$klad is older than this example (it has no klad arcs): run just build first" >&2
exit 1
@@ -48,7 +48,7 @@ echo "the walk's arcs, in-betweened:"
"$klad" frames "$out"
"$klad" gaps "$out" colour --sheet all | tail -1
"$klad" hash "$out" --all --no-cache
-"$klad" render "$out" --sheet idle --drawings --cell 300 -o "${out%.draw}-idle.png"
-"$klad" render "$out" --sheet walk --drawings --cell 300 -o "${out%.draw}-walk.png"
-"$klad" render "$out" --sheet walk --drawings --cell 300 --track 'lines:near leg' --track 'far:far leg' --track 'lines:second leaf' -o "${out%.draw}-walk-arcs.png"
-"$klad" export "$out" --frame 0 --scale 2 -o "${out%.draw}@2x.png" >/dev/null
+"$klad" render "$out" --sheet idle --drawings --cell 300 -o "${out%.klad}-idle.png"
+"$klad" render "$out" --sheet walk --drawings --cell 300 -o "${out%.klad}-walk.png"
+"$klad" render "$out" --sheet walk --drawings --cell 300 --track 'lines:near leg' --track 'far:far leg' --track 'lines:second leaf' -o "${out%.klad}-walk-arcs.png"
+"$klad" export "$out" --frame 0 --scale 2 -o "${out%.klad}@2x.png" >/dev/null
diff --git a/samples/ink-shapes/build.sh b/samples/ink-shapes/build.sh
index 8988cef..dc4b38b 100755
--- a/samples/ink-shapes/build.sh
+++ b/samples/ink-shapes/build.sh
@@ -8,9 +8,9 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/ink-shapes.draw}"
+out="${1:-$here/ink-shapes.klad}"
rm -rf "$out"
"$klad" new "$out" --width 960 --height 900 --layers 0 --background '#f4efe6' >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
+"$klad" render "$out" -o "${out%.klad}.png"
"$klad" hash "$out" --no-cache
diff --git a/samples/lantern/build.sh b/samples/lantern/build.sh
index ff6e346..53d4fbe 100755
--- a/samples/lantern/build.sh
+++ b/samples/lantern/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/lantern.draw}"
+out="${1:-$here/lantern.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,6 +16,6 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1024 --height 1280 --layers 0 >/dev/null
python3 "$here/generate.py" ${PAINTED:+--painted} | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
-"$klad" export "$out" --scale 2 -o "${out%.draw}@2x.png"
+"$klad" render "$out" -o "${out%.klad}.png"
+"$klad" export "$out" --scale 2 -o "${out%.klad}@2x.png"
"$klad" hash "$out" --no-cache
diff --git a/samples/lemons/build.sh b/samples/lemons/build.sh
index 3211f7d..eac5cea 100755
--- a/samples/lemons/build.sh
+++ b/samples/lemons/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/lemons.draw}"
+out="${1:-$here/lemons.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,6 +16,6 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1200 --height 900 --layers 0 >/dev/null
python3 "$here/generate.py" ${PLAIN:+--plain} ${RELIEF:+--relief} | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
-"$klad" export "$out" --scale 2 -o "${out%.draw}@2x.png"
+"$klad" render "$out" -o "${out%.klad}.png"
+"$klad" export "$out" --scale 2 -o "${out%.klad}@2x.png"
"$klad" hash "$out" --no-cache
diff --git a/samples/meadow/build.sh b/samples/meadow/build.sh
index 2a062b2..f0a8a3f 100755
--- a/samples/meadow/build.sh
+++ b/samples/meadow/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/meadow.draw}"
+out="${1:-$here/meadow.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -18,13 +18,13 @@ trap 'rm -rf "$work"' EXIT
rm -rf "$out"
"$klad" new "$out" --width 1600 --height 760 --layers 0 >/dev/null
for name in tuft tuft-b; do
- "$klad" new "$work/$name.draw" --width 256 --height 256 --layers 0 >/dev/null
- python3 "$here/generate.py" --picture "$name" | "$klad" apply "$work/$name.draw" >/dev/null
- "$klad" render "$work/$name.draw" -o "$work/$name.png" >/dev/null
+ "$klad" new "$work/$name.klad" --width 256 --height 256 --layers 0 >/dev/null
+ python3 "$here/generate.py" --picture "$name" | "$klad" apply "$work/$name.klad" >/dev/null
+ "$klad" render "$work/$name.klad" -o "$work/$name.png" >/dev/null
"$klad" brushes "$out" --picture "$name" "$work/$name.png" >/dev/null
done
python3 "$here/generate.py" --brush > "$work/tuft.json"
"$klad" brushes "$out" --set tuft "$work/tuft.json" >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
+"$klad" render "$out" -o "${out%.klad}.png"
"$klad" hash "$out" --no-cache
diff --git a/samples/meadow/generate.py b/samples/meadow/generate.py
index 357da25..f8ae534 100644
--- a/samples/meadow/generate.py
+++ b/samples/meadow/generate.py
@@ -52,7 +52,7 @@ def picture(name):
def tuft_brush():
- return {"format": "draw-anything-brush/1", "name": "Tuft", "tip": {"image": {"image": "tuft", "more": ["tuft-b"]}},
+ return {"format": "klad-brush/1", "name": "Tuft", "tip": {"image": {"image": "tuft", "more": ["tuft-b"]}},
"spacing": 1.0, "angle": "follow", "jitter": {"size": 0.2, "angle": 0.15},
"color": {"value": 0.05, "saturation": 0.04, "pressure": {"min": 0.0}}}
diff --git a/samples/paintover/build.sh b/samples/paintover/build.sh
index 3e6d40b..20a3823 100755
--- a/samples/paintover/build.sh
+++ b/samples/paintover/build.sh
@@ -8,8 +8,8 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-still="${1:-$here/still.draw}"
-walk="${still%still.draw}walk.draw"
+still="${1:-$here/still.klad}"
+walk="${still%still.klad}walk.klad"
for out in "$still" "$walk"; do
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it" >&2
@@ -19,9 +19,9 @@ done
KLAD="$klad" FORCE=1 bash "$root/samples/lemons/build.sh" "$still" >/dev/null
"$klad" add "$still" layer paint name=brushwork >/dev/null
"$klad" paintover "$still" brushwork --sizes 32,16,8 --seed 2 2>&1 >/dev/null
-"$klad" render "$still" -o "${still%.draw}.png" | tail -1
+"$klad" render "$still" -o "${still%.klad}.png" | tail -1
"$klad" hash "$still" --no-cache | sed -n 1p
KLAD="$klad" FORCE=1 bash "$root/samples/creature/build.sh" "$walk" >/dev/null
python3 "$here/build.py" "$klad" "$walk"
-"$klad" render "$walk" --sheet walk --drawings -o "${walk%.draw}-sheet.png" | tail -1
+"$klad" render "$walk" --sheet walk --drawings -o "${walk%.klad}-sheet.png" | tail -1
"$klad" hash "$walk" --all --no-cache | sed -n 1,3p
diff --git a/samples/rig/build.sh b/samples/rig/build.sh
index 6e3d589..686aac3 100755
--- a/samples/rig/build.sh
+++ b/samples/rig/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/rig.draw}"
+out="${1:-$here/rig.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it" >&2
exit 1
@@ -24,7 +24,7 @@ for keys in "4 8" "8 12" "12 16"; do
"$klad" inbetween "$out" --layers colour,lines --from "$1" --to "$2" >/dev/null
done
"$klad" bones "$out"
-"$klad" render "$out" --frame 8 --overlay bones -o "${out%.draw}-bones.png" | tail -1
-"$klad" render "$out" --sheet wave --drawings -o "${out%.draw}-sheet.png" | tail -1
-"$klad" export "$out" --godot-rig "${out%.draw}-godot" --godot-scene "${out%.draw}-godot" 2>&1 | tail -2
+"$klad" render "$out" --frame 8 --overlay bones -o "${out%.klad}-bones.png" | tail -1
+"$klad" render "$out" --sheet wave --drawings -o "${out%.klad}-sheet.png" | tail -1
+"$klad" export "$out" --godot-rig "${out%.klad}-godot" --godot-scene "${out%.klad}-godot" 2>&1 | tail -2
"$klad" hash "$out" --all --no-cache | sed -n '1p;9p;13p'
diff --git a/samples/ruin/build.sh b/samples/ruin/build.sh
index ac9f061..b285c30 100755
--- a/samples/ruin/build.sh
+++ b/samples/ruin/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/ruin.draw}"
+out="${1:-$here/ruin.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,5 +16,5 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1920 --height 1080 --layers 0 --background '#1c2232' >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
+"$klad" render "$out" -o "${out%.klad}.png"
"$klad" hash "$out" --no-cache | sed -n 1p
diff --git a/samples/sign/build.sh b/samples/sign/build.sh
index 6705386..13d563d 100755
--- a/samples/sign/build.sh
+++ b/samples/sign/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/sign.draw}"
+out="${1:-$here/sign.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,6 +16,6 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1024 --height 640 --layers 0 >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
-"$klad" export "$out" --scale 2 -o "${out%.draw}@2x.png"
+"$klad" render "$out" -o "${out%.klad}.png"
+"$klad" export "$out" --scale 2 -o "${out%.klad}@2x.png"
"$klad" hash "$out" --no-cache
diff --git a/samples/solids/build.sh b/samples/solids/build.sh
index 41e3021..e02e127 100755
--- a/samples/solids/build.sh
+++ b/samples/solids/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/solids.draw}"
+out="${1:-$here/solids.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -18,5 +18,5 @@ rm -rf "$out"
python3 "$here/generate.py" > "$out.jsonl"
"$klad" apply "$out" --file "$out.jsonl" >/dev/null
rm "$out.jsonl"
-"$klad" render "$out" -o "${out%.draw}.png" | sed -n 1p
+"$klad" render "$out" -o "${out%.klad}.png" | sed -n 1p
"$klad" hash "$out" --no-cache
diff --git a/samples/tree/build.sh b/samples/tree/build.sh
index 3276bdb..ae4b333 100755
--- a/samples/tree/build.sh
+++ b/samples/tree/build.sh
@@ -8,7 +8,7 @@ case "$(uname -s)" in
*) built=target/windows ;;
esac
klad="${KLAD:-$root/${KLAD_TARGET_DIR:-$built}/release/klad}"
-out="${1:-$here/tree.draw}"
+out="${1:-$here/tree.klad}"
if [ -e "$out" ] && [ "${FORCE:-0}" != 1 ]; then
echo "$out exists and may hold edits made in the editor; give another path, or FORCE=1 to rebuild it from generate.py" >&2
exit 1
@@ -16,6 +16,6 @@ fi
rm -rf "$out"
"$klad" new "$out" --width 1024 --height 1280 --layers 0 >/dev/null
python3 "$here/generate.py" | "$klad" apply "$out" >/dev/null
-"$klad" render "$out" -o "${out%.draw}.png"
-"$klad" export "$out" --scale 2 -o "${out%.draw}@2x.png"
+"$klad" render "$out" -o "${out%.klad}.png"
+"$klad" export "$out" --scale 2 -o "${out%.klad}@2x.png"
"$klad" hash "$out" --no-cache