Class SlideRenderer

java.lang.Object
com.codename1.presentation.SlideRenderer

public class SlideRenderer extends Object

Paints slides on a Graphics: thumbnails, the editor's canvas and the slide show all draw through this class, and PDF export draws the same elements with the same geometry.

Text is laid out by com.codename1.wordprocessing.DocumentLayout and drawn by LayoutPainter, charts by com.codename1.ui.chart.Chart, and diagrams are arranged by com.codename1.graph.arrange -- nothing here measures or draws text by itself.

Image thumbnail(Presentation deck) {
    SlideRenderer renderer = new SlideRenderer();
    return renderer.toImage(deck, deck.getSlides().get(0), 320);
}
  • Constructor Details

    • SlideRenderer

      public SlideRenderer()
  • Method Details

    • getMeasurer

      public Measurer getMeasurer()

      The measurer text is laid out with on the screen.

      Returns

      the measurer

    • paint

      public void paint(Graphics g, Presentation presentation, Slide slide, int x, int y, float scale)

      Paints a slide.

      Parameters
      • g: the graphics

      • presentation: the presentation the slide belongs to

      • slide: the slide

      • x: where the slide's left edge goes, in pixels

      • y: where its top edge goes

      • scale: pixels per point

    • paint

      public void paint(Graphics g, Presentation presentation, Slide slide, int x, int y, float scale, Map<String, SlideRenderer.ElementState> states)

      Paints a slide with some elements partway through their builds.

      Parameters
      • g: the graphics

      • presentation: the presentation

      • slide: the slide

      • x: left edge in pixels

      • y: top edge

      • scale: pixels per point

      • states: element states by id, or null to paint every element as it is

    • paintElement

      public void paintElement(Graphics g, SlideElement e, int x, int y, float scale)

      Paints one element, for a view that draws a dragged element by itself.

      Parameters
      • g: the graphics

      • e: the element

      • x: where the slide's left edge is, in pixels

      • y: where its top edge is

      • scale: pixels per point

    • toImage

      public Image toImage(Presentation presentation, Slide slide, int width)

      Renders a slide into a new image.

      Parameters
      • presentation: the presentation

      • slide: the slide

      • width: the image width in pixels; the height follows the slide's proportions

      Returns

      the image

    • clearCache

      public void clearCache()
      Forgets laid out text and rendered charts, for when memory is short.
    • outline

      public static GeneralPath outline(ShapeElement s)

      The outline of a shape in slide points, flipped as the shape says.

      Parameters
      • s: the shape
      Returns

      the path