Class ArtImages
java.lang.Object
com.codename1.art.ArtImages
Encodes rasters as PNG and decodes PNG, JPEG and other image bytes into rasters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe largest width or height a decoded image may have.static final intThe largest side, in pixels,renderSvgrenders. -
Method Summary
-
Field Details
-
MAX_DIMENSION
public static final int MAX_DIMENSIONThe largest width or height a decoded image may have.- See Also:
-
MAX_SVG_SIDE
public static final int MAX_SVG_SIDEThe largest side, in pixels,renderSvgrenders. A larger document fails rather than allocate hundreds of megabytes on a device; render it withArtRenderer.toImageat a scale of your choosing instead.- See Also:
-
-
Method Details
-
renderSvg
Renders an SVG document, once, into an ordinary image at the size it declares. This is what
Image.createSVGanswers on a platform without native SVG.Parameters
svg: the document
Returns
the rendered image
Throws
IOException: if the data is not SVG or is larger thanMAX_SVG_SIDEon a side
- Throws:
IOException
-
decode
Decodes image bytes. PNG is decoded in pure Java; other formats go through the platform and need an initialized display.
Parameters
data: the encoded image
Returns
the pixels, or null when the bytes are not an image this platform can decode
-
encodePng
Encodes pixels as a 32-bit RGBA PNG.
Parameters
r: the pixels
-