public class DisplayList extends Object
start(int, int)
returns a Canvas
that will be used to record a set of drawing commands. these drawing
commands can later be re-executed calling draw(Canvas)
.
Recording a DisplayList allows for faster re-drawing of View
s and
Drawable
s since drawing a DisplayList instead of executing the
onDraw/draw methods avoids translating the Canvas
commands into OpenGL calls.Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all previous drawing commands from this DisplayList.
|
static DisplayList |
createDisplayList(String name)
Creates a new DisplayList for a specific Context with a Debug name.
|
void |
draw(Canvas canvas)
Draws the content of this DisplayList on a Canvas.
|
void |
end(Canvas canvas)
Notifies this DisplayList that the list of drawing commands is complete.
|
boolean |
isValid() |
void |
setBounds(int left,
int top,
int right,
int bottom)
Set the bounds in which this DisplayList will draw.
|
Canvas |
start(int width,
int height)
Starts recording a DisplayList with size of width-height.
|
@Nullable public static DisplayList createDisplayList(String name)
public Canvas start(int width, int height) throws DisplayListException
Canvas
on which drawing commands can be recordedDisplayListException
- if the creation of the Canvas failedpublic void end(Canvas canvas) throws DisplayListException
canvas
- the canvas that was returned from start(int, int)
DisplayListException
- if the creation of GL commands failedpublic void clear() throws DisplayListException
DisplayListException
- if clearing the DisplayList failedpublic void draw(Canvas canvas) throws DisplayListException
canvas
- the canvas on which to draw the content of this DisplayListDisplayListException
- if the drawing failedpublic void setBounds(int left, int top, int right, int bottom) throws DisplayListException
draw(Canvas)
is called.DisplayListException
- if setting the bouds failedpublic boolean isValid()