Package com.mxgraph.canvas
Class mxImageCanvas
- java.lang.Object
-
- com.mxgraph.canvas.mxImageCanvas
-
- All Implemented Interfaces:
mxICanvas
public class mxImageCanvas extends java.lang.Object implements mxICanvas
An implementation of a canvas that uses Graphics2D for painting. To use an image canvas for an existing graphics canvas and create an image the following code is used:BufferedImage image = mxCellRenderer.createBufferedImage(graph, cells, 1, Color.white, true, null, canvas);
-
-
Field Summary
Fields Modifier and Type Field Description protected mxGraphics2DCanvascanvasprotected java.awt.image.BufferedImageimageprotected java.awt.Graphics2DpreviousGraphics
-
Constructor Summary
Constructors Constructor Description mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias)mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias, boolean textAntiAlias)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImagedestroy()java.lang.ObjectdrawCell(mxCellState state)Draws the given cell.java.lang.ObjectdrawLabel(java.lang.String label, mxCellState state, boolean html)Draws the given label.mxGraphics2DCanvasgetGraphicsCanvas()java.awt.image.BufferedImagegetImage()doublegetScale()Returns the scale.mxPointgetTranslate()Returns the current translation.voidsetScale(double scale)Sets the scale for the following drawing requests.voidsetTranslate(double dx, double dy)Sets the translation for the following drawing requests.
-
-
-
Field Detail
-
canvas
protected mxGraphics2DCanvas canvas
-
previousGraphics
protected java.awt.Graphics2D previousGraphics
-
image
protected java.awt.image.BufferedImage image
-
-
Constructor Detail
-
mxImageCanvas
public mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias)
-
mxImageCanvas
public mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, java.awt.Color background, boolean antiAlias, boolean textAntiAlias)
-
-
Method Detail
-
getGraphicsCanvas
public mxGraphics2DCanvas getGraphicsCanvas()
-
getImage
public java.awt.image.BufferedImage getImage()
-
drawCell
public java.lang.Object drawCell(mxCellState state)
Description copied from interface:mxICanvasDraws the given cell.
-
drawLabel
public java.lang.Object drawLabel(java.lang.String label, mxCellState state, boolean html)Description copied from interface:mxICanvasDraws the given label.
-
getScale
public double getScale()
Description copied from interface:mxICanvasReturns the scale.
-
getTranslate
public mxPoint getTranslate()
Description copied from interface:mxICanvasReturns the current translation.- Specified by:
getTranslatein interfacemxICanvas- Returns:
- Returns the current translation.
-
setScale
public void setScale(double scale)
Description copied from interface:mxICanvasSets the scale for the following drawing requests.
-
setTranslate
public void setTranslate(double dx, double dy)Description copied from interface:mxICanvasSets the translation for the following drawing requests.- Specified by:
setTranslatein interfacemxICanvas
-
destroy
public java.awt.image.BufferedImage destroy()
-
-