@pixerate/editor 0.112.0 → 0.114.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.
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/animation-editor/index.cjs +60 -54
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +3 -3
- package/dist/animation-editor/index.d.ts +3 -3
- package/dist/animation-editor/index.js +14 -8
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/builtin-CY97ppKM.d.cts +354 -0
- package/dist/builtin-CY97ppKM.d.ts +354 -0
- package/dist/canvas/index.cjs +3 -3
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.js +9 -9
- package/dist/chunk-26PGXHY7.cjs +753 -0
- package/dist/chunk-26PGXHY7.cjs.map +1 -0
- package/dist/chunk-2OJACTPR.cjs +929 -0
- package/dist/chunk-2OJACTPR.cjs.map +1 -0
- package/dist/chunk-3UFGNHSP.js +929 -0
- package/dist/chunk-3UFGNHSP.js.map +1 -0
- package/dist/{chunk-YGIMK4NX.cjs → chunk-5OVJHMZQ.cjs} +757 -825
- package/dist/chunk-5OVJHMZQ.cjs.map +1 -0
- package/dist/chunk-643B2HKC.cjs +534 -0
- package/dist/chunk-643B2HKC.cjs.map +1 -0
- package/dist/chunk-6FCKOS2B.js +534 -0
- package/dist/chunk-6FCKOS2B.js.map +1 -0
- package/dist/chunk-BRLYOPLT.js +2574 -0
- package/dist/chunk-BRLYOPLT.js.map +1 -0
- package/dist/{chunk-LQEEDHOP.js → chunk-C6C5PDKU.js} +759 -761
- package/dist/chunk-C6C5PDKU.js.map +1 -0
- package/dist/chunk-DFQEX3AM.cjs +781 -0
- package/dist/chunk-DFQEX3AM.cjs.map +1 -0
- package/dist/{chunk-CZOXTEMN.js → chunk-EUVSQ25B.js} +336 -404
- package/dist/chunk-EUVSQ25B.js.map +1 -0
- package/dist/chunk-G5NMLUVF.cjs +2574 -0
- package/dist/chunk-G5NMLUVF.cjs.map +1 -0
- package/dist/chunk-LKCYANMW.js +781 -0
- package/dist/chunk-LKCYANMW.js.map +1 -0
- package/dist/{chunk-W3GXSUSQ.cjs → chunk-LPLCWZTM.cjs} +5087 -1283
- package/dist/chunk-LPLCWZTM.cjs.map +1 -0
- package/dist/chunk-MMVHBKMM.js +753 -0
- package/dist/chunk-MMVHBKMM.js.map +1 -0
- package/dist/{chunk-POGBUYWE.cjs → chunk-ST7E3NEE.cjs} +857 -859
- package/dist/chunk-ST7E3NEE.cjs.map +1 -0
- package/dist/{chunk-7VOHOPLW.cjs → chunk-TCKIXI46.cjs} +59 -59
- package/dist/{chunk-7VOHOPLW.cjs.map → chunk-TCKIXI46.cjs.map} +1 -1
- package/dist/{chunk-XIOMMGPD.cjs → chunk-TFOPHZ3U.cjs} +1 -1
- package/dist/chunk-TFOPHZ3U.cjs.map +1 -0
- package/dist/{chunk-Z4BC6M74.js → chunk-UBIXVXPR.js} +2 -2
- package/dist/{chunk-BLWCAQCW.js → chunk-VXR7XWMF.js} +4574 -770
- package/dist/chunk-VXR7XWMF.js.map +1 -0
- package/dist/{chunk-HNS7UHCM.js → chunk-XK5LZKBD.js} +1 -1
- package/dist/chunk-XK5LZKBD.js.map +1 -0
- package/dist/cms/index.cjs +146 -0
- package/dist/cms/index.cjs.map +1 -0
- package/dist/cms/index.d.cts +51 -0
- package/dist/cms/index.d.ts +51 -0
- package/dist/cms/index.js +146 -0
- package/dist/{export-DNu_Jr8p.d.ts → export-_1dUKwpF.d.ts} +326 -195
- package/dist/{export-DBba-buV.d.cts → export-b6NjCZ5-.d.cts} +326 -195
- package/dist/image-editor/index.cjs +2377 -1291
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +149 -97
- package/dist/image-editor/index.d.ts +149 -97
- package/dist/image-editor/index.js +1343 -257
- package/dist/image-editor/index.js.map +1 -1
- package/dist/opentype-BZEOSOX3.d.ts +188 -0
- package/dist/opentype-Dpe75vL5.d.cts +188 -0
- package/dist/paint/index.cjs +63 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +30 -3
- package/dist/paint/index.d.ts +30 -3
- package/dist/paint/index.js +62 -3
- package/dist/paint-editor/index.cjs +146 -145
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +9 -8
- package/dist/paint-editor/index.d.ts +9 -8
- package/dist/paint-editor/index.js +6 -5
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +53 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +62 -91
- package/dist/raster/index.d.ts +62 -91
- package/dist/raster/index.js +59 -9
- package/dist/{render-BEriFuqK.d.cts → render-B1K_OoLy.d.cts} +87 -2
- package/dist/{render-tjzKaik-.d.ts → render-CrmHOgpo.d.ts} +87 -2
- package/dist/{blending-aOE6Y3UE.d.cts → retouch-Bxkuc0KH.d.cts} +219 -2
- package/dist/{blending-DXl06NSx.d.ts → retouch-Do6tBs2H.d.ts} +219 -2
- package/dist/{surface-C8RRg_Bh.d.ts → surface-Cn30xIV6.d.cts} +6 -1
- package/dist/{surface-C8RRg_Bh.d.cts → surface-Cn30xIV6.d.ts} +6 -1
- package/dist/{svg-D_cfkhlB.d.cts → svg-BnRj0q8i.d.cts} +16 -4
- package/dist/{svg-wIaKLrU0.d.ts → svg-CmmBFfGT.d.ts} +16 -4
- package/dist/{types-DtL_qLFz.d.ts → types-1SUQKDAw.d.ts} +273 -4
- package/dist/{types-DyQq-WPY.d.cts → types-yINF17Ta.d.cts} +273 -4
- package/dist/vector/index.cjs +12170 -7343
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +1579 -16
- package/dist/vector/index.d.ts +1579 -16
- package/dist/vector/index.js +6303 -1476
- package/dist/vector/index.js.map +1 -1
- package/dist/warp-B39VsOtd.d.cts +348 -0
- package/dist/warp-DMN30aY6.d.ts +348 -0
- package/dist/zlib-dxQdgHyN.d.cts +95 -0
- package/dist/zlib-dxQdgHyN.d.ts +95 -0
- package/package.json +6 -1
- package/skills/pixerate-image-editor/SKILL.md +34 -34
- package/skills/pixerate-image-editor/references/color-management.md +37 -0
- package/skills/pixerate-image-editor/references/photoshop-files.md +39 -0
- package/skills/pixerate-image-editor/references/retouching.md +36 -0
- package/skills/pixerate-vector/SKILL.md +154 -5
- package/dist/chunk-BLWCAQCW.js.map +0 -1
- package/dist/chunk-CZOXTEMN.js.map +0 -1
- package/dist/chunk-FTBZPI77.cjs +0 -1
- package/dist/chunk-FTBZPI77.cjs.map +0 -1
- package/dist/chunk-HNS7UHCM.js.map +0 -1
- package/dist/chunk-JLYX4V57.cjs +0 -2001
- package/dist/chunk-JLYX4V57.cjs.map +0 -1
- package/dist/chunk-KB2YBCVS.js +0 -2001
- package/dist/chunk-KB2YBCVS.js.map +0 -1
- package/dist/chunk-LQEEDHOP.js.map +0 -1
- package/dist/chunk-POGBUYWE.cjs.map +0 -1
- package/dist/chunk-VKK5VS2T.js +0 -1
- package/dist/chunk-W3GXSUSQ.cjs.map +0 -1
- package/dist/chunk-XIOMMGPD.cjs.map +0 -1
- package/dist/chunk-YGIMK4NX.cjs.map +0 -1
- package/dist/homography-CZ-tFjay.d.cts +0 -50
- package/dist/homography-Ctfjoc1b.d.ts +0 -50
- package/dist/warp-CWHZzE3x.d.ts +0 -118
- package/dist/warp-D5jz_tN7.d.cts +0 -118
- /package/dist/{chunk-Z4BC6M74.js.map → chunk-UBIXVXPR.js.map} +0 -0
- /package/dist/{chunk-VKK5VS2T.js.map → cms/index.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pixerate-image-editor
|
|
3
|
-
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group, shape, type, annotation and smart object layers
|
|
3
|
+
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group, shape, type, annotation and smart object layers; masks, clipping, blend modes, merge, filters), smart objects and smart filters, shape and type layers, layer effects, adjustments, selections and masks, Free Transform, crop, rotate, flip, painting and the Mixer Brush, retouching (Clone Stamp, Healing Brush, Spot Healing, Smudge, Dodge, Burn, Sponge), undo, PSD, histogram and previews. Use when asked to edit, grade, correct, crop, straighten or mask an image, remove a blemish or spot, clone, dodge or burn, add a shadow, glow or outline, transform or warp a layer, draw a shape or arrow, add or edit text, make a smart object, or open or save a PSD, or when list_layers, set_adjustments, add_layer_effect, transform_layer, add_shape_layer, add_text_layer, paint_stroke, clone_stamp, spot_heal, import_psd or render_preview are available.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Image editor
|
|
@@ -183,39 +183,22 @@ drawing or editing either.
|
|
|
183
183
|
false` and `cleanEachStroke: false`, start with `load_mixer_brush`, read the brush with
|
|
184
184
|
`get_mixer_brush` when unsure, and reset it with `clean_mixer_brush`.
|
|
185
185
|
|
|
186
|
+
### Colour management
|
|
187
|
+
|
|
188
|
+
The working space, Assign / Convert to Profile with intents, soft proofing with a gamut warning
|
|
189
|
+
and colour conversions for print briefs: read [references/color-management.md](references/color-management.md).
|
|
190
|
+
### Retouching
|
|
191
|
+
|
|
192
|
+
Clone Stamp, Healing Brush, Spot Healing, Smudge, Dodge, Burn and Sponge: retouch on an empty
|
|
193
|
+
layer with `sample: "current-below"`, pick `spot_heal` for small spots, `heal_brush` for larger
|
|
194
|
+
flaws and `clone_stamp` to copy exactly, and keep strokes short and soft. Read
|
|
195
|
+
[references/retouching.md](references/retouching.md) before retouching.
|
|
196
|
+
|
|
186
197
|
### Photoshop files
|
|
187
198
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
Box Blur are kept but not drawn; Dissolve becomes Normal; effects with gradient midpoints or
|
|
192
|
-
smoothness, noise gradients, glow jitter, legacy bevels or patterns missing from the file are
|
|
193
|
-
drawn approximately) or
|
|
194
|
-
`dropped` (Brightness/Contrast, Exposure, Channel Mixer, Gradient Map, Selective Color and
|
|
195
|
-
Color Lookup adjustments). Tell the user what would be lost before `import_psd` when anything
|
|
196
|
-
is not `mapped`.
|
|
197
|
-
2. **Layer effects come in live**: every Photoshop layer style maps to an effect you can read
|
|
198
|
-
with `list_layer_effects` and change as usual, with the file's patterns (listed in
|
|
199
|
-
`list_layer_effects.patterns`) and its global light. An effects block the editor cannot read
|
|
200
|
-
is kept and written back by `export_psd`, but not drawn; the warnings say so.
|
|
201
|
-
3. **`import_psd` replaces the document** (one undo step). CMYK, Lab, grayscale, indexed, 16-bit
|
|
202
|
-
and 32-bit files are converted to 8-bit RGB, and ICC profiles are ignored; the warnings say
|
|
203
|
-
so. Afterwards work with `list_layers` as usual: there is no Background source image, every
|
|
204
|
-
pixel comes from the layers.
|
|
205
|
-
4. **Smart objects come in live**: embedded contents (a PSB opens as a nested document you can
|
|
206
|
-
edit with `edit_smart_object_contents`, a PNG as raster contents), the placement and warp, the
|
|
207
|
-
smart filters and the filter mask; the layer shows Photoshop's own pixels until you change it.
|
|
208
|
-
JPEG, TIFF and SVG contents are decoded only in a browser, so elsewhere such a smart object
|
|
209
|
-
cannot be transformed (the error says so). Photoshop filters we do not model stay in the list
|
|
210
|
-
(kind `psd`): hide, reorder, re-blend or remove them, and `export_psd` writes them back.
|
|
211
|
-
5. **`export_psd` writes the stack as it is**, in the source frame: crop and rotation are not
|
|
212
|
-
applied, layer filters and depth masks are baked, annotation layers are rasterized (only in
|
|
213
|
-
a browser). Effects are written as Photoshop layer styles: an effects block opened from a PSD
|
|
214
|
-
goes back byte for byte while its effects are unchanged, and the patterns effects use (the
|
|
215
|
-
built-in ones too) are embedded. Only the first outer glow, inner glow, bevel, satin and
|
|
216
|
-
pattern overlay of a layer fit in a PSD. Smart objects are written as smart objects (an
|
|
217
|
-
unchanged one byte for byte); a Develop smart filter has no Photoshop filter and is left out of
|
|
218
|
-
the list (the pixels still show it). Read its `warnings` and pass them on. The file comes back as base64 (`data`).
|
|
199
|
+
`inspect_psd` before `import_psd`, then work with `list_layers`; `export_psd` writes the stack
|
|
200
|
+
in the source frame at the document's bit depth, colour mode and profile. Read
|
|
201
|
+
[references/photoshop-files.md](references/photoshop-files.md) before opening or saving a PSD.
|
|
219
202
|
|
|
220
203
|
## Best practices
|
|
221
204
|
|
|
@@ -297,11 +280,11 @@ drawing or editing either.
|
|
|
297
280
|
| `get_selection` | Read the active selection: `empty`, `bounds` (natural pixels), `area` in pixels, `percent` of the image and a description. Check it after every select or modify step and before masking: a wand that covered 90% of the image is the wrong selection. |
|
|
298
281
|
| `list_layers` | Read the layer stack bottom to top as a tree: id, type (`pixel`, `adjustment`, `group`, `shape`, `annotation`, `smart`; smart objects add their `contents`, `smartFilters` and `filterMask`; shapes a `shape` summary of component ops and kinds and paint types, and `annotation` when migrated from one), name, document `bounds` of pixel layers, visibility, opacity, `fillOpacity`, blend, `clipped`, locks, a `mask` summary, an `effects` summary (master switch, scale, effect ids and kinds), pixel-layer `filters` (the Background's `develop` filter is the base adjustments), adjustment `kind` and `params`, group `children`, and which layer is `active`. Call it to understand a document with more than the Background before changing it; adjustment layer ids work with every adjustment-layer tool. |
|
|
299
282
|
| `list_layer_effects` | Read one layer's effects: `enabled` (master switch), `scale` (Scale Effects), `margin` (px they reach beyond the shape), `fromPsd`, and every effect with `id`, `kind`, `label` and all its settings. Also returns the `globalLight`, the `patterns` pattern effects can use and the effect `kinds`. Call before changing effects you did not add. |
|
|
300
|
-
| `get_image_info` | Read the geometry: source `image` size, `crop` box (source pixels, or null), `rotation` degrees, `flipH` / `flipV`, the `output` size after crop and rotation, the layer count and `canUndo` / `canRedo`. Call before cropping or selecting so coordinates are right. |
|
|
283
|
+
| `get_image_info` | Read the geometry: source `image` size, `crop` box (source pixels, or null), `rotation` degrees, `flipH` / `flipV`, the `output` size after crop and rotation, `bitDepth` (8, 16 or 32), the layer count and `canUndo` / `canRedo`. Call before cropping or selecting so coordinates are right. |
|
|
301
284
|
| `get_histogram` | Judge exposure numerically: per channel and luminance `mean`, `p1` and `p99` (0..255), and `clipping` percent at pure black and white per channel. Reads the last render, so call `render_preview` first. `bins` (16, 32, 64 or 256) adds the counts. Cheaper than another image for checking a tonal change. |
|
|
302
285
|
| `render_preview` | See the edited image (crop, adjustments, layers, annotations) as a PNG, or with `layerId` one layer alone. `maxSide` 16..2048 px, default 512. Images cost tokens: render after a group of edits, use 512 for overall look and 1024+ to judge clipping, edges and masks. Fails in environments without rendering. |
|
|
303
286
|
| `inspect_psd` | Read a PSD / PSB (`data` base64) without opening it: size, `depth`, `colorMode`, `resolution`, every layer bottom first with `psdKind`, the `type` it would become (`smart`, `shape` and `type` for Photoshop smart objects, shapes and text) and `status` (`mapped`, `approximated`, `dropped`) with `notes`, and the import `warnings`. Call before `import_psd`. |
|
|
304
|
-
| `export_psd` | Save the document as an
|
|
287
|
+
| `export_psd` | Save the document as an RGB PSD at its bit depth (PSB above 30000 px) with layers, groups, adjustment layers and masks. Returns `data` (base64), `size` in bytes, `psb` and `warnings` (crop or rotation not applied, filters and depth masks baked, annotations rasterized or left out, Pigment blends written as Normal). Shape and type layers are written as real Photoshop shape and type layers. Changes nothing. |
|
|
305
288
|
| `get_transform_frame` | Before a transform: what it would move (`content`, `moved`: pixels, mask, selection), its `frame` (document bounds of the content), `corners` (top-left, top-right, bottom-right, bottom-left) and `center`. `meshColumns` / `meshRows` also return an identity warp `mesh` over the frame to edit for `warp_layer`. Changes nothing. |
|
|
306
289
|
| `get_smart_object` | Read a smart object: `contents` (`id` shared by linked instances, `name`, `kind` raster or document, `width` / `height`, `decoded`, `fileType`, `linkedPath`, `instances`), `placement` (`corners`, `warp` in contents px, `interpolation`, and when `affine` the `scaleX` / `scaleY` in percent of the contents, `rotate`, `skewX`, `center`, `bounds`) and `smartFilters` (`enabled`, `filters` bottom to top with ids, settings, `blend`, `opacity`; kind `psd` is a Photoshop filter kept but not drawn; the filter `mask`). Call before changing a smart object. |
|
|
307
290
|
| `list_fonts` | Read the font families type layers can use here (generic families always work) and which shaper draws them. Call before choosing a font. |
|
|
@@ -326,6 +309,7 @@ drawing or editing either.
|
|
|
326
309
|
| `set_crop` | Crop to `x`, `y`, `width`, `height` in source pixels of the un-rotated image (see `get_image_info`). Non-destructive; refused if the box leaves the image. For an aspect ratio, compute the largest box of that ratio inside the image and centre it on the subject. Returns the geometry. |
|
|
327
310
|
| `reset_crop` | Remove the crop and show the whole image again. |
|
|
328
311
|
| `set_rotation` | Set the absolute rotation in degrees clockwise (-360..360). Quarter turns keep every pixel; small angles straighten a horizon but add transparent corners to crop away. Returns the geometry. |
|
|
312
|
+
| `set_bit_depth` | Image › Mode: `depth` 8, 16 or 32 (float, linear light). Up costs nothing; down rounds the layers' extra precision away (32 → 16 clips colour above 1). One undo step. Returns `bitDepth` and `changedLayerIds`. |
|
|
329
313
|
| `flip_image` | Mirror the image `horizontal` (left-right) or `vertical`. Avoid flipping images with text, logos or recognisable places. |
|
|
330
314
|
| `undo_image` | Undo the last edit (one tool call is one step). Returns `canUndo` / `canRedo`. |
|
|
331
315
|
| `redo_image` | Redo the edit you just undid. |
|
|
@@ -390,6 +374,21 @@ drawing or editing either.
|
|
|
390
374
|
| `get_mixer_brush` | Read-only. The Mixer Brush settings and what it carries (`reservoir` #rrggbb or null, `amount` left 0..1, `pickup` #rrggbb or null). Call it before a mixer stroke with `loadEachStroke: false`. |
|
|
391
375
|
| `load_mixer_brush` | Fill the Mixer Brush reservoir with `color` (default the foreground), amount 1; keeps the pickup. View state, not an undo step. Use before strokes with `loadEachStroke: false`. Returns the load. |
|
|
392
376
|
| `clean_mixer_brush` | Empty the Mixer Brush pickup well (`emptyReservoir: true` also drops the loaded paint, so it only smears). View state, not an undo step. Returns the load. |
|
|
377
|
+
| `get_color_profile` | Read-only. The document's profile (`name`, `builtin` id or null, `colorSpace`, `srgb`), the Proof Setup or null, and the built-in profiles. |
|
|
378
|
+
| `assign_profile` | Make the document's numbers mean colours in `profile` (built-in id or `icc:<base64>`; RGB only). The look changes, pixels do not. One undo step. Returns the profile. |
|
|
379
|
+
| `convert_to_profile` | Convert pixel layers into `profile` keeping their look (`intent`, `bpc`), then assign it. One undo step. Returns the profile, `convertedLayerIds` and `unconvertedLayerIds` (shape, type, effects, smart objects). |
|
|
380
|
+
| `set_proof_setup` | Soft-proof the viewport through `profile` (`intent`, `bpc`, `simulatePaper`, `gamutWarning`), or `off: true`. View state. Returns the setup. |
|
|
381
|
+
| `convert_colors` | Read-only. `colors` #rrggbb from the document's profile (or `from`) to `to`: channel `values` 0..1 (CMYK, RGB, grey), `hex` for RGB, and `lab`. |
|
|
382
|
+
| `clone_stamp` | Copy pixels from the clone source along `points`: each point paints what is at point + offset (source − first point, whole px). `source` `{x, y}` sets the source for this stroke (else the current one, see `set_clone_source`); `aligned` keeps the offset for later strokes; `sample` current \| current-below \| all; `brush` `{size, hardness, spacing, opacity, flow, smoothing, pressureSize, pressureOpacity}`; `layerId`, `channel` (a mask clones from itself). One undo step. Returns the layer, channel, `bounds`, dabs and `clone` `{offset, source, aligned}`. Call `set_clone_source` or pass `source` first. |
|
|
383
|
+
| `heal_brush` | As `clone_stamp`, then blends the cloned texture into the colour and light around the stroke (Poisson seamless cloning, when the stroke ends). Use for blemishes, wrinkles, dust and seams where the surroundings have the right tone. Returns as `clone_stamp`. |
|
|
384
|
+
| `spot_heal` | Remove what `points` cover with no source: `type` proximity-match (default: copies the best matching nearby patch, then heals it in) or smooth (fills from the edges). `sample`, `brush`, `layerId`, `channel`. One undo step. Returns the layer, channel, `bounds`, dabs and `spotHeal` `{offset}` (null for a smooth fill). |
|
|
385
|
+
| `smudge` | Drag colour along `points` like a finger in wet paint; `strength` 0..1 (default 0.5) is how far. Works on masks too. One undo step. Returns the layer, channel, `bounds` and dabs. |
|
|
386
|
+
| `dodge` | Lighten what `points` cover, most in `range` shadows \| midtones \| highlights, at `exposure` 0..1 (overlaps in one stroke never exceed it); `protectTones` keeps hue and saturation. Alpha kept. One undo step. Returns the layer, channel, `bounds` and dabs. |
|
|
387
|
+
| `burn` | As `dodge`, darkening. |
|
|
388
|
+
| `sponge` | Desaturate (`mode` desaturate, default) or saturate what `points` cover; `vibrance` damps clipping; passes compound, `brush.flow` sets each pass's strength. Pixels only. One undo step. Returns the layer, channel, `bounds` and dabs. |
|
|
389
|
+
| `get_retouch_options` | Read-only. The retouching defaults (`aligned`, `sample`, `spotType`, `range`, `exposure`, `protectTones`, `spongeMode`, `vibrance`, `strength`) and the `cloneSource` `{x, y, offset}` or null. Call before a clone or heal stroke without `source`. |
|
|
390
|
+
| `set_retouch_options` | Set those defaults (view state, not an undo step); each stroke tool can override them per call. Changing `aligned` clears the kept offset. Returns the options. |
|
|
391
|
+
| `set_clone_source` | Set the clone source `{x, y}` in document px (the Alt-click), or remove it with `clear: true`. View state. The next `clone_stamp` / `heal_brush` fixes the offset from its first point. Returns the source. |
|
|
393
392
|
| `fill_pixels` | Fill the selection (or the canvas without one / with `useSelection: false`) on pixels or a mask with `color`, `opacity`, `blend`. Returns the changed bounds. |
|
|
394
393
|
| `mix_colors` | Read-only. Mix 1 to 16 `colors` (`{color: #rrggbb, weight, strength?}`) like paint (Kubelka-Munk over reflectance spectra). Returns `mixed` (#rrggbb), `rgbLerp` (the plain RGB average, for comparison) and the normalised `weights`. Call it before `paint_stroke` / `fill_pixels` to pick a paint colour. |
|
|
395
394
|
| `clear_pixels` | Remove the selected pixels (alpha to 0; a transparency-locked layer or a mask gets the background colour). Returns the changed bounds. |
|
|
@@ -413,6 +412,7 @@ drawing or editing either.
|
|
|
413
412
|
`locks` only when the user wants that layer changed.
|
|
414
413
|
- `merge_down`, `merge_visible` and `flatten_image` merge annotation layers only in a browser
|
|
415
414
|
(they need a canvas); elsewhere they fail and say so.
|
|
415
|
+
- Retouching pitfalls (empty layers, sources, what ignores opacity): see references/retouching.md.
|
|
416
416
|
- `paint_stroke`, `fill_pixels` and `clear_pixels` need a visible pixel layer (or a layer with a
|
|
417
417
|
raster mask and `channel: "mask"`); adjustment, group, shape, type, annotation and smart object layers can
|
|
418
418
|
only be painted through their masks (and a smart object through `channel: "filter-mask"`).
|
|
@@ -0,0 +1,37 @@
|
|
|
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. **Numbers for a print brief**: `convert_colors` gives CMYK percentages (values × 100) and
|
|
24
|
+
Lab for any `#rrggbb`, without changing the document.
|
|
25
|
+
|
|
26
|
+
## Pitfalls
|
|
27
|
+
|
|
28
|
+
- The working space must be RGB: CMYK, grey and Lab profiles are for proofing and
|
|
29
|
+
`convert_colors` here.
|
|
30
|
+
- `convert_to_profile` converts pixel layers (and the source image). Shape and type colours,
|
|
31
|
+
layer effects and smart objects keep their numbers and are listed in `unconvertedLayerIds`:
|
|
32
|
+
check them and recolour if the look matters.
|
|
33
|
+
- Images opened from a URL or file in the browser arrive already converted to sRGB by the
|
|
34
|
+
browser, so their own profile is not kept; PSDs keep theirs (resource 1039).
|
|
35
|
+
- `export_psd` always embeds the profile; PNG and JPEG exports embed it when it is not sRGB.
|
|
36
|
+
- The first proof or conversion with `coated-cmyk` builds that profile, which takes a second or
|
|
37
|
+
two.
|
|
@@ -0,0 +1,39 @@
|
|
|
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, Lab, grayscale and indexed files are converted to
|
|
18
|
+
RGB; an RGB file's ICC profile becomes the document's colour profile. The warnings say what
|
|
19
|
+
changed. `export_psd` writes at the document's depth and embeds its profile. Change the depth
|
|
20
|
+
with `set_bit_depth`: 16-bit for smooth gradients and strong grades, 32-bit for linear-light
|
|
21
|
+
HDR (layers blend in linear light there). Adjustment layers, blend modes, merges and the
|
|
22
|
+
exported merged image keep the depth; layer effects, layer filters, painting and transforms
|
|
23
|
+
still work in 8 bits on what they change, so grade a deep file with adjustment layers rather
|
|
24
|
+
than repainting it when the depth matters. Afterwards work with `list_layers` as usual: there
|
|
25
|
+
is no Background source image, every pixel comes from the layers.
|
|
26
|
+
4. **Smart objects come in live**: embedded contents (a PSB opens as a nested document you can
|
|
27
|
+
edit with `edit_smart_object_contents`, a PNG as raster contents), the placement and warp, the
|
|
28
|
+
smart filters and the filter mask; the layer shows Photoshop's own pixels until you change it.
|
|
29
|
+
JPEG, TIFF and SVG contents are decoded only in a browser, so elsewhere such a smart object
|
|
30
|
+
cannot be transformed (the error says so). Photoshop filters we do not model stay in the list
|
|
31
|
+
(kind `psd`): hide, reorder, re-blend or remove them, and `export_psd` writes them back.
|
|
32
|
+
5. **`export_psd` writes the stack as it is**, in the source frame: crop and rotation are not
|
|
33
|
+
applied, layer filters and depth masks are baked, annotation layers are rasterized (only in
|
|
34
|
+
a browser). Effects are written as Photoshop layer styles: an effects block opened from a PSD
|
|
35
|
+
goes back byte for byte while its effects are unchanged, and the patterns effects use (the
|
|
36
|
+
built-in ones too) are embedded. Only the first outer glow, inner glow, bevel, satin and
|
|
37
|
+
pattern overlay of a layer fit in a PSD. Smart objects are written as smart objects (an
|
|
38
|
+
unchanged one byte for byte); a Develop smart filter has no Photoshop filter and is left out of
|
|
39
|
+
the list (the pixels still show it). Read its `warnings` and pass them on. The file comes back as base64 (`data`).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Retouching
|
|
2
|
+
|
|
3
|
+
1. **Retouch on a new empty layer** above the photo with `sample: "current-below"` (or `"all"`):
|
|
4
|
+
`clone_stamp`, `heal_brush` and `spot_heal` then paint onto that layer and the photo stays
|
|
5
|
+
untouched, so a bad stroke is easy to mask or erase. Smudge, Dodge, Burn and Sponge change the
|
|
6
|
+
pixels they touch, so run them on a duplicate (`duplicate_layer`) instead.
|
|
7
|
+
2. **Pick the tool by the job.** A small spot or blemish on skin, sky or a wall: `spot_heal` with
|
|
8
|
+
a brush a little larger than the spot (`proximity-match` copies a nearby patch; `smooth` fills
|
|
9
|
+
from the edges and suits flat areas). A larger flaw, or one next to an edge: `heal_brush` from a
|
|
10
|
+
clean source of the same texture; it takes the colour and light around the stroke, so the source
|
|
11
|
+
may be lighter or darker. Copy exactly (a repeat, a straight line, an edge): `clone_stamp`.
|
|
12
|
+
3. **Sources and offsets.** `set_clone_source` (or `source` on the stroke) is the Alt-click. The
|
|
13
|
+
first stroke fixes the offset = source − its first point; with `aligned` (default) later strokes
|
|
14
|
+
keep it, so the source moves with the brush; with `aligned: false` every stroke restarts at the
|
|
15
|
+
source point. The result's `clone.offset` and `clone.source` say what was used. Choose a source
|
|
16
|
+
that is clean for the whole length of the stroke: the stroke samples what was there before it,
|
|
17
|
+
never what it just painted.
|
|
18
|
+
4. **Use soft, short strokes** (`brush.hardness` 0..0.5, a size just over the flaw), and check each
|
|
19
|
+
with `capture_view` on the area (scale 2..4). Several small strokes heal better than one long one.
|
|
20
|
+
5. **Dodge and burn gently**: `exposure` 0.1..0.3, `range: "midtones"` for skin and form,
|
|
21
|
+
`"highlights"` / `"shadows"` to lift or deepen only those tones. A stroke never goes past its
|
|
22
|
+
exposure where its dabs overlap; another stroke builds on it. `protectTones` (default) keeps hue
|
|
23
|
+
and saturation. `sponge` with `mode: "desaturate"` takes colour out (a colour cast on teeth or
|
|
24
|
+
eyes), `saturate` adds it; passes compound, so use a low `brush.flow`.
|
|
25
|
+
6. **Smudge** drags colour along the stroke like a finger in wet paint (`strength` how far); for
|
|
26
|
+
blending paint colours use the Mixer Brush instead.
|
|
27
|
+
|
|
28
|
+
## Pitfalls
|
|
29
|
+
|
|
30
|
+
- The retouching tools need a source to be useful: `clone_stamp` / `heal_brush` refuse without a
|
|
31
|
+
clone source, and with `sample: "current"` an empty layer has nothing to copy (the stroke then
|
|
32
|
+
changes nothing). Sample `current-below` or `all` to retouch onto an empty layer.
|
|
33
|
+
- `heal_brush` and `spot_heal` show a plain clone or a dark trail while a person draws and blend
|
|
34
|
+
when the stroke ends; through the tools the result is already blended.
|
|
35
|
+
- `dodge`, `burn`, `sponge` and `smudge` ignore `brush.opacity` (exposure, flow and strength set
|
|
36
|
+
their strength) and `brush.blend`. The Sponge refuses masks, which have no colour.
|
|
@@ -1,13 +1,14 @@
|
|
|
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, fills, strokes, stacked fills and strokes with blend modes, drop shadows, glows and blurs, clipping masks and opacity masks, gradients (linear, radial, conic, Oklab
|
|
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), artboards and frames with resizing constraints, connectors, fills, strokes, stacked fills and strokes with blend modes, drop shadows, glows and blurs, clipping masks and opacity masks, gradients (linear, radial, conic, Oklab), 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
|
|
7
7
|
|
|
8
8
|
The vector document is an artboard (`width` x `height` in document units, y down) holding a tree
|
|
9
9
|
of **nodes**: `path` nodes (one or more subpaths of Bezier anchors, with fill, stroke and stroke
|
|
10
|
-
settings)
|
|
10
|
+
settings), `text` nodes (a string set as point text, area text or along a path, painted with
|
|
11
|
+
the same fills and strokes), `instance` nodes (a placed copy of a symbol) and `group` nodes. Groups can also be live booleans, live blends, mask groups, or
|
|
11
12
|
carry a live effect stack. Every command is a `vector.*` command run with `run_command` / `run_commands` (see
|
|
12
13
|
`pixerate-agent-tools` for batching with `"$0.id"` references, `atomic: true` and error codes).
|
|
13
14
|
|
|
@@ -28,6 +29,23 @@ carry a live effect stack. Every command is a `vector.*` command run with `run_c
|
|
|
28
29
|
inside the mask's outline (`clip`), or where it is bright (`luminance`) or opaque (`alpha`).
|
|
29
30
|
`invert` swaps shown and hidden. `vector.list` gives a mask group a `mask`
|
|
30
31
|
`{ type, invert, maskId, contents, enabled }`; a hidden mask (`enabled: false`) masks nothing.
|
|
32
|
+
- **Text** has a base `font` (family, weight, italic, size, tracking, leading, baseline shift,
|
|
33
|
+
underline, strike-through), optional runs that override fields over ranges (`start` / `end`
|
|
34
|
+
in UTF-16 code units, plus a range `fill`), a `paragraph` style and a `frame`: `point` (x, y
|
|
35
|
+
of the first baseline), `area` (a box it wraps in) or `path` (a line it follows).
|
|
36
|
+
- **Symbols** are reusable art kept with the document (`vector.listSymbols`), drawn by `instance`
|
|
37
|
+
nodes through a transform that, unlike other nodes', may scale and skew. Editing a symbol
|
|
38
|
+
(`vector.editSymbol` … `vector.exitSymbolEdit`) changes every instance.
|
|
39
|
+
- **Constraints** (CAD-style) keep geometric relations and dimensions between anchors, segments
|
|
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.
|
|
31
49
|
- Coordinates are document units. A rotated node stores its geometry in its own space: the
|
|
32
50
|
`bounds` that `vector.list` reports are document-space, its `d` is the node's own.
|
|
33
51
|
|
|
@@ -54,6 +72,39 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
|
|
|
54
72
|
|
|
55
73
|
## Best practices
|
|
56
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
|
+
|
|
86
|
+
- **Constraints for precise, editable geometry.** For technical drawings, diagrams, floor plans or
|
|
87
|
+
any shape that must keep exact relations, draw it roughly, run `vector.autoConstrain`, then add
|
|
88
|
+
the dimensions that matter (`vector.addConstraint` distance / angle / radius) and name them so
|
|
89
|
+
related sizes follow one another (`vector.setConstraintValue` with expressions like `w / 2`).
|
|
90
|
+
Check `vector.listConstraints` `dof`: aim for `fully` on parts that must not drift; `over`
|
|
91
|
+
means some constraints repeat others. Prefer few, meaningful constraints over many.
|
|
92
|
+
|
|
93
|
+
- **Symbols for repeats.** When the same art appears several times (icons in a set, trees in a
|
|
94
|
+
scene, bullets, a logo mark), make it once and place instances (`vector.makeSymbol`, then
|
|
95
|
+
`vector.placeSymbol` with `x` / `y` or a `transform`), so one edit in isolation changes them all.
|
|
96
|
+
Give each a clear name. Use `vector.setInstanceOptions` `fill` / `stroke` for colour variants and
|
|
97
|
+
`hidden` to drop a part, rather than detaching; detach only when one copy must diverge for good.
|
|
98
|
+
|
|
99
|
+
- **Text.** Use point text for labels and headlines, area text (`width`, `height`) for anything
|
|
100
|
+
that should wrap, text on a path for badges and seals. Check `overflow` in the summary every
|
|
101
|
+
text write returns: hidden lines or characters mean the box or path is too small. Keep one or
|
|
102
|
+
two families per design (`vector.listFonts` lists what the shaper has; a missing family draws
|
|
103
|
+
in a fallback and appears in `missingFonts`). Style ranges with `vector.setTextStyle` rather
|
|
104
|
+
than splitting text into separate nodes, so it still edits as one paragraph. Create Outlines
|
|
105
|
+
only for final artwork or logos that must not depend on fonts; keep a copy as text if it may
|
|
106
|
+
change.
|
|
107
|
+
|
|
57
108
|
- **Clean paths.** Use the fewest anchors that describe the shape: anchors at extrema (top,
|
|
58
109
|
bottom, left, right of a curve) and at true corners, handles horizontal or vertical at extrema,
|
|
59
110
|
each handle about a third of its segment. Run `vector.removeRedundantPoints` after
|
|
@@ -61,7 +112,8 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
|
|
|
61
112
|
keeps the outline by refitting neighbours.
|
|
62
113
|
- **Live corners over drawn arcs.** Give rectangles, polygons and stars a `cornerRadius`
|
|
63
114
|
(`vector.addShape`) or set it with `vector.setCorners`; the anchors stay sharp and editable and
|
|
64
|
-
radii shrink to fit short sides. Keep one radius scale across a design.
|
|
115
|
+
radii shrink to fit short sides. Keep one radius scale across a design. For app icons and UI
|
|
116
|
+
cards use `smoothing` (about 0.6) on `vector.setCorners` for continuous, squircle corners.
|
|
65
117
|
- **Non-destructive first.** Live booleans (`vector.boolean` with `live: true`), path effects
|
|
66
118
|
and envelopes keep the operands editable. A destructive boolean or Pathfinder replaces its
|
|
67
119
|
inputs; do that last, and only when asked for flat output.
|
|
@@ -118,9 +170,10 @@ Parameter details (gradient fields, effect parameters, width profiles, envelopes
|
|
|
118
170
|
|
|
119
171
|
| Command | Use it to |
|
|
120
172
|
| --- | --- |
|
|
173
|
+
| `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 }`. |
|
|
121
174
|
| `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 }`. |
|
|
122
175
|
| `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 }`. |
|
|
123
|
-
| `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,
|
|
176
|
+
| `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. |
|
|
124
177
|
| `vector.delete` | Delete nodes (`ids`). |
|
|
125
178
|
|
|
126
179
|
### Style
|
|
@@ -179,6 +232,70 @@ arrays, to build or replace a stack in one call.
|
|
|
179
232
|
| `vector.fillRegion` | Paint bucket: fill the area visible outlines enclose around `point` `[x, y]` with a new path in the current fill (islands stay holes). `gap` closes gaps up to that size between loose ends. Returns `{ id }`. |
|
|
180
233
|
| `vector.outlineStroke` | Turn strokes into filled shapes of exactly the painted area (alignment, caps, joins, dashes, arrowheads, width profiles included), above a copy keeping the fill. Returns the new ids. |
|
|
181
234
|
|
|
235
|
+
### Text
|
|
236
|
+
|
|
237
|
+
| Command | Use it to |
|
|
238
|
+
| --- | --- |
|
|
239
|
+
| `vector.listFonts` | See which families the text shaper can draw and whether it gives glyph outlines (`outlines`); read it before choosing fonts or calling `vector.createOutlines`. Returns `{ shaper, outlines, families }`. |
|
|
240
|
+
| `vector.addText` | Add point text (`x`, `y`: the first baseline's start), area text (`x`, `y`, `width`, `height`: wrapped in the box) or text along `path` (SVG path data, with `start`, `end`, `flip`, `orientation`, `baseline`). `font`, `paragraph`, `name`, `fill`, `stroke`, `strokeWidth` optional; black, no stroke by default. Returns the text summary (`id`, lines, bounds, overflow). |
|
|
241
|
+
| `vector.getText` | Read a text node: text, base font, runs as `{ start, end, style }`, paragraph, frame, fill, stroke, laid-out lines, document bounds, `overflow`, `outlines`, shaper and missing fonts. Call before editing ranges. |
|
|
242
|
+
| `vector.setText` | Replace `[start, end)` of the text with `text` (default the whole text; `start` = `end` inserts, `""` deletes). Inserted characters take the style before them. Returns the summary. |
|
|
243
|
+
| `vector.setTextStyle` | Set character fields (`fontFamily`, `fontWeight`, `italic`, `fontSize`, `tracking`, `leading`, `baselineShift`, `underline`, `strikethrough`; null clears) and `fill` over `[start, end)`; the whole text (default) changes the base font and the node's fill. Returns the summary with runs. |
|
|
244
|
+
| `vector.setParagraphStyle` | Set `align` (left, center, right, justify), `autoLeading`, indents and spacing for the node's paragraphs. Returns the summary. |
|
|
245
|
+
| `vector.setTextFrame` | Switch between point, area and path text (`kind`), resize an area (`width`, `height`), move the origin (`x`, `y`) or change path options. Returns the summary. |
|
|
246
|
+
| `vector.typeOnPath` | Turn path node `pathId` into text along it (it takes the path's place and drops its paint) with `text`, `font`, `paragraph` (`align` places it along the path) and path options. Returns the summary with the new id. |
|
|
247
|
+
| `vector.createOutlines` | Turn text (`ids`, or text inside groups; default the selection) into paths of its glyph outlines, keeping paint, effects, filters, placement and id. Needs `outlines: true` from `vector.listFonts`. Returns `{ ids }`. |
|
|
248
|
+
|
|
249
|
+
Fill, stroke, stacked layers, filters, blend modes, transforms, masks and blends work on text as
|
|
250
|
+
on paths (`vector.setStyle`, `vector.addFill`, `vector.addFilter`, `vector.transform`, …). Path
|
|
251
|
+
effects, envelopes and booleans act on its glyph outlines, so they need an outline shaper; with
|
|
252
|
+
the browser's shaper they are kept but not drawn until outlines are available.
|
|
253
|
+
|
|
254
|
+
### Symbols and instances
|
|
255
|
+
|
|
256
|
+
| Command | Use it to |
|
|
257
|
+
| --- | --- |
|
|
258
|
+
| `vector.listSymbols` | Read the symbols: id, name, the art's node ids (for `hidden`), bounds around the registration point, instance ids, and which symbol is being edited. |
|
|
259
|
+
| `vector.makeSymbol` | Turn objects sharing a parent (`ids`, default the selection) into a symbol, registration point at their centre, with an instance in their place. Returns `{ symbolId, instanceId, symbol }`. |
|
|
260
|
+
| `vector.placeSymbol` | Place an instance of `symbolId` with its registration point at `x`, `y` (default the artboard centre) or through `transform` (scale, rotate and skew allowed). Returns `{ id }`. |
|
|
261
|
+
| `vector.setInstanceOptions` | Change instances: `scaleStrokes` (default true), `fill` / `stroke` overrides painting all of the art (null clears), `hidden` art node ids. Returns the instances as listed. |
|
|
262
|
+
| `vector.replaceSymbol` | Make instances (`ids`) draw `symbolId` instead, keeping placement and colour overrides. Returns `{ ids }`. |
|
|
263
|
+
| `vector.detachInstance` | Break instances' link: they become plain groups of their art as drawn. Returns `{ ids }`. |
|
|
264
|
+
| `vector.editSymbol` | Enter isolation mode on a symbol (its id or an instance's): every command then edits the art in symbol space (registration point at 0, 0). Returns `{ symbolId, nodes }`. |
|
|
265
|
+
| `vector.exitSymbolEdit` | Leave isolation mode; the edited symbol's instances update. Returns `{ symbolId }`. |
|
|
266
|
+
| `vector.renameSymbol` | Rename `symbolId` to `name`. Returns the symbol summary. |
|
|
267
|
+
| `vector.deleteSymbol` | Delete `symbolId`; fails while instances use it unless `detach: true` turns them into groups. |
|
|
268
|
+
|
|
269
|
+
### Constraints
|
|
270
|
+
|
|
271
|
+
| Command | Use it to |
|
|
272
|
+
| --- | --- |
|
|
273
|
+
| `vector.listConstraints` | Read every constraint (id, kind, refs with anchor ids, value, name, evaluated value, satisfied), the parameters, the degrees of freedom left (`dof`, `status`, `redundant`, per path) and conflicts from the last solve. |
|
|
274
|
+
| `vector.addConstraint` | Add a constraint (`kind`, `refs` by `{ nodeId, subpath, index }` or anchor id, with `segment`, `handle` or `circle`; `value` / `name` / `axis` for dimensions) and solve. Fails, changing nothing, on conflicts or redundancy, naming the others. Returns `{ id, constraint }`. |
|
|
275
|
+
| `vector.removeConstraint` | Remove constraints by `ids`; geometry stays. |
|
|
276
|
+
| `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. |
|
|
277
|
+
| `vector.autoConstrain` | Add what a sketch nearly satisfies (tolerances `distanceTolerance`, `angleTolerance`), skipping redundant or conflicting candidates. Returns `{ ids }`. |
|
|
278
|
+
|
|
279
|
+
### Frames and artboards
|
|
280
|
+
|
|
281
|
+
| Command | Use it to |
|
|
282
|
+
| --- | --- |
|
|
283
|
+
| `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. |
|
|
284
|
+
| `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. |
|
|
285
|
+
| `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. |
|
|
286
|
+
| `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. |
|
|
287
|
+
| `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 }] }`. |
|
|
288
|
+
| `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`. |
|
|
289
|
+
|
|
290
|
+
### Connectors
|
|
291
|
+
|
|
292
|
+
| Command | Use it to |
|
|
293
|
+
| --- | --- |
|
|
294
|
+
| `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. |
|
|
295
|
+
| `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 }`. |
|
|
296
|
+
| `vector.listConnectors` | Read every connector: route and each end's glued object, side setting, side in use and position. |
|
|
297
|
+
| `vector.listConnectionSites` | Read an object's sites (top, right, bottom, left, centre) with positions and outward normals, to pick a `side`. |
|
|
298
|
+
|
|
182
299
|
### Masks and clipping
|
|
183
300
|
|
|
184
301
|
| Command | Use it to |
|
|
@@ -233,10 +350,22 @@ contents whole while you work, without losing the mask.
|
|
|
233
350
|
| Command | Use it to |
|
|
234
351
|
| --- | --- |
|
|
235
352
|
| `vector.setEditing` | Set editing behaviour: `keepShapeOnDelete`, `curvatureMoves`, `pencilSmoothing` (0 to 1), `recognizeShapes`, `eraserSize`, `pencilPressure` (pen, all, off). Returns the settings. |
|
|
236
|
-
| `vector.
|
|
353
|
+
| `vector.getSnapOptions` | Read how drawing snaps for people at the pointer: grid, objects, guides, threshold, polar `angles`, object snap `tracking`, `trackPolar`, `polarRelative`. |
|
|
354
|
+
| `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. |
|
|
355
|
+
| `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. |
|
|
237
356
|
|
|
238
357
|
## Pitfalls
|
|
239
358
|
|
|
359
|
+
- A connector's geometry is regenerated after every edit while an end is glued: editing its
|
|
360
|
+
anchors directly does not stick. Unglue the end (`vector.setConnector` with `null`) or change
|
|
361
|
+
`route` instead. Connectors cannot be glued to connectors.
|
|
362
|
+
|
|
363
|
+
- Scaling a frame (`vector.scale`, the selection handles) lays its children out by their
|
|
364
|
+
constraints, so it is a resize, not a zoom; group the frame (or scale its children) to scale the
|
|
365
|
+
art itself. A frame clips by default: objects moved outside it disappear (`clip: false` shows
|
|
366
|
+
them). Moving an object over a frame does not put it inside; use `vector.frameSelection` or
|
|
367
|
+
`adopt`.
|
|
368
|
+
|
|
240
369
|
- The `d` in `vector.list` draws live corners cut, which adds anchors. On a path with corner
|
|
241
370
|
radii, anchor indices counted from `d` do not match the stored anchors; count anchors on a path
|
|
242
371
|
without corners, or clear corners first.
|
|
@@ -267,5 +396,25 @@ contents whole while you work, without losing the mask.
|
|
|
267
396
|
- Filters and blend modes are drawn, not geometry: bounds, snapping, booleans and Outline Stroke
|
|
268
397
|
ignore them. A node's blend mode and filter isolate its layers, so layer blend modes inside a
|
|
269
398
|
node with a filter mix only with the node's own layers. Background blur is not available.
|
|
399
|
+
- Text positions are code units: an emoji or other character outside the Basic Multilingual
|
|
400
|
+
Plane counts 2. Take ranges from `vector.getText` rather than counting characters yourself.
|
|
401
|
+
- Scaling text scales its font size (by the square root of the area change) and an area box per
|
|
402
|
+
axis; it is never stretched. Skew is not kept on text.
|
|
403
|
+
- Without an outline shaper (`vector.listFonts` `outlines: false`), text exports as SVG `<text>`
|
|
404
|
+
positioned character by character; other viewers need the same fonts installed. Create Outlines
|
|
405
|
+
(with an outline shaper) when the SVG must look the same everywhere.
|
|
406
|
+
- An instance's `transform` may scale; its art's strokes scale with it unless `scaleStrokes: false`.
|
|
407
|
+
Transform commands act on the instance, not the art: edit the art with `vector.editSymbol`.
|
|
408
|
+
- While a symbol is being edited (`vector.listSymbols` `editing`), `vector.list` lists its art, not
|
|
409
|
+
the document. Always finish with `vector.exitSymbolEdit`. A symbol cannot contain an instance
|
|
410
|
+
of itself (directly or through another symbol).
|
|
411
|
+
- Constraint refs to anchors give them stable ids; later anchor edits keep them, but rebuilding a
|
|
412
|
+
path (booleans, Outline Stroke, Expand) drops them, and constraints on missing anchors are
|
|
413
|
+
removed. `segment` means the straight line between two anchors, even when the segment is curved;
|
|
414
|
+
`tangent` / `smooth` on one anchor act on its handles.
|
|
415
|
+
- After any edit the solver moves the rest of the geometry to keep the constraints; the anchors
|
|
416
|
+
you just moved move least. A fixed or fully constrained part will not move: remove or change a
|
|
417
|
+
constraint first.
|
|
418
|
+
- `vector.typeOnPath` consumes the path. Duplicate it first if the path should stay visible.
|
|
270
419
|
- A command that fails changes nothing; read its message (for example "Nothing is selected; pass
|
|
271
420
|
ids.") and retry with the missing input.
|