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

public final class SvgWriter

  1. Object
  2. SvgWriter

Writes an ArtDocument as SVG.

Shapes, paths, groups, gradients, image paints, clips, masks, text and blend modes are written as SVG. Effects with an SVG filter equivalent (blurs, shadows, color matrices and SVG filter graphs) become filters. A node whose effects SVG cannot express (a bevel, a curves adjustment) and every adjustment layer is written as the image it renders to, so the output looks the same in any SVG viewer.

Constructors

public SvgWriter()

Methods

public SvgWriter setRasterScale(double scale)Sets the resolution, in pixels per unit, of nodes written as images.
public static void write(ArtDocument doc, OutputStream out) throws IOExceptionWrites a document.
public String toSvg(ArtDocument doc)The SVG text of a document.
public static String pathData(GeneralPath p)Path data for a path.

Inherited methods

Constructor details

SvgWriter

public SvgWriter()

Method details

setRasterScale

public SvgWriter setRasterScale(double scale)
Sets the resolution, in pixels per unit, of nodes written as images.

Parameters

scale double
pixels per document unit

write

public static void write(ArtDocument doc, OutputStream out) throws IOException
Writes a document.

Parameters

doc ArtDocument
the document
out OutputStream
receives UTF-8 SVG; not closed

toSvg

public String toSvg(ArtDocument doc)
The SVG text of a document.

Parameters

doc ArtDocument
the document

pathData

public static String pathData(GeneralPath p)
Path data for a path.

Parameters

p GeneralPath
the path