Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class FigmaReader
- Object
- FigmaReader
Reads a Figma file from the JSON of Figma’s REST API (GET /v1/files/:key) into an
ArtDocument.
Request the file with geometry=paths: each node’s outline then comes as SVG path data,
which is drawn exactly – boolean operations and vector networks included. Without it,
rectangles, ellipses and frames are rebuilt from their sizes and other vectors are skipped
with a note. FigmaClient fetches a file that way.
Every canvas (page) becomes a group under the root; the first is visible and the document
is sized to its content. Frames, groups, components and instances keep their structure;
fills, strokes, drop and inner shadows, layer and background blurs, blend modes, masks,
opacity and text are read and rendered. Image fills are looked up by their imageRef.
Fields
public static final int MAX_DEPTH = 256 | The deepest node nesting read. |
public static final int MAX_NODES = 500000 | The most nodes read. |
Methods
Inherited methods
Field details
MAX_DEPTH
public static final int MAX_DEPTH = 256MAX_NODES
public static final int MAX_NODES = 500000Method details
read
public static ArtDocument read(InputStream json, Map<String, byte[]> images)
throws IOExceptionParameters
jsonInputStream- the API response; read to its end, not closed
imagesMap<String, byte[]>- image fill bytes keyed by
imageRef, or null to leave image fills empty
Throws
read
public static ArtDocument read(byte[] json, Map<String, byte[]> images)
throws IOExceptionParameters
jsonbyte[]- the API response
imagesMap<String, byte[]>- image fill bytes keyed by
imageRef, or null
Throws
imageRefs
public static List<String> imageRefs(Map<String, Object> json)imageRef of every image fill in a file’s JSON, so the caller can fetch them.Parameters
jsonMap<String, Object>- the parsed API response