
public class Canvas2d extends Surface
backgroundSprite, component, container, height, sprites, surfaceElement, width| Constructor and Description |
|---|
Canvas2d() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
append(Sprite sprite)
In the Canvas2d class, this method does more or less what renderSprite does in SVG and VML - it
actually renders the sprite to the dom.
|
protected void |
appendAll() |
protected void |
appendPath(Context2d ctx,
PathSprite sprite) |
void |
draw()
Renders the surface to the DOM as well as any sprites already added.
|
protected PreciseRectangle |
getBBoxText(TextSprite sprite)
Calculates the bounding box of the given text sprite.
|
protected CanvasElement |
getCanvas() |
protected Context2d |
getContext() |
protected CanvasGradient |
makeGradient(Gradient gradient,
PreciseRectangle bbox) |
protected void |
renderAll()
Renders all of the sprites added to the surface using
Surface.renderSprite(Sprite). |
void |
renderSprite(Sprite sprite)
Renders the given sprite to the DOM.
|
void |
setCursor(Sprite sprite,
String property)
Sets the cursor property for the given sprite.
|
void |
setHeight(int height)
Sets the height of the surface.
|
void |
setViewBox(double x,
double y,
double width,
double height)
Sets the view box of the surface.
|
void |
setWidth(int width)
Sets the width of the surface.
|
add, addGradient, clear, create, create, deleteSprite, getBBox, getComponent, getHeight, getSprites, getSurfaceElement, getWidth, setBackgroundpublic void draw()
Surfaceprotected void renderAll()
SurfaceSurface.renderSprite(Sprite).protected void appendAll()
public void renderSprite(Sprite sprite)
SurfacerenderSprite in class Surfacesprite - the sprite to be renderedprotected void append(Sprite sprite)
sprite - the sprite to drawprotected void appendPath(Context2d ctx,
PathSprite sprite)
public void setCursor(Sprite sprite, String property)
Surfacepublic void setViewBox(double x,
double y,
double width,
double height)
SurfacesetViewBox in class Surfacex - the x coordinate of the viewboxy - the y coordinate of the viewboxwidth - the width of the viewboxheight - the height of the viewboxprotected PreciseRectangle getBBoxText(TextSprite sprite)
SurfacegetBBoxText in class Surfacesprite - the text sprite to be used in the calculationprotected CanvasElement getCanvas()
protected Context2d getContext()
public void setWidth(int width)
Surfacepublic void setHeight(int height)
Surfaceprotected CanvasGradient makeGradient(Gradient gradient, PreciseRectangle bbox)
Copyright © 2018. All rights reserved.