mxImageExport

Creates a new image export instance to be used with an export canvas.  Here is an example that uses this class to create an image via a backend using <mxXmlExportCanvas>.

let xmlDoc = mxUtils.createXmlDocument();
let root = xmlDoc.createElement('output');
xmlDoc.appendChild(root);

let xmlCanvas = new mxXmlCanvas2D(root);
let imgExport = new mxImageExport();
imgExport.drawState(graph.getView().getState(graph.model.root), xmlCanvas);

let bounds = graph.getGraphBounds();
let w = Math.ceil(bounds.x + bounds.width);
let h = Math.ceil(bounds.y + bounds.height);

let xml = mxUtils.getXml(root);
new mxXmlRequest('export', 'format=png&w=' + w +
     '&h=' + h + '&bg=#F9F7ED&xml=' + encodeURIComponent(xml))
     .simulate(document, '_blank');
Summary
mxImageExportCreates a new image export instance to be used with an export canvas.
Functions
mxImageExportConstructs a new image export.
Variables
includeOverlaysSpecifies if overlays should be included in the export.
Functions
drawStateDraws the given state and all its descendants to the given canvas.
visitStatesRecursiveVisits the given state and all its descendants to the given canvas recursively.
getLinkForCellStateReturns the link for the given cell state and canvas.
drawCellStateDraws the given state to the given canvas.
drawShapeDraws the shape of the given state.
drawTextDraws the text of the given state.
drawOverlaysDraws the overlays for the given state.

Functions

mxImageExport

function mxImageExport()

Constructs a new image export.

Variables

includeOverlays

mxImageExport.prototype.includeOverlays

Specifies if overlays should be included in the export.  Default is false.

Functions

drawState

mxImageExport.prototype.drawState = function(state,
canvas)

Draws the given state and all its descendants to the given canvas.

visitStatesRecursive

mxImageExport.prototype.visitStatesRecursive = function(state,
canvas,
visitor)

Visits the given state and all its descendants to the given canvas recursively.

getLinkForCellState

mxImageExport.prototype.getLinkForCellState = function(state,
canvas)

Returns the link for the given cell state and canvas.  This returns null.

drawCellState

mxImageExport.prototype.drawCellState = function(state,
canvas)

Draws the given state to the given canvas.

drawShape

mxImageExport.prototype.drawShape = function(state,
canvas)

Draws the shape of the given state.

drawText

mxImageExport.prototype.drawText = function(state,
canvas)

Draws the text of the given state.

drawOverlays

mxImageExport.prototype.drawOverlays = function(state,
canvas)

Draws the overlays for the given state.  This is called if includeOverlays is true.

function mxImageExport()
Constructs a new image export.
mxImageExport.prototype.includeOverlays
Specifies if overlays should be included in the export.
mxImageExport.prototype.drawState = function(state,
canvas)
Draws the given state and all its descendants to the given canvas.
mxImageExport.prototype.visitStatesRecursive = function(state,
canvas,
visitor)
Visits the given state and all its descendants to the given canvas recursively.
mxImageExport.prototype.getLinkForCellState = function(state,
canvas)
Returns the link for the given cell state and canvas.
mxImageExport.prototype.drawCellState = function(state,
canvas)
Draws the given state to the given canvas.
mxImageExport.prototype.drawShape = function(state,
canvas)
Draws the shape of the given state.
mxImageExport.prototype.drawText = function(state,
canvas)
Draws the text of the given state.
mxImageExport.prototype.drawOverlays = function(state,
canvas)
Draws the overlays for the given state.
Close