nodebox.graphics
Class Canvas
java.lang.Object
nodebox.graphics.AbstractTransformable
nodebox.graphics.Canvas
- All Implemented Interfaces:
- Cloneable, Drawable, Grob
public class Canvas
- extends AbstractTransformable
DEFAULT_WIDTH
public static final double DEFAULT_WIDTH
- See Also:
- Constant Field Values
DEFAULT_HEIGHT
public static final double DEFAULT_HEIGHT
- See Also:
- Constant Field Values
Canvas
public Canvas()
Canvas
public Canvas(double width,
double height)
Canvas
public Canvas(Canvas other)
asGeometry
public Geometry asGeometry()
- Convert the current canvas into a geometry object.
Only objects of a geometric nature can be present in the output.
- Returns:
- a Geometry object
asGeometry
public Geometry asGeometry(boolean clone)
- Convert the current canvas into a geometry object.
Only objects of a geometric nature can be present in the output.
- Parameters:
clone - if the items on the canvas need to be cloned.
- Returns:
- a Geometry object
getBackground
public Color getBackground()
setBackground
public Color setBackground(Color background)
getOffsetX
public double getOffsetX()
setOffsetX
public void setOffsetX(double offsetX)
getOffsetY
public double getOffsetY()
setOffsetY
public void setOffsetY(double offsetY)
getWidth
public double getWidth()
setWidth
public void setWidth(double width)
getHeight
public double getHeight()
setHeight
public void setHeight(double height)
setSize
public void setSize(double width,
double height)
add
public void add(Grob g)
size
public int size()
clear
public void clear()
getItems
public List<Grob> getItems()
get
public Grob get(int index)
extend
public void extend(Canvas c)
- Create copies of all grobs of the given group and append them to myself.
- Parameters:
c - the canvas whose elements are appended.
transform
public void transform(Transform t)
isEmpty
public boolean isEmpty()
getBounds
public Rect getBounds()
- Returns the bounding box of the canvas.
This does not compute the bounding boxes of the children, but always returns the requested canvas bounds.
- Returns:
- a bounding box with x/y at the center and width/height of the canvas.
clone
public Canvas clone()
- Specified by:
clone in interface Grob- Specified by:
clone in class AbstractTransformable
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
inheritFromContext
public void inheritFromContext(GraphicsContext ctx)
draw
public void draw(Graphics2D g)
asImage
public BufferedImage asImage()
save
public void save(File file)
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2013. All Rights Reserved.