mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 13:32:45 -05:00
Document.rasterize(sourceArt, clipBounds?, options?) replaces one page item or a list of them with an embedded image in one undo step and gives the new RasterItem; the source objects go stale. Document.imageCapture( imageFile, clipBounds?, options?) writes a PNG of all the visible art, on the artboards or off them, or of the area clipBounds names. new RasterizeOptions() and new ImageCaptureOptions() start with the defaults the help pages give, and the enumerations AntiAliasingMethod and RasterizationColorModel hold their values. Every option goes to the command explicitly, so the document's raster effects settings do not change the result. object.rasterize takes ids, to rasterize those objects instead of the selection while keeping the selection less the replaced art, and clipBounds, which cuts the image to a rectangle that must reach the art itself. Its result adds imageId, the image inside the clip group when clippingMask makes one. VectorCraft's own rules: clipBounds is [left, top, right, bottom] in the script's coordinates and is never reordered; imageCapture writes a PNG and needs a .png name; transparency wins over backgroundBlack and over matte; padding takes 0 to 1,000 points and both resolutions 72 to 2400 ppi; an image over 64 megapixels or 32,768 pixels a side throws before anything is drawn. imageCapture writes only where the script's File objects may, and never over an open document's file or a file one of them links, wherever the linking image or placed document is stored. convertSpotColors, convertTextToOutlines and includeLayers set to true, and Document.windowCapture, throw an error that says they are not available yet.