public class CanvasLayer extends ImageLayer
Layer.HitTester, Layer.Origin, Layer.StateCloseable.Set, Closeable.UtilforceHeight, forceWidth, region| Constructor and Description |
|---|
CanvasLayer(Graphics gfx,
Canvas canvas)
Creates a canvas layer with the supplied backing canvas.
|
CanvasLayer(Graphics gfx,
float width,
float height)
Creates a canvas layer with a backing canvas of size
width x height (in display
units). |
CanvasLayer(Graphics gfx,
IDimension size)
Creates a canvas layer with a backing canvas of
size (in display units). |
| Modifier and Type | Method and Description |
|---|---|
Canvas |
begin()
Starts a drawing operation on this layer's backing canvas.
|
void |
close()
Disposes this layer, removing it from its parent layer.
|
void |
end()
Informs this layer that a drawing operation has just completed.
|
float |
height()
Returns the height of this layer.
|
void |
resize(float width,
float height)
Resizes the canvas that is displayed by this layer.
|
ImageLayer |
setTile(RFuture<? extends Tile> tile)
Sets the tile rendered by this layer to the asynchronous result of
tile. |
ImageLayer |
setTile(Tile tile)
Sets the texture rendered by this layer.
|
float |
width()
Returns the width of this layer.
|
absorbHits, alpha, depth, disposed, events, hasEventListeners, hitTest, hitTestDefault, interactive, name, onAdded, onDisposed, onRemoved, origin, origin, originX, originY, paint, parent, rotation, scale, scaledHeight, scaledWidth, scaleX, scaleY, setAlpha, setBatch, setDepth, setHitTester, setInteractive, setName, setOrigin, setOrigin, setRotation, setScale, setScale, setScaleX, setScaleY, setTint, setTranslation, setTranslation, setTx, setTy, setVisible, tint, toString, transform, translation, translation, tx, ty, visiblepublic CanvasLayer(Graphics gfx, IDimension size)
public CanvasLayer(Graphics gfx, float width, float height)
public void resize(float width,
float height)
Note: this throws away the old canvas and creates a new blank canvas with the desired size.
Thus this should immediately be followed by a begin()/end() pair which updates
the contents of the new canvas. Until then, it will display the old image data.
public Canvas begin()
end() when the drawing is complete.public void end()
public ImageLayer setTile(Tile tile)
ImageLayernull to release and clear
any texture currently being rendered and leave this layer in an uninitialized state. This
isn't something one would normally do, but could be useful if one was free-listing image
layers for some reason.setTile in class ImageLayerpublic ImageLayer setTile(RFuture<? extends Tile> tile)
ImageLayertile. When the
future completes, this layer's tile will be set. Until then, the current tile (if any) will
continue to be rendered.setTile in class ImageLayerpublic float width()
Layerwidth in class ImageLayerpublic float height()
Layerheight in class ImageLayerpublic void close()
Layerclose in interface AutoCloseableclose in interface Closeableclose in class ImageLayerCopyright © 2017. All Rights Reserved.