mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 20:43:18 -05:00
Scripts get Document.placedItems and Document.rasterItems, the linked and embedded images of a document, with length, [i], index, getByName and removeAll. PlacedItems.add() gives a PlacedItem whose file, assigned once, places an image linked through file.place. PlacedItem has file, relink(file) (links.relink), embed() (links.embed), matrix and boundingBox. RasterItem has bitsPerChannel, channels, imageColorSpace and transparent, read from the header of the encoded pixels, and colorizedGrayscale, embedded, file, status, matrix and boundingBox. Assigning matrix runs object.transform. The ImageColorSpace and RasterLinkState enumerations are added. A file to place or relink must be a File the script may read, checked as app.open checks its file, of at most 256 MiB, holding an image; its size is read first, and the error does not name a path the script may not read. Reading file of an image linked outside the script's read scope throws Script file access denied. A matrix with a value that is not finite, no area, or a corner outside the canvas throws with nothing changed. After embed() the PlacedItem is stale and rasterItems lists the image under the same id; a missing linked file stays linked and throws. A run keeps at most 1,024 PlacedItems.add() results. contentVariable, trace, colorants, colorize and overprint throw an error that says they are not available yet.