@pixerate/editor 0.113.0 → 0.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/THIRD_PARTY_NOTICES.md +8 -0
  2. package/dist/animation-editor/index.cjs +60 -54
  3. package/dist/animation-editor/index.cjs.map +1 -1
  4. package/dist/animation-editor/index.d.cts +3 -3
  5. package/dist/animation-editor/index.d.ts +3 -3
  6. package/dist/animation-editor/index.js +14 -8
  7. package/dist/animation-editor/index.js.map +1 -1
  8. package/dist/builtin-CY97ppKM.d.cts +354 -0
  9. package/dist/builtin-CY97ppKM.d.ts +354 -0
  10. package/dist/canvas/index.cjs +3 -3
  11. package/dist/canvas/index.cjs.map +1 -1
  12. package/dist/canvas/index.js +9 -9
  13. package/dist/chunk-26PGXHY7.cjs +753 -0
  14. package/dist/chunk-26PGXHY7.cjs.map +1 -0
  15. package/dist/chunk-2OJACTPR.cjs +929 -0
  16. package/dist/chunk-2OJACTPR.cjs.map +1 -0
  17. package/dist/chunk-3UFGNHSP.js +929 -0
  18. package/dist/chunk-3UFGNHSP.js.map +1 -0
  19. package/dist/chunk-643B2HKC.cjs +534 -0
  20. package/dist/chunk-643B2HKC.cjs.map +1 -0
  21. package/dist/chunk-6FCKOS2B.js +534 -0
  22. package/dist/chunk-6FCKOS2B.js.map +1 -0
  23. package/dist/chunk-BRLYOPLT.js +2574 -0
  24. package/dist/chunk-BRLYOPLT.js.map +1 -0
  25. package/dist/{chunk-LQEEDHOP.js → chunk-C6C5PDKU.js} +759 -761
  26. package/dist/chunk-C6C5PDKU.js.map +1 -0
  27. package/dist/{chunk-4KLT7ZYS.cjs → chunk-DFQEX3AM.cjs} +29 -29
  28. package/dist/{chunk-4KLT7ZYS.cjs.map → chunk-DFQEX3AM.cjs.map} +1 -1
  29. package/dist/chunk-G5NMLUVF.cjs +2574 -0
  30. package/dist/chunk-G5NMLUVF.cjs.map +1 -0
  31. package/dist/{chunk-YGIMK4NX.cjs → chunk-I7FQBWMQ.cjs} +813 -842
  32. package/dist/chunk-I7FQBWMQ.cjs.map +1 -0
  33. package/dist/{chunk-LPYOIVLA.js → chunk-LKCYANMW.js} +3 -3
  34. package/dist/{chunk-W3GXSUSQ.cjs → chunk-LPLCWZTM.cjs} +5087 -1283
  35. package/dist/chunk-LPLCWZTM.cjs.map +1 -0
  36. package/dist/chunk-MMVHBKMM.js +753 -0
  37. package/dist/chunk-MMVHBKMM.js.map +1 -0
  38. package/dist/{chunk-POGBUYWE.cjs → chunk-ST7E3NEE.cjs} +857 -859
  39. package/dist/chunk-ST7E3NEE.cjs.map +1 -0
  40. package/dist/{chunk-7VOHOPLW.cjs → chunk-TCKIXI46.cjs} +59 -59
  41. package/dist/{chunk-7VOHOPLW.cjs.map → chunk-TCKIXI46.cjs.map} +1 -1
  42. package/dist/{chunk-XIOMMGPD.cjs → chunk-TFOPHZ3U.cjs} +1 -1
  43. package/dist/chunk-TFOPHZ3U.cjs.map +1 -0
  44. package/dist/{chunk-Z4BC6M74.js → chunk-UBIXVXPR.js} +2 -2
  45. package/dist/{chunk-BLWCAQCW.js → chunk-VXR7XWMF.js} +4574 -770
  46. package/dist/chunk-VXR7XWMF.js.map +1 -0
  47. package/dist/{chunk-CZOXTEMN.js → chunk-XICA4PVO.js} +392 -421
  48. package/dist/chunk-XICA4PVO.js.map +1 -0
  49. package/dist/{chunk-HNS7UHCM.js → chunk-XK5LZKBD.js} +1 -1
  50. package/dist/chunk-XK5LZKBD.js.map +1 -0
  51. package/dist/cms/index.cjs +146 -0
  52. package/dist/cms/index.cjs.map +1 -0
  53. package/dist/cms/index.d.cts +51 -0
  54. package/dist/cms/index.d.ts +51 -0
  55. package/dist/cms/index.js +146 -0
  56. package/dist/cms/index.js.map +1 -0
  57. package/dist/{export-CEXEzqBf.d.cts → export-BJE8T0YA.d.cts} +279 -191
  58. package/dist/{export-DIkoK8-r.d.ts → export-Con3UKkm.d.ts} +279 -191
  59. package/dist/image-editor/index.cjs +1848 -1218
  60. package/dist/image-editor/index.cjs.map +1 -1
  61. package/dist/image-editor/index.d.cts +85 -93
  62. package/dist/image-editor/index.d.ts +85 -93
  63. package/dist/image-editor/index.js +871 -241
  64. package/dist/image-editor/index.js.map +1 -1
  65. package/dist/opentype-BZEOSOX3.d.ts +188 -0
  66. package/dist/opentype-Dpe75vL5.d.cts +188 -0
  67. package/dist/paint/index.cjs +4 -4
  68. package/dist/paint/index.d.cts +2 -2
  69. package/dist/paint/index.d.ts +2 -2
  70. package/dist/paint/index.js +3 -3
  71. package/dist/paint-editor/index.cjs +147 -145
  72. package/dist/paint-editor/index.cjs.map +1 -1
  73. package/dist/paint-editor/index.d.cts +9 -8
  74. package/dist/paint-editor/index.d.ts +9 -8
  75. package/dist/paint-editor/index.js +7 -5
  76. package/dist/paint-editor/index.js.map +1 -1
  77. package/dist/raster/index.cjs +53 -3
  78. package/dist/raster/index.cjs.map +1 -1
  79. package/dist/raster/index.d.cts +62 -91
  80. package/dist/raster/index.d.ts +62 -91
  81. package/dist/raster/index.js +59 -9
  82. package/dist/{render-BEriFuqK.d.cts → render-B1K_OoLy.d.cts} +87 -2
  83. package/dist/{render-tjzKaik-.d.ts → render-CrmHOgpo.d.ts} +87 -2
  84. package/dist/{retouch-CEIKR22W.d.cts → retouch-Bxkuc0KH.d.cts} +1 -1
  85. package/dist/{retouch-BXmeSCaB.d.ts → retouch-Do6tBs2H.d.ts} +1 -1
  86. package/dist/{surface-C8RRg_Bh.d.cts → surface-Cn30xIV6.d.cts} +6 -1
  87. package/dist/{surface-C8RRg_Bh.d.ts → surface-Cn30xIV6.d.ts} +6 -1
  88. package/dist/{svg-D_cfkhlB.d.cts → svg-BnRj0q8i.d.cts} +16 -4
  89. package/dist/{svg-wIaKLrU0.d.ts → svg-CmmBFfGT.d.ts} +16 -4
  90. package/dist/{types-DtL_qLFz.d.ts → types-1SUQKDAw.d.ts} +273 -4
  91. package/dist/{types-DyQq-WPY.d.cts → types-yINF17Ta.d.cts} +273 -4
  92. package/dist/vector/index.cjs +12170 -7343
  93. package/dist/vector/index.cjs.map +1 -1
  94. package/dist/vector/index.d.cts +1579 -16
  95. package/dist/vector/index.d.ts +1579 -16
  96. package/dist/vector/index.js +6303 -1476
  97. package/dist/vector/index.js.map +1 -1
  98. package/dist/warp-B39VsOtd.d.cts +348 -0
  99. package/dist/warp-DMN30aY6.d.ts +348 -0
  100. package/dist/zlib-dxQdgHyN.d.cts +95 -0
  101. package/dist/zlib-dxQdgHyN.d.ts +95 -0
  102. package/package.json +9 -2
  103. package/skills/pixerate-image-editor/SKILL.md +13 -36
  104. package/skills/pixerate-image-editor/references/color-management.md +42 -0
  105. package/skills/pixerate-image-editor/references/photoshop-files.md +41 -0
  106. package/skills/pixerate-paint-editor/SKILL.md +136 -4
  107. package/skills/pixerate-vector/SKILL.md +72 -2
  108. package/dist/chunk-BLWCAQCW.js.map +0 -1
  109. package/dist/chunk-CZOXTEMN.js.map +0 -1
  110. package/dist/chunk-HNS7UHCM.js.map +0 -1
  111. package/dist/chunk-JLYX4V57.cjs +0 -2001
  112. package/dist/chunk-JLYX4V57.cjs.map +0 -1
  113. package/dist/chunk-KB2YBCVS.js +0 -2001
  114. package/dist/chunk-KB2YBCVS.js.map +0 -1
  115. package/dist/chunk-LQEEDHOP.js.map +0 -1
  116. package/dist/chunk-POGBUYWE.cjs.map +0 -1
  117. package/dist/chunk-W3GXSUSQ.cjs.map +0 -1
  118. package/dist/chunk-XIOMMGPD.cjs.map +0 -1
  119. package/dist/chunk-YGIMK4NX.cjs.map +0 -1
  120. package/dist/homography-CZ-tFjay.d.cts +0 -50
  121. package/dist/homography-Ctfjoc1b.d.ts +0 -50
  122. package/dist/warp-CWHZzE3x.d.ts +0 -118
  123. package/dist/warp-D5jz_tN7.d.cts +0 -118
  124. /package/dist/{chunk-LPYOIVLA.js.map → chunk-LKCYANMW.js.map} +0 -0
  125. /package/dist/{chunk-Z4BC6M74.js.map → chunk-UBIXVXPR.js.map} +0 -0
@@ -0,0 +1,42 @@
1
+ # Colour management
2
+
3
+ The document has a colour profile, its working space: the colours its RGB numbers mean. Missing
4
+ means sRGB. The viewport assumes an sRGB display and converts other working spaces for display.
5
+
6
+ ## Working method
7
+
8
+ 1. **Read first**: `get_color_profile` gives the document's profile, any Proof Setup, and the
9
+ built-in profiles (`srgb`, `display-p3`, `adobe-rgb-compat`, `prophoto-compat`,
10
+ `linear-srgb`, `rec2020`, grey, `lab-d50`, `coated-cmyk`).
11
+ 2. **Assign or convert?** `assign_profile` when the numbers are right but the profile is wrong
12
+ or missing (a file saved without its profile): the look changes, the numbers do not.
13
+ `convert_to_profile` to move the image into another space keeping its look (for a wide-gamut
14
+ edit, convert to `display-p3` or `prophoto-compat`; for the web, convert to `srgb`). Each is one
15
+ undo step.
16
+ 3. **Pick the intent**: `relative` (default) for photos, keeping in-gamut colours exact and
17
+ clipping the rest; `perceptual` when much of the image is out of gamut and smoothness matters
18
+ more than exactness; `saturation` for charts and logos; `absolute` only for proofing a paper
19
+ colour. Keep black point compensation on unless asked.
20
+ 4. **Soft proof before printing**: `set_proof_setup` with `coated-cmyk` (or the printer's
21
+ profile as `icc:<base64>`), `gamutWarning: true` to grey out colours the press cannot hit;
22
+ look with `capture_view`; adjust (lower saturation in the greyed areas); then `off: true`.
23
+ 5. **Print documents**: `set_color_mode` `cmyk` with the press profile makes the document a
24
+ CMYK one: you keep editing RGB, the viewport proofs through the press, and `export_psd`
25
+ writes a CMYK PSD (the separation uses `intent`). Opening a CMYK PSD does this for you. Check
26
+ out-of-gamut colours with `set_proof_setup` `gamutWarning` before exporting.
27
+ 6. **Numbers for a print brief**: `convert_colors` gives CMYK percentages (values × 100) and
28
+ Lab for any `#rrggbb`, without changing the document.
29
+
30
+ ## Pitfalls
31
+
32
+ - The working space must be RGB: CMYK and Lab are document modes (`set_color_mode`) for
33
+ output, not spaces you edit numbers in. Adjustment layers keep their RGB settings in a CMYK or
34
+ Lab PSD, where Photoshop applies them to its own channels; `export_psd` warns.
35
+ - `convert_to_profile` converts pixel layers (and the source image). Shape and type colours,
36
+ layer effects and smart objects keep their numbers and are listed in `unconvertedLayerIds`:
37
+ check them and recolour if the look matters.
38
+ - Images opened from a URL or file in the browser arrive already converted to sRGB by the
39
+ browser, so their own profile is not kept; PSDs keep theirs (resource 1039).
40
+ - `export_psd` always embeds the profile; PNG and JPEG exports embed it when it is not sRGB.
41
+ - The first proof or conversion with `coated-cmyk` builds that profile, which takes a second or
42
+ two.
@@ -0,0 +1,41 @@
1
+ # Photoshop files
2
+
3
+ 1. **Inspect before opening.** `inspect_psd` lists every layer with the type it would become and
4
+ a status: `mapped` (held exactly), `approximated` (type, fill and shape layers come in as their
5
+ stored pixels; linked smart objects as their stored pixels; Photoshop smart filters other than
6
+ Box Blur are kept but not drawn; Dissolve becomes Normal; effects with gradient midpoints or
7
+ smoothness, noise gradients, glow jitter, legacy bevels or patterns missing from the file are
8
+ drawn approximately) or
9
+ `dropped` (Brightness/Contrast, Exposure, Channel Mixer, Gradient Map, Selective Color and
10
+ Color Lookup adjustments). Tell the user what would be lost before `import_psd` when anything
11
+ is not `mapped`.
12
+ 2. **Layer effects come in live**: every Photoshop layer style maps to an effect you can read
13
+ with `list_layer_effects` and change as usual, with the file's patterns (listed in
14
+ `list_layer_effects.patterns`) and its global light. An effects block the editor cannot read
15
+ is kept and written back by `export_psd`, but not drawn; the warnings say so.
16
+ 3. **`import_psd` replaces the document** (one undo step). 16- and 32-bit files keep their
17
+ depth (`get_image_info.bitDepth`). CMYK files are converted to RGB through their embedded (or
18
+ the default coated) CMYK profile and stay in CMYK mode, Lab files stay in Lab mode, so
19
+ `export_psd` writes them back as they came (`set_color_mode`); grayscale and indexed files are
20
+ converted to RGB; an RGB file's ICC profile becomes the document's colour profile. The
21
+ warnings say what changed. `export_psd` writes at the document's depth, mode and profile.
22
+ Change the depth with `set_bit_depth`: 16-bit for smooth gradients and strong grades, 32-bit
23
+ for linear-light HDR (layers blend in linear light there). Adjustment layers, blend modes,
24
+ merges and the exported merged image keep the depth; layer effects, layer filters, painting
25
+ and transforms still work in 8 bits on what they change, so grade a deep file with adjustment
26
+ layers rather than repainting it when the depth matters. Afterwards work with `list_layers` as
27
+ usual: there is no Background source image, every pixel comes from the layers.
28
+ 4. **Smart objects come in live**: embedded contents (a PSB opens as a nested document you can
29
+ edit with `edit_smart_object_contents`, a PNG as raster contents), the placement and warp, the
30
+ smart filters and the filter mask; the layer shows Photoshop's own pixels until you change it.
31
+ JPEG, TIFF and SVG contents are decoded only in a browser, so elsewhere such a smart object
32
+ cannot be transformed (the error says so). Photoshop filters we do not model stay in the list
33
+ (kind `psd`): hide, reorder, re-blend or remove them, and `export_psd` writes them back.
34
+ 5. **`export_psd` writes the stack as it is**, in the source frame: crop and rotation are not
35
+ applied, layer filters and depth masks are baked, annotation layers are rasterized (only in
36
+ a browser). Effects are written as Photoshop layer styles: an effects block opened from a PSD
37
+ goes back byte for byte while its effects are unchanged, and the patterns effects use (the
38
+ built-in ones too) are embedded. Only the first outer glow, inner glow, bevel, satin and
39
+ pattern overlay of a layer fit in a PSD. Smart objects are written as smart objects (an
40
+ unchanged one byte for byte); a Develop smart filter has no Photoshop filter and is left out of
41
+ the list (the pixels still show it). Read its `warnings` and pass them on. The file comes back as base64 (`data`).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pixerate-paint-editor
3
- description: How to make a picture in the Pixerate paint editor (natural media in the spirit of Painter, Rebelle and ArtRage) through its agent tools - canvas and paper (generated grain, depth, families from cold pressed watercolour to canvas), layers with painterly blend modes (watercolor, tint, highlight, shadow), dry-media brushes (pencil, pastel, charcoal, airbrush, marker, ink, erasers) with pressure, tilt, barrel rotation and velocity, blending tools (blender, smudge, Mixer Brush), brush behaviours (pick-up and mix ratios, dirty and multi-coloured brushes), the brush library, strokes that replay and vary, symmetry and perspective guides, tracing and reference images, harmonies, swatches, a mixing pad and pigment mixing, and PNG, JPEG, WebP, PSD and JSON output. Use when asked to paint, sketch, shade, blend, smudge, glaze, mix colours, paint symmetric or in perspective, trace an image, or when paint_stroke, set_paper, replay_strokes or mix_colors are available.
3
+ description: How to paint in the Pixerate paint editor (natural media) through its agent tools - canvas and paper (generated grain, depth, families from cold pressed watercolour to canvas), layers with painterly blend modes (watercolor, tint, highlight, shadow), dry media (pencil, pastel, charcoal, airbrush, marker, ink) with pen dynamics, wet media (watercolour, gouache and oil that flow, bloom, granulate and dry), thick impasto paint lit by a movable light, blending tools (blender, smudge, Mixer Brush), brush behaviours (pick-up and mix ratios, dirty and multi-coloured brushes), the brush library, replayable strokes, symmetry and perspective guides, tracing and reference images, harmonies, swatches, a mixing pad and pigment mixing, and PNG, JPEG, WebP, PSD and JSON output. Use when asked to paint, sketch, paint in watercolour, shade, blend, smudge, glaze, mix colours, paint symmetric or in perspective, trace an image, or when paint_stroke, set_paper, replay_strokes or mix_colors are available.
4
4
  ---
5
5
 
6
6
  # Paint editor
@@ -16,7 +16,19 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
16
16
  (pressure, tilt, velocity, jitter), a **rotation** mode (`fixed`, `stroke`, `barrel`) and an
17
17
  engine: `dab` (most media), `eraser`, `mixer` (the Mixer Brush: a reservoir of paint plus paint
18
18
  it picks up), `blender` (mixes the colours under and near the tip) or `smudge` (drags paint
19
- along the stroke).
19
+ along the stroke), `wet` (watercolour, gouache, oil and the wet tools, below), `impasto`
20
+ (thick paint with relief and material, below), `particle` (procedural particle brushes),
21
+ `bristle` (a tuft of bristles) or `sticker` (sprays editable stickers).
22
+ - **Wet media** (`engine: "wet"`, categories `watercolor` and `wet-tool`): a stroke lays water
23
+ and pigment on the layer's **wet layer**, a fluid simulation that keeps running after the
24
+ stroke: the water spreads until its edge is pinned by the paper, carries pigment out to the
25
+ rim as it dries (edge darkening), drops pigment into the paper's valleys (granulation), pushes
26
+ pigment back where new water flows in (blooms), bleeds between touching wet colours and runs
27
+ downhill on a tilted canvas. Paint stays wet until it dries by itself (a few thousand steps)
28
+ or `dry_paint` dries it; a dried wash is fixed, so the next wash **glazes** over it. A wet
29
+ brush's `wet.tool` is `paint`, `water`, `dry`, `blow`, `blend`, `smudge` or `blot`; `water`,
30
+ `pigment` (concentration), `body` (0 transparent watercolour .. 1 opaque gouache), `strength`
31
+ and `rewet` set it up. Every result says whether paint is still wet (`wet` / `stillWet`).
20
32
  - **Behaviour** (`behavior`, dab and mixer brushes) is how a brush treats paint already on the
21
33
  canvas: a **pick-up ratio** (how much paint each dab lifts and carries), a **mix ratio** (how
22
34
  much of the carried paint goes into what it lays down), **dirty** (keep the carried colour into
@@ -70,7 +82,9 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
70
82
  `repeat` for hatching, grass, foliage, rows, fans or spirals, in one undo step.
71
83
  8. **Check** with `render_preview` after each block of work, not after each stroke.
72
84
  `pick_color` reads exact values. Undo what made it worse.
73
- 9. **Deliver**: `export_image` (PNG, or JPEG / WebP in a browser), `export_psd` for Photoshop,
85
+ 9. **Watercolour** is its own way of working (see "Wet media" below): wet the paper or not,
86
+ lay washes light to dark, let them flow (`advance_wet_paint`), dry them (`dry_paint`), glaze.
87
+ 10. **Deliver**: `export_image` (PNG, or JPEG / WebP in a browser), `export_psd` for Photoshop,
74
88
  `save_document` to keep the painting with its strokes.
75
89
 
76
90
  ## Best practices
@@ -122,6 +136,77 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
122
136
  - **Save brushes you build** (`set_brush` then `save_brush`), and share them with
123
137
  `export_brushes` / `import_brushes`.
124
138
 
139
+ ## Wet media
140
+
141
+ 1. **Choose a watercolour paper** (`cold-pressed`, `rough-watercolor` for granulation and broken
142
+ edges, `hot-pressed` for smooth washes). Absorption, permeability and roughness of the paper
143
+ drive the simulation.
144
+ 2. **Plan light to dark.** Watercolour is transparent: you cannot paint light over dark (use
145
+ `gouache`, body 1, for that). Lay the lightest washes first.
146
+ 3. **Wet-in-wet or wet-on-dry.** `wet_paper` over an area first for soft, feathered, blooming
147
+ colour (skies, backgrounds); paint on dry paper for crisp edges with a darker rim.
148
+ 4. **Paint washes** with `watercolor-wash` (large, flat, very wet) in a few long strokes, then
149
+ shapes with `watercolor-round`, details with `watercolor-detail`. Colours touching while wet
150
+ bleed into each other; that is the point.
151
+ 5. **Let it flow, then dry.** `advance_wet_paint` (`seconds` 1..5) to let water spread, run and
152
+ bloom; `render_preview` shows the paint as it is now (wet paper looks a little darker).
153
+ `dry_paint` sets it where it is. Dry before glazing a second wash over a first, or the two
154
+ mix instead of layering.
155
+ 6. **Steer the water** with the wet tools: `add-water` (softens and lifts with `rewet`),
156
+ `hair-dryer` (stops a wash spreading), `blow` (pushes the water along the stroke),
157
+ `wet-blend` (evens out a wash), `wet-drag` (drags wet paint), `blot` (lifts wet paint: clouds,
158
+ highlights). `set_canvas_tilt` makes washes run downhill and very wet paint drip;
159
+ `set_flow_map` pushes water in a swirl, a direction or eddies.
160
+ 7. **Tune the medium** per layer with `set_wet_settings`: `granulation` (grainy pigment, needs a
161
+ rough paper), `edgeDarkening`, `bloom`, `bleed`, `viscosity` (runny .. thick), `evaporation`,
162
+ `pigmentWeight`, `pickup` (how easily dried paint lifts), `fixture` (staining).
163
+
164
+ - **Saving dries the paint** (deterministically): the saved file and every export hold dried
165
+ pixels; the editor keeps painting wet. A dry brush, fill, merge or duplicate on a wet layer
166
+ dries it first (in the same undo step).
167
+ - **Time** runs by itself in an editor on screen (`pause_wet_paint` stops it); for an agent with
168
+ no screen, nothing moves until `advance_wet_paint` or `dry_paint`.
169
+
170
+ ## Oils and thick paint
171
+
172
+ - **Wet oil** (`oil-round`, `oil-flat`; any wet brush with `wet.medium: "oil"`) runs on the wet
173
+ simulation as a thick, slow-drying medium: it barely flows, stays wet for minutes of simulated
174
+ time, and the brush picks up and mixes the wet oil it meets (`behavior.pickup` / `mix`), so
175
+ colours blend on the canvas. A layer takes the medium's wet settings the first time it holds
176
+ wet paint; keep oil and watercolour on separate layers. `set_instant_dry` on makes every wet
177
+ stroke dry as it ends (strokes stay exactly as laid).
178
+ - **Thick paint** (`engine: "impasto"`, category `impasto`) gives a layer relief (height) and
179
+ material (gloss, metallic) next to its colour, lit at render time by `set_lighting`
180
+ (azimuth, elevation, relief). Tools: `impasto-brush` (bristle ridges), `paint-tube` (blobs),
181
+ `palette-knife` (scrapes the relief flat and smears the paint), `paint-roller` (flat stippled
182
+ band), `gloop-pen` (glossy bead), `metallic-paint` (highlights in the paint's colour).
183
+ - **Loading and thinner**: `wet.load` / `impasto.load` below 1 make the brush run out along a
184
+ long stroke (dry-brush ends); `thinner` makes paint flatter and more transparent.
185
+ - **Light** is a view of the relief, not paint: move it (`set_lighting`) to read the texture
186
+ (a low elevation, 15..30°, shows brushwork best) and pick the final light before exporting.
187
+ `get_relief` reads a layer's relief; `flatten_relief` removes it but keeps the colour.
188
+ - **Metallic paper**: `set_paper` `metallic` 0..1 makes the grain sparkle under the light.
189
+
190
+ ## Procedural brushes, bristles, stickers and stencils
191
+
192
+ - **Particle brushes** (category `procedural`): `hair-strands` (strings of masses dragged behind
193
+ the pen: hair, fur, grass), `spring-ink` (springs that overshoot: lively ink lines),
194
+ `orbit-curls` (particles circling the pen: curls and spirals), `flow-fur` and `sparkle-dust`
195
+ (particles thrown into a swirling flow), `bead-trail` (beads along a springy path). Tune with
196
+ `particle` (kind, render dot / line / sequence, count, stiffness, damping, speed, gravity).
197
+ Draw slowly and with varying direction: the particles react to movement.
198
+ - **Bristle brushes** (category `bristle`): `bristle-round`, `bristle-flat`, `dry-brush`. Every
199
+ bristle draws its own line: press harder to splay the tuft, tilt to flatten it; soft bristles
200
+ bend into curves at turns; a low `bristle.load` runs dry into broken streaks.
201
+ - **Sticker spray** (category `sticker`): stamps (`star`, `leaf`, `confetti`, `flower`, `heart`,
202
+ `splat`, `sparkle`, `ring`, `dot`) sprayed along the stroke onto an **empty layer**, where each
203
+ stays an object: `list_stickers`, `update_sticker` (move, turn, resize, recolour, restamp),
204
+ `arrange_stickers`, `remove_stickers`. A sticker layer takes no other paint.
205
+ - **Stencils**: `add_stencil` lays a `ruler` or `arc` (strokes that start within `snap` px follow
206
+ it exactly: straight lines, circles, rainbows) or a `line` / `shape` mask (paint lands only on
207
+ one side or inside a rect, ellipse or polygon; `invert` for outside). Stencils stay until
208
+ removed (`remove_stencils`); masks are recorded with each stroke so replays keep them.
209
+
125
210
  ## Tool reference
126
211
 
127
212
  ### Canvas and paper
@@ -195,9 +280,41 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
195
280
  | `paint_stroke` | Paint one stroke through `points` (document px; `pressure` 0..1, `t` ms, `tiltX` / `tiltY` or `altitude` / `azimuth`, `twist`) with `brushId` (default the active brush), optional per-stroke `brush` changes, `color`, `layerId`, `seed`, `snapToPerspective`. The symmetry guide adds its copies; a sampling tracing image supplies the colour when `color` is missing. Returns `layerId`, `bounds`, `dabs`, `strokeId` and, for brushes that pick up paint, `mixerLoad` (what the brush carries now). Refused on locked, hidden or group layers, with the fix in the message. |
196
281
  | `list_strokes` | Read the recorded strokes, oldest first (default the last 100): id, layer, brush, colour, point count, seed, bounds. With `ids`, their points too. |
197
282
  | `replay_strokes` | Paint recorded `strokeIds` again: exactly, or varied by `dx` / `dy` (px), `rotate` (degrees clockwise), `scale` (brush size follows), `flipX`, `origin`, `pressureScale`, `color`, `brushId`, `layerId`, `repeat` (each copy applies the variation again). One undo step. Returns the new stroke ids, bounds and layers. |
198
- | `undo_paint` | Undo the last step. Returns what was undone and what is next. |
283
+ | `undo_paint` | Undo the last step (a wet stroke's undo puts the wet paint back as it was before it). Returns what was undone and what is next. |
199
284
  | `redo_paint` | Redo the step just undone. |
200
285
 
286
+ ### Wet media
287
+
288
+ | Tool | Use |
289
+ | --- | --- |
290
+ | `get_wet_paint` | Read the wet paint: `wet`, the clock, `paused`, `speed`, `tilt`, the kernel (`backend`, `message` when it runs slower than it could) and each wet layer (`wetCells`, `wetBounds`, `activeTiles`, settings, flow map). Call after wet strokes. |
291
+ | `advance_wet_paint` | Let time pass: `steps` (120 = one second at the default speed) or `seconds`. The paint spreads, blooms, runs and dries. Not an undo step. Returns `steps`, `clock`, `stillWet`, `layers`. Call after a group of wet strokes, before `render_preview`. |
292
+ | `dry_paint` | Dry wet paint at once where it is (one layer with `layerId` or all, optionally inside `rect`). One undo step. Returns `dried` (layer ids and rectangles) and `stillWet`. Dry before glazing over a wash. |
293
+ | `wet_paper` | Pre-wet the paper with clear water over `rect` (default the canvas) on a layer, `amount` 0..1, for wet-in-wet. One undo step. Returns the rectangle and `wet`. Then paint into it. |
294
+ | `set_wet_settings` | A layer's wet settings 0..1: `viscosity`, `evaporation`, `edgeDarkening`, `pigmentWeight`, `granulation`, `pickup`, `fixture`, `bloom`, `bleed`. Saved with the document, not an undo step. Returns `params`, `stillWet`. |
295
+ | `set_flow_map` | Push a layer's water in a pattern: `kind` linear (`angle`), swirl (`center`, `clockwise`), radial, turbulent (`scale`, `seed`) or none, at `strength`. Returns `flow`, `stillWet`. |
296
+ | `set_canvas_tilt` | Tilt the canvas (`angle` 0..90°, `direction` downhill clockwise from the bottom): wet paint runs downhill, very wet paint drips. Returns `tilt`, `stillWet`. |
297
+ | `pause_wet_paint` | Stop or resume time (`paused`) and set `speed` (steps per second). Editor state. |
298
+ | `set_water_overlay` | Show where the water is (`visible`), view only. |
299
+ | `set_instant_dry` | `on`: every wet stroke dries as it ends (same undo step); off (default) wet paint keeps moving. Returns `instantDry`. |
300
+
301
+ ### Thick paint and light
302
+
303
+ | Tool | Use |
304
+ | --- | --- |
305
+ | `set_lighting` | Move the light for thick paint and metallic paper: `azimuth` (degrees clockwise from the top), `elevation` (5..90), `relief` (0..1). Nothing is repainted; not an undo step. Returns the lighting. Use a low elevation to show brushwork. |
306
+ | `get_relief` | Read a layer's relief (`bounds`, `maxHeight` 0..255, null when flat) and the lighting. Changes nothing. |
307
+ | `flatten_relief` | Remove a layer's relief and material, keeping its colour. One undo step. Returns whether anything was flattened. |
308
+
309
+ ### Stickers
310
+
311
+ | Tool | Use |
312
+ | --- | --- |
313
+ | `list_stickers` | Read a layer's stickers bottom first: id, stamp, x, y, size, rotation, color, opacity. |
314
+ | `update_sticker` | Change one sticker by `id`: `stamp`, `x`, `y`, `size`, `rotation`, `color`, `opacity`. One undo step. Returns it. |
315
+ | `arrange_stickers` | Move stickers (`ids`) to the `front` or `back` of their layer. One undo step. |
316
+ | `remove_stickers` | Delete stickers by `ids`, or all on the layer. One undo step. |
317
+
201
318
  ### Guides
202
319
 
203
320
  | Tool | Use |
@@ -212,6 +329,9 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
212
329
  | `list_reference_images` | Read the reference images: id, name, size, placement, visibility. |
213
330
  | `update_reference_image` | Move, resize, rename, show or hide a reference panel. |
214
331
  | `remove_reference_image` | Remove a reference image. |
332
+ | `add_stencil` | Lay a stencil: `kind` ruler (`from`, `to`) or arc (`center`, `radius`, `startAngle`, `endAngle`) to guide strokes, line (`from`, `to`) or shape (`shape` rect / ellipse with `rect`, polygon with `points`) to mask; `mode` guide or mask, `invert`, `snap`, `feather`. Returns it with its id. |
333
+ | `update_stencil` | Move, reshape, switch or hide (`enabled`) a stencil by `id`. |
334
+ | `remove_stencils` | Remove stencils by `ids`, or all. |
215
335
  | `pick_reference_color` | Read a reference image's colour at its own pixel `x`, `y`; `setColor` makes it the paint colour. |
216
336
 
217
337
  ### View, input and output
@@ -223,6 +343,8 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
223
343
  | `render_preview` | See the painting (or `layerIds`) as a PNG, longest side `maxSide` (16..2048, default 512), with or without the `paper`. Render after each block of work. |
224
344
  | `export_image` | Export PNG (default), JPEG or WebP as base64, at `quality` and `scale` (≤ 1); `paper: false` gives a transparent PNG. JPEG / WebP need a browser canvas. |
225
345
  | `export_psd` | Export a PSD with every layer, the paper as a locked bottom layer, and the composite. Pigment and painterly modes are written as their nearest standard mode (`list_blend_modes` `psd`). Returns base64, size, `psb` and `warnings`. |
346
+ | `export_time_lapse` | Repaint the painting from its recorded strokes and events as a time-lapse: `frames` (about how many), `fps`, `maxSide`, `wetStepsPerFrame` (frames while wet paint flows), `holdMs`. Returns a contact sheet image, the frame count, size, duration, a video project of the frames and the ffmpeg command that renders `timelapse.mp4`; `includeFrames` adds every frame as base64 PNG. Changes nothing. |
347
+ | `export_high_res` | Repaint the painting from its strokes at `scale` 1..8 (brushes, grain, fills and wet events scaled): a PNG with real detail instead of upscaled pixels. Returns base64, size. Layers not painted with strokes come out empty. |
226
348
  | `save_document` | Get the document JSON (canvas, paper, layers as PNG data URLs, strokes unless `strokes: false`). |
227
349
  | `open_document` | Open a saved document JSON, replacing the painting and clearing the undo history. Returns the canvas, layers and any `problems`. |
228
350
 
@@ -255,5 +377,15 @@ is never part of a layer. Coordinates are document pixels, (0, 0) top-left, y do
255
377
  `replay_strokes` move the cursor first. Results and undo are the same; it is one more reason to
256
378
  paint a few long strokes and replay them rather than many short ones. A stroke fails with "A
257
379
  stroke is in progress" while the user is painting; try it again afterwards.
380
+ - **Wet paint keeps changing.** A preview right after a wet stroke shows it before it has
381
+ flowed; `advance_wet_paint` first. Paint that should stay exactly where it was laid needs
382
+ `dry_paint` (or a dry medium).
383
+ - **Wet strokes on one layer interact**; washes that must not mix go on separate layers, or dry
384
+ the first before painting the second (glazing). At most 8 layers hold wet paint at once.
385
+ - **Undoing far back** past the wet undo memory (512 MB by default) leaves that paint dry as it
386
+ looked, rather than wet.
387
+ - **Replays repeat what was recorded**: strokes, fills, clears, flattened relief and wet events.
388
+ Imported pixels, merges and layer moves are not data, so `export_time_lapse` and
389
+ `export_high_res` start those layers empty; paint with strokes when the replay matters.
258
390
  - **Recorded strokes are kept in saved documents**; `save_document` with `strokes: false` when
259
391
  only the pixels matter (smaller JSON).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pixerate-vector
3
- description: How to draw and edit vector artwork in the Pixerate vector editor through its vector.* commands - adding shapes and SVG paths, text (point, area, on a path, styles, Create Outlines), symbols and instances, CAD constraints (parallel, tangent, dimensions, auto-constrain), fills, strokes, stacked fills and strokes with blend modes, drop shadows, glows and blurs, clipping masks and opacity masks, gradients (linear, radial, conic, Oklab interpolation), stroke alignment, arrowheads, variable-width and tapered strokes, live corner radii, boolean operations and Pathfinder (unite, subtract, divide, trim), Shape Builder, paint bucket, live path effects (trim paths, repeater, zig zag, offset), envelope warps and free distort, blends and morphing, anchor editing (join, smooth, simplify, scissors, knife, eraser), align, distribute, group, stacking order, and SVG import and export. Use when creating an icon, logo, illustration, glyph, badge or any Bezier path artwork, or editing an SVG in a Pixerate vector editor.
3
+ description: How to draw and edit vector artwork in the Pixerate vector editor through its vector.* commands - adding shapes and SVG paths, text (point, area, on a path, styles, Create Outlines), symbols and instances, CAD constraints, artboards and frames with resizing constraints, connectors, fills, strokes, stacked fills and strokes with blend modes, drop shadows, glows and blurs, clipping and opacity masks, gradients (linear, radial, conic, mesh, freeform), stroke alignment, arrowheads, variable-width and tapered strokes, live corner radii, boolean operations and Pathfinder (unite, subtract, divide, trim), Shape Builder, paint bucket, path effects (trim, repeater, zig zag, offset), envelope warps and free distort, blends and morphing, anchor editing (join, smooth, simplify, knife, eraser), align, distribute, group, and SVG import and export. Use when creating an icon, logo, illustration, glyph, badge or any Bezier path artwork, or editing an SVG in a Pixerate vector editor.
4
4
  ---
5
5
 
6
6
  # Pixerate vector editor
@@ -38,6 +38,14 @@ carry a live effect stack. Every command is a `vector.*` command run with `run_c
38
38
  (`vector.editSymbol` … `vector.exitSymbolEdit`) changes every instance.
39
39
  - **Constraints** (CAD-style) keep geometric relations and dimensions between anchors, segments
40
40
  and round paths; they are solved after every edit, so later moves keep them.
41
+ - **Frames** are groups with a `frame` rectangle (`vector.listFrames`): they draw a background,
42
+ clip their children and select by their rectangle; top-level frames are **artboards**. When a
43
+ frame is resized its children follow their **resizing constraints** (horizontal `left` /
44
+ `right` / `leftRight` / `center` / `scale`, vertical `top` / `bottom` / `topBottom` / `center` /
45
+ `scale`) instead of scaling.
46
+ - **Connectors** are open paths with a `connector` whose ends are glued to other objects' sites
47
+ (the middle of a side, or the centre); they are routed again after every edit, so they follow
48
+ what they connect. A free end stays where it is.
41
49
  - Coordinates are document units. A rotated node stores its geometry in its own space: the
42
50
  `bounds` that `vector.list` reports are document-space, its `d` is the node's own.
43
51
 
@@ -64,6 +72,17 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
64
72
 
65
73
  ## Best practices
66
74
 
75
+ - **Diagrams with connectors.** Lay the boxes out first, then `vector.connect` them (in one
76
+ `run_commands` batch) rather than drawing lines: connectors stay attached when boxes move, and
77
+ `route: "elbow"` with a small `radius` reads well in flowcharts. Leave sides `auto` unless a
78
+ connector must leave a particular side.
79
+
80
+ - **Frames for anything that resizes.** Build screens, cards, buttons and banners inside a frame
81
+ (`vector.addFrame` or `vector.frameSelection`), set each child's constraints with
82
+ `vector.setResizing` (backgrounds and dividers `leftRight`, icons pinned to their corner, titles
83
+ `center`), then resize with `vector.setFrame` to produce other sizes from one design. Export each
84
+ artboard with `vector.exportFrameSvg`.
85
+
67
86
  - **Constraints for precise, editable geometry.** For technical drawings, diagrams, floor plans or
68
87
  any shape that must keep exact relations, draw it roughly, run `vector.autoConstrain`, then add
69
88
  the dimensions that matter (`vector.addConstraint` distance / angle / radius) and name them so
@@ -151,6 +170,8 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
151
170
 
152
171
  | Command | Use it to |
153
172
  | --- | --- |
173
+ | `vector.traceImage` | Turn a PNG (data URL) into vector paths in one group: `threshold` mode for one-colour art (logos, scans, silhouettes; `channel: "alpha"` for cut-outs), `color` mode for a stacked path per colour (`colors` 2–32). Raise `tolerance` for fewer anchors, `cornerRoundness` 0 for sharp polygons. Place it with `x`, `y`, `width`. Returns `{ id, paths }`; check `subpaths` counts and simplify or delete specks after. |
174
+ | `vector.addPathByDimensions` | Draw a path the way a CAD user types it: from `start`, each step `{ length, angle }` (degrees counter-clockwise on the page: 0 right, 90 up), `{ dx, dy }` or `{ x, y }`; `closed` joins the ends. Use it for exact technical outlines (brackets, floor plans, given lengths and angles) instead of computing coordinates by hand. Returns `{ id, anchors }`. |
154
175
  | `vector.addShape` | Add a `kind` `rect`, `ellipse`, `polygon` (`sides`, at least 3), `star` (`points`, `innerRatio` 0 to 1) or `line` at `x`, `y`, `width`, `height` (all required; for a line, width and height are the end's offset). `cornerRadius` and `cornerKind` give live corners; any style field and `name` apply. Uses the editor's default style for anything not given. Returns `{ id }`. |
155
176
  | `vector.addPath` | Add a path from SVG path data `d` (absolute or relative M, L, H, V, C, S, Q, T, A, Z; arcs and quadratics become cubics) in document units, with `name` and style fields; unset style comes from the editor defaults. Fails when `d` has no points. Returns `{ id }`. |
156
177
  | `vector.importSvg` | Add the shapes of SVG markup `svg` on top of the document, or replace the document with `replace: true`. Reads paths, basic shapes, groups, transforms, linear and radial gradients, `clip-path` / `mask` references (as mask groups) `<text>` (as point text: content, font, anchor and fill) and `<use>` (as instances of symbols made from what they refer to); skips images and foreign filters. |
@@ -166,6 +187,19 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
166
187
  | `vector.setWidthProfile` | Give strokes a variable width: a `preset` (uniform, taperStart, taperEnd, taperBoth, bulge, pinch, teardrop, wave, pressure; `uniform` removes it), explicit `points`, or a parametric `taper` and / or `wave`. Returns the profile points. |
167
188
  | `vector.setWidthPoint` | Set one width point of path `id`: `index` of an existing point (from the profile `vector.setWidthProfile` returns) or none to add one at `t` (0 to 1); `left` / `right` are side widths in document units. Returns the profile. |
168
189
 
190
+ ### Gradient meshes and freeform gradients
191
+
192
+ | Command | Use it to |
193
+ | --- | --- |
194
+ | `vector.setMeshGradient` | Fill paths with a gradient mesh: `rows` × `columns` smooth patches over their bounds, coloured per point (`colors`, row by row) or by four `corners`. Use for realistic shading (fruit, metal, skin, soft folds). Returns `{ meshes: [{ id, shading }] }`. |
195
+ | `vector.setMeshPoint` | Move a mesh point (`index`, row by row; `x`, `y` in document units) and / or set its `color` and `opacity`; neighbouring patches bend smoothly. Returns `{ id, shading }`. |
196
+ | `vector.setFreeformGradient` | Fill paths with a freeform gradient: colour `points` anywhere (with `spread` for pure-colour discs) and `lines` carrying colour along curves, or, with no points, four or more placed inside each path along `colors`. Use for soft, organic colour that a linear or radial gradient cannot make. Returns `{ gradients }`. |
197
+ | `vector.addFreeformPoint` | Add a colour point at `x`, `y` (default colour: what shows there). Returns `{ id, index, shading }`. |
198
+ | `vector.setFreeformPoint` | Move a freeform point or change its `color`, `opacity`, `spread`. Returns `{ id, shading }`. |
199
+ | `vector.removeFreeformPoint` | Remove a freeform point (never the last); later indices shift down. Returns `{ id, shading }`. |
200
+ | `vector.setFreeformLines` | Replace the freeform lines (point indices each curve runs through; `[]` removes them). Returns `{ id, shading }`. |
201
+ | `vector.getShading` | Read a path's mesh or freeform fill with points in document units (the indices the edit commands take). Call it before editing points. |
202
+
169
203
  ### Appearance: fill and stroke stacks, blend modes, filters
170
204
 
171
205
  | Command | Use it to |
@@ -256,6 +290,26 @@ the browser's shaper they are kept but not drawn until outlines are available.
256
290
  | `vector.setConstraintValue` | Set a dimension's value (by id or name) or a named parameter (`null` removes a parameter); values are expressions. Returns the summary. |
257
291
  | `vector.autoConstrain` | Add what a sketch nearly satisfies (tolerances `distanceTolerance`, `angleTolerance`), skipping redundant or conflicting candidates. Returns `{ ids }`. |
258
292
 
293
+ ### Frames and artboards
294
+
295
+ | Command | Use it to |
296
+ | --- | --- |
297
+ | `vector.listFrames` | Read every frame: id, name, parent, whether it is an artboard (top-level), its rectangle, fill and clip, document bounds, and its children's resizing constraints. Call before resizing or exporting frames. |
298
+ | `vector.addFrame` | Add an empty artboard at `x, y, width, height` (white unless `fill`; `adopt: true` takes in the top-level objects it encloses). Use for screens, cards, pages and export areas. Returns the frame as listed. |
299
+ | `vector.frameSelection` | Put objects sharing a parent into a frame fitted to their bounds plus `padding` (no fill unless given), in their place. Use to turn finished art into a resizable component. Returns the frame as listed. |
300
+ | `vector.setFrame` | Move or resize a frame's rectangle (`x`, `y`, `width`, `height`; children follow their constraints) or change its `fill` / `clip`. Returns `{ frames }`. Set the children's constraints first. |
301
+ | `vector.setResizing` | Set how children of a frame follow it on resize (`horizontal`, `vertical`; a missing axis keeps its value). Fails on objects not directly inside a frame. Returns `{ nodes: [{ id, horizontal, vertical }] }`. |
302
+ | `vector.exportFrameSvg` | Export one frame as an SVG of its own size (its corner at the origin). Returns `{ svg, width, height }`; use it per artboard instead of `vector.exportSvg`. |
303
+
304
+ ### Connectors
305
+
306
+ | Command | Use it to |
307
+ | --- | --- |
308
+ | `vector.connect` | Join two objects (or free points) with a connector: `start` / `end` as `{ nodeId, side? }` (side `auto` by default: the side facing the other end) or `{ x, y }`, `route` straight / elbow / curved, elbow `radius`, `gap`, stroke and arrowheads (a triangle at the end by default). Use for flowcharts and diagrams instead of drawing lines. Returns the connector as listed. |
309
+ | `vector.setConnector` | Reglue an end (`{ nodeId, side? }`), unglue it (`null`), or change `route`, `radius`, `gap`; also turns a plain open path into a connector. Returns `{ connectors }`. |
310
+ | `vector.listConnectors` | Read every connector: route and each end's glued object, side setting, side in use and position. |
311
+ | `vector.listConnectionSites` | Read an object's sites (top, right, bottom, left, centre) with positions and outward normals, to pick a `side`. |
312
+
259
313
  ### Masks and clipping
260
314
 
261
315
  | Command | Use it to |
@@ -310,10 +364,26 @@ contents whole while you work, without losing the mask.
310
364
  | Command | Use it to |
311
365
  | --- | --- |
312
366
  | `vector.setEditing` | Set editing behaviour: `keepShapeOnDelete`, `curvatureMoves`, `pencilSmoothing` (0 to 1), `recognizeShapes`, `eraserSize`, `pencilPressure` (pen, all, off). Returns the settings. |
313
- | `vector.setTool` | Switch the interactive tool (select, direct, pen, pencil, rect, ellipse, polygon, star, line, scissors, knife, eraser, width, shapeBuilder, paintBucket, blend, gradient, envelope, type, typePath). Only for handing the canvas to the user in a given mode; commands do not need a tool. |
367
+ | `vector.getSnapOptions` | Read how drawing snaps for people at the pointer: grid, objects, guides, threshold, polar `angles`, object snap `tracking`, `trackPolar`, `polarRelative`. |
368
+ | `vector.setSnapOptions` | Set those options, e.g. `polarIncrement: 15` for 15° polar tracking, or a grid, before handing the canvas to the user. Moves nothing. Returns the options. |
369
+ | `vector.setTool` | Switch the interactive tool (select, direct, pen, pencil, rect, ellipse, polygon, star, line, scissors, knife, eraser, width, shapeBuilder, paintBucket, blend, gradient, envelope, type, typePath, frame, connector). Only for handing the canvas to the user in a given mode; commands do not need a tool. |
314
370
 
315
371
  ## Pitfalls
316
372
 
373
+ - Mesh and freeform fills draw as fine tiles, not SVG gradients: they cannot be edited with
374
+ `vector.setGradient` or as stops, and other tools see them as SVG patterns. Point indices
375
+ shift after `vector.removeFreeformPoint`; read them again with `vector.getShading`.
376
+
377
+ - A connector's geometry is regenerated after every edit while an end is glued: editing its
378
+ anchors directly does not stick. Unglue the end (`vector.setConnector` with `null`) or change
379
+ `route` instead. Connectors cannot be glued to connectors.
380
+
381
+ - Scaling a frame (`vector.scale`, the selection handles) lays its children out by their
382
+ constraints, so it is a resize, not a zoom; group the frame (or scale its children) to scale the
383
+ art itself. A frame clips by default: objects moved outside it disappear (`clip: false` shows
384
+ them). Moving an object over a frame does not put it inside; use `vector.frameSelection` or
385
+ `adopt`.
386
+
317
387
  - The `d` in `vector.list` draws live corners cut, which adds anchors. On a path with corner
318
388
  radii, anchor indices counted from `d` do not match the stored anchors; count anchors on a path
319
389
  without corners, or clear corners first.