Class ArtRenderer

java.lang.Object
com.codename1.art.ArtRenderer

public final class ArtRenderer extends Object

Paints an ArtDocument into pixels.

Everything is rasterized in software, so blend modes, masks and effects look the same on every port and render in tests without a display. Text is the one exception: it is drawn with the platform's fonts, so it needs an initialized display and is skipped without one.

  • Constructor Details

    • ArtRenderer

      public ArtRenderer()
  • Method Details

    • render

      public static Raster render(ArtDocument doc, double scale)

      Renders a whole document.

      Parameters
      • doc: the document
      • scale: device pixels per document unit
      Returns

      a raster of the canvas, ceil(width * scale) by ceil(height * scale)

    • toImage

      public static Image toImage(ArtDocument doc, double scale)

      Renders a whole document to an Image.

      Parameters
      • doc: the document
      • scale: device pixels per document unit
    • render

      public Raster render(ArtDocument doc, Matrix view, int[] clip)

      Renders through a view transform into a device rectangle.

      Parameters
      • doc: the document
      • view: maps document coordinates to device pixels
      • clip: the device rectangle to produce, as x, y, w, h
    • renderNode

      public void renderNode(ArtNode node, Matrix parent, Raster target)

      Renders one node (and its children) onto target.

      Parameters
      • node: the node
      • parent: the transform from the node's parent space to device pixels
      • target: what is painted so far; the node is composited onto it