Class 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 Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHow a slide show is showing an element partway through a build: its opacity, offset, scale and how much of it a wipe has revealed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidForgets laid out text and rendered charts, for when memory is short.The measurer text is laid out with on the screen.static GeneralPathThe outline of a shape in slide points, flipped as the shape says.voidpaint(Graphics g, Presentation presentation, Slide slide, int x, int y, float scale) Paints a slide.voidpaint(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.voidpaintElement(Graphics g, SlideElement e, int x, int y, float scale) Paints one element, for a view that draws a dragged element by itself.toImage(Presentation presentation, Slide slide, int width) Renders a slide into a new image.
-
Constructor Details
-
SlideRenderer
public SlideRenderer()
-
-
Method Details
-
getMeasurer
The measurer text is laid out with on the screen.
Returns
the measurer
-
paint
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
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
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
The outline of a shape in slide points, flipped as the shape says.
Parameters
s: the shape
Returns
the path
-