Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

package com.codename1.art

Layered artwork: vector shapes, text and raster layers that can be loaded, rendered, changed and saved.

An ArtDocument holds a tree of ArtNodes. Each node has its own transform, opacity, BlendMode and effects. SVG, Photoshop PSD, Sketch and Figma (REST API JSON) documents are read into the same tree. SVG and PSD can also be written back, and NativeFormat saves everything losslessly.

byte[] data = "<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><rect width='80' height='80' fill='#43a047'/></svg>".getBytes("UTF-8");
ArtDocument doc = ArtFormats.read(data);        // SVG, PSD, Sketch, Figma or .cn1gfx
Image preview = ArtRenderer.toImage(doc, 2);    // two pixels per document unit
ArtEditor editor = new ArtEditor(new ArtModel(doc));

Rendering is done in software by ArtRenderer, so a document looks the same on every platform. Every effect a supported format defines is rendered: layer styles, blurs, adjustment layers, masks, clipping and all blend modes. What a reader cannot represent is recorded as an ImportNote on the document rather than dropped silently.

ArtModel makes a document editable with undo, ArtView shows one with pan, zoom and hit testing, and ArtEditor is a ready-made drawing editor over both. ArtImages.renderSvg is what Image.createSVG answers on platforms with no native SVG support.

Types

class AdjustmentNodeAn adjustment layer: changes the colors of everything painted below it in the same group, as Photoshop’s levels, curves or hue/saturation layers do.
class ArtDocumentAn artwork: a canvas size and a tree of nodes.
class ArtEditorA simple vector and raster editor: an ArtView with a tool bar, a layers panel and an inspector.
class ArtFontsMaps the font families an artwork names to Codename One fonts.
class ArtFormatsOpens a graphics document in whichever format it is: PSD or PSB, SVG, Sketch, .cn1gfx, or Figma REST API JSON.
class ArtImagesEncodes rasters as PNG and decodes PNG, JPEG and other image bytes into rasters.
interface ArtListenerNotified when an ArtModel changes: an edit, an undo, a redo or a new selection.
class ArtModelAn editable, undoable ArtDocument with a selection.
class ArtNodeOne element of an artwork: a group, shape, text, image or adjustment layer.
class ArtPaintWhat fills a shape, a stroke or text: a color, a gradient or an image.
class ArtRendererPaints an ArtDocument into pixels.
class ArtViewShows an ArtModel’s document, with panning, pinch zoom, hit testing and the selection drawn over it.
enum BlendModeHow a layer’s colors combine with what is already painted below it.
class ColorsParses and formats CSS colors.
class CompositorSoftware compositing of ARGB pixel arrays.
class FigmaClientFetches a file from Figma’s REST API and reads it into an ArtDocument.
class FigmaReaderReads a Figma file from the JSON of Figma’s REST API (GET /v1/files/:key) into an ArtDocument.
class GradientPaintA linear, radial or conic gradient.
class GroupNodeA node that holds other nodes, painted first to last.
class ImagePaintFills with an image, stretched or tiled.
class ImportNoteSomething a reader met that it could not represent exactly, such as an SVG animation.
class MatrixAn immutable 2D affine transform, in SVG’s matrix(a b c d e f) order.
class NativeFormatThe .cn1gfx container: a ZIP holding document.json and every raster as a PNG under images/.
class PathDataParses SVG path data (the d attribute) into a GeneralPath.
class PsdReaderReads Photoshop PSD and PSB files into an ArtDocument.
class PsdWriterWrites an ArtDocument as a layered Photoshop PSD: RGB, 8 bits per channel, RLE.
class RasterA rectangle of non-premultiplied 0xAARRGGBB pixels with a position.
class RasterNodeA bitmap layer.
class ShapeNodeA vector shape: a path with any number of fills and strokes, painted in order.
class ShapesPaths for the basic shapes.
class SketchReaderReads Sketch files (Sketch 43 and later: a ZIP of JSON) into an ArtDocument.
class SolidPaintA single color.
class StrokeStyleHow a shape’s outline is drawn: paint, width, caps, joins, dashes and alignment.
class SvgReaderReads SVG 1.1 and SVG 2 static documents into an ArtDocument.
class SvgWriterWrites an ArtDocument as SVG.
class TextNodeStyled text.
class TextRunA stretch of text with one style.