mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 16:33:22 -06:00
M4.94: EMF and WMF export from Export As and document.export
New crates/metafile (L3, pure Rust): hand-written EMF and WMF writers over
one shared document walk. EMF keeps Bezier paths, solid brushes, geometric
pens (width, caps, joins, miter limit, user-style dashes), clipping masks as
path clips, images (StretchDIBits, or AlphaBlend with transparency) placed by
a world transform, type as outlines; gradients become images clipped to their
shape and pattern fills their tiles clipped to it. The header's frame is the
artboard in 0.01 mm on a 100 px/mm reference device. WMF flattens curves into
polygons in 16-bit units behind a placeable header (with its checksum),
numbers objects as players do, and reports what it leaves out (clipping,
transparency, gradients, rotated images).
document.export {format: emf|wmf} (and serialize, export) writes one artboard,
or one file per artboard with useArtboards (false: the art's bounds); raster
effects are rendered to images first, as for PDF. Export As lists EMF and WMF.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2e6585d7ea
commit
ab1c6b0516
@@ -361,3 +361,6 @@ Native save options: File → Save As to a native or `.ai` file opens the `saveO
|
||||
artboard; false: `range`, such as "1-3, 5"), `includeLinked`, `embedProfiles`, `pdfCompatible`, `compress`, and for
|
||||
native files `version` and `preview`. A bad range keeps the dialog open; `ui.dialog.confirm` writes the file and the
|
||||
artboards' files.
|
||||
|
||||
EMF and WMF: Export As… lists both formats (`file.exportAs {format: "emf"}` or `"wmf"`); they have no options
|
||||
dialog, so `ui.dialog.confirm` asks for the path and writes the file (one per artboard with Use Artboards).
|
||||
|
||||
+17
@@ -1338,3 +1338,20 @@ and Save as Template reuse the options as last saved (or Use Compression).
|
||||
{"name":"run_command","arguments":{"command":"file.saveAs","params":{"path":"/tmp/set.vectorcraft","separateArtboards":true,"range":"2-3","includeLinked":true}}}
|
||||
{"name":"run_command","arguments":{"command":"file.saveAs","params":{"path":"/tmp/set.ai","pdfCompatible":false}}}
|
||||
```
|
||||
|
||||
## EMF and WMF
|
||||
|
||||
`document.export` (and `export`) with format `emf` or `wmf` writes a Windows metafile of the first artboard (or
|
||||
`artboard`); `useArtboards: true` writes one file per chosen artboard (`{stem}-{artboard}.emf`), `false` the bounds of
|
||||
the visible art. EMF keeps Bézier curves, solid fills (brushes), strokes as geometric pens with their width, caps,
|
||||
joins, miter limit and dashes, clipping masks (path clips), images with their transparency (AlphaBlend) and type as
|
||||
outlines; gradients become images clipped to their shape, pattern fills their tiles clipped to the shape, and raster
|
||||
effects images rendered at the document's raster effects resolution. The header's frame is the artboard in 0.01 mm.
|
||||
WMF flattens curves into polygons in 16-bit units behind a placeable header (1440 units an inch, fewer for pictures
|
||||
over about 22 inches); it has no clipping, transparency or gradients, so clipped art is written whole, images over
|
||||
white and gradients and patterns as one colour. What a format leaves out comes back in `warnings`.
|
||||
|
||||
```json
|
||||
{"name":"export","arguments":{"path":"/tmp/logo.emf"}}
|
||||
{"name":"run_command","arguments":{"command":"document.export","params":{"format":"wmf","useArtboards":true,"path":"/tmp/icons.wmf"}}}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user