Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class SlideRenderer
- Object
- SlideRenderer
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);
}Nested types
class SlideRenderer.ElementState | How a slide show is showing an element partway through a build: its opacity, offset, scale and how much of it a wipe has revealed. |
Constructors
public SlideRenderer() |
Methods
public Measurer getMeasurer() | The measurer text is laid out with on the screen. |
public void paint(Graphics g, Presentation presentation, Slide slide, int x, int y, float scale) | Paints a slide. |
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. |
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. |
public Image toImage(Presentation presentation, Slide slide, int width) | Renders a slide into a new image. |
public void clearCache() | Forgets laid out text and rendered charts, for when memory is short. |
public static GeneralPath outline(ShapeElement s) | The outline of a shape in slide points, flipped as the shape says. |
Inherited methods
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
gGraphics- the graphics
presentationPresentation- the presentation the slide belongs to
slideSlide- the slide
xint- where the slide’s left edge goes, in pixels
yint- where its top edge goes
scalefloat- 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
gGraphics- the graphics
presentationPresentation- the presentation
slideSlide- the slide
xint- left edge in pixels
yint- top edge
scalefloat- pixels per point
statesMap<String, SlideRenderer.ElementState>- 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
gGraphics- the graphics
eSlideElement- the element
xint- where the slide’s left edge is, in pixels
yint- where its top edge is
scalefloat- pixels per point
toImage
public Image toImage(Presentation presentation, Slide slide, int width)Renders a slide into a new image.
Parameters
presentationPresentation- the presentation
slideSlide- the slide
widthint- 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
sShapeElement- the shape
Returns
the path