Package com.mxgraph.canvas
Class mxGraphics2DCanvas
java.lang.Object
com.mxgraph.canvas.mxBasicCanvas
com.mxgraph.canvas.mxGraphics2DCanvas
- All Implemented Interfaces:
mxICanvas
- Direct Known Subclasses:
mxInteractiveCanvas
An implementation of a canvas that uses Graphics2D for painting.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Graphics2D
Global graphics handle to the image.static int
Specifies the image scaling quality.protected CellRendererPane
Optional renderer pane to be used for HTML label rendering.Maps from names to mxIVertexShape instances.static final String
static final String
protected static Map
<String, mxITextShape> Maps from names to mxITextShape instances.Fields inherited from class com.mxgraph.canvas.mxBasicCanvas
DEFAULT_IMAGEBASEPATH, drawLabels, imageBasePath, imageCache, PRESERVE_IMAGE_ASPECT, scale, translate
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new graphics canvas with an empty graphics object.Constructs a new graphics canvas for the given graphics object. -
Method Summary
Modifier and TypeMethodDescriptioncreateFillPaint
(mxRectangle bounds, Map<String, Object> style) createStroke
(Map<String, Object> style) createTemporaryGraphics
(Map<String, Object> style, float opacity, mxRectangle bounds) drawCell
(mxCellState state) Draws the given cell.void
void
protected void
drawImageImpl
(Image image, int x, int y) Implements the actual graphics call.drawLabel
(String text, mxCellState state, boolean html) Draws the given label.void
void
Returns the graphics object for this canvas.protected Dimension
getImageSize
(Image image) Returns the size for the given image.getTextShape
(Map<String, Object> style, boolean html) void
paintPolyline
(mxPoint[] points, boolean rounded) void
paintRectangle
(Rectangle bounds, Color background, Color border) static void
static void
putTextShape
(String name, mxITextShape shape) void
Sets the graphics object for this canvas.Methods inherited from class com.mxgraph.canvas.mxBasicCanvas
flushImageCache, getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, loadImage, setDrawLabels, setImageBasePath, setScale, setTranslate
-
Field Details
-
TEXT_SHAPE_DEFAULT
- See Also:
-
TEXT_SHAPE_HTML
- See Also:
-
IMAGE_SCALING
public static int IMAGE_SCALINGSpecifies the image scaling quality. Default is Image.SCALE_SMOOTH. -
shapes
Maps from names to mxIVertexShape instances. -
textShapes
Maps from names to mxITextShape instances. There are currently three different hardcoded text shapes available here: default, html and wrapped. -
rendererPane
Optional renderer pane to be used for HTML label rendering. -
g
Global graphics handle to the image.
-
-
Constructor Details
-
mxGraphics2DCanvas
public mxGraphics2DCanvas()Constructs a new graphics canvas with an empty graphics object. -
mxGraphics2DCanvas
Constructs a new graphics canvas for the given graphics object.
-
-
Method Details
-
putShape
-
getShape
-
putTextShape
-
getTextShape
-
getRendererPane
-
getGraphics
Returns the graphics object for this canvas. -
setGraphics
Sets the graphics object for this canvas. -
drawCell
Description copied from interface:mxICanvas
Draws the given cell.- Parameters:
state
- State of the cell to be painted.- Returns:
- Object that represents the cell.
-
drawLabel
Description copied from interface:mxICanvas
Draws the given label.- Parameters:
text
- String that represents the label.state
- State of the cell whose label is to be painted.html
- Specifies if the label contains HTML markup.- Returns:
- Object that represents the label.
-
drawImage
-
drawImage
-
drawImageImpl
Implements the actual graphics call. -
getImageSize
Returns the size for the given image. -
paintPolyline
-
paintRectangle
-
fillShape
-
fillShape
-
createStroke
-
createFillPaint
-
createTemporaryGraphics
public Graphics2D createTemporaryGraphics(Map<String, Object> style, float opacity, mxRectangle bounds)
-