Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class ArtImages
- Object
- ArtImages
Encodes rasters as PNG and decodes PNG, JPEG and other image bytes into rasters.
Fields
public static final int MAX_DIMENSION = 30000 | The largest width or height a decoded image may have. |
public static final int MAX_SVG_SIDE = 4096 | The largest side, in pixels, renderSvg renders. |
Methods
public static Image renderSvg(byte[] svg)
throws IOException | Renders an SVG document, once, into an ordinary image at the size it declares. |
public static Raster decode(byte[] data) | Decodes image bytes. |
public static byte[] encodePng(Raster r) | Encodes pixels as a 32-bit RGBA PNG. |
Inherited methods
Field details
MAX_DIMENSION
public static final int MAX_DIMENSION = 30000The largest width or height a decoded image may have.
MAX_SVG_SIDE
public static final int MAX_SVG_SIDE = 4096The largest side, in pixels,
renderSvg renders. A larger document fails rather than
allocate hundreds of megabytes on a device; render it with ArtRenderer.toImage at a
scale of your choosing instead.Method details
renderSvg
public static Image renderSvg(byte[] svg)
throws IOExceptionRenders an SVG document, once, into an ordinary image at the size it declares. This is
what
Image.createSVG answers on a platform without native SVG.Parameters
svgbyte[]- the document
Returns
the rendered image
Throws
IOException- if the data is not SVG or is larger than
MAX_SVG_SIDEon a side
decode
public static Raster decode(byte[] data)Decodes image bytes. PNG is decoded in pure Java; other formats go through the
platform and need an initialized display.
Parameters
databyte[]- the encoded image
Returns
the pixels, or null when the bytes are not an image this platform can decode
encodePng
public static byte[] encodePng(Raster r)Encodes pixels as a 32-bit RGBA PNG.
Parameters
rRaster- the pixels