public class mxSvgCanvas extends mxBasicCanvas
Modifier and Type | Field and Description |
---|---|
protected org.w3c.dom.Element |
defs |
protected org.w3c.dom.Document |
document
Holds the HTML document that represents the canvas.
|
protected boolean |
embedded
Specifies if images should be embedded as base64 encoded strings.
|
DEFAULT_IMAGEBASEPATH, drawLabels, imageBasePath, imageCache, PRESERVE_IMAGE_ASPECT, scale, translate
Constructor and Description |
---|
mxSvgCanvas()
Constructs a new SVG canvas for the specified dimension and scale.
|
mxSvgCanvas(org.w3c.dom.Document document)
Constructs a new SVG canvas for the specified bounds, scale and
background color.
|
Modifier and Type | Method and Description |
---|---|
void |
appendSvgElement(org.w3c.dom.Element node) |
protected java.lang.String |
createDataUrl(java.lang.String src) |
protected org.w3c.dom.Element |
createGradientElement(java.lang.String start,
java.lang.String end,
java.lang.String direction) |
protected org.w3c.dom.Element |
createImageElement(double x,
double y,
double w,
double h,
java.lang.String src,
boolean aspect,
boolean flipH,
boolean flipV,
boolean embedded) |
java.lang.Object |
drawCell(mxCellState state)
Draws the given cell.
|
java.lang.Object |
drawLabel(java.lang.String label,
mxCellState state,
boolean html)
Draws the given label.
|
org.w3c.dom.Element |
drawLine(java.util.List<mxPoint> pts,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given lines as segments between all points of the given list
of mxPoints.
|
mxPoint |
drawMarker(org.w3c.dom.Element parent,
java.lang.Object type,
mxPoint p0,
mxPoint pe,
float size,
float strokeWidth,
java.lang.String color)
Draws the specified marker as a child path in the given parent.
|
org.w3c.dom.Element |
drawShape(int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the shape specified with the STYLE_SHAPE key in the given style.
|
java.lang.Object |
drawText(java.lang.String text,
int x,
int y,
int w,
int h,
java.util.Map<java.lang.String,java.lang.Object> style)
Draws the specified text either using drawHtmlString or using drawString.
|
protected org.w3c.dom.Element |
getDefsElement() |
org.w3c.dom.Document |
getDocument()
Returns a reference to the document that represents the canvas.
|
protected org.w3c.dom.Element |
getEmbeddedImageElement(java.lang.String src) |
org.w3c.dom.Element |
getGlassGradientElement() |
org.w3c.dom.Element |
getGradientElement(java.lang.String start,
java.lang.String end,
java.lang.String direction) |
java.lang.String |
getGradientId(java.lang.String start,
java.lang.String end,
java.lang.String direction) |
protected java.io.InputStream |
getResource(java.lang.String src) |
boolean |
isEmbedded() |
protected boolean |
isImageResource(java.lang.String src)
Returns true if the given string ends with .png, .jpg or .gif.
|
void |
setDocument(org.w3c.dom.Document document) |
void |
setEmbedded(boolean value) |
flushImageCache, getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, loadImage, setDrawLabels, setImageBasePath, setScale, setTranslate
protected org.w3c.dom.Document document
protected org.w3c.dom.Element defs
protected boolean embedded
public mxSvgCanvas()
public mxSvgCanvas(org.w3c.dom.Document document)
public void appendSvgElement(org.w3c.dom.Element node)
protected org.w3c.dom.Element getDefsElement()
public org.w3c.dom.Element getGradientElement(java.lang.String start, java.lang.String end, java.lang.String direction)
public org.w3c.dom.Element getGlassGradientElement()
protected org.w3c.dom.Element createGradientElement(java.lang.String start, java.lang.String end, java.lang.String direction)
public java.lang.String getGradientId(java.lang.String start, java.lang.String end, java.lang.String direction)
protected boolean isImageResource(java.lang.String src)
protected java.io.InputStream getResource(java.lang.String src)
protected java.lang.String createDataUrl(java.lang.String src) throws java.io.IOException
java.io.IOException
protected org.w3c.dom.Element getEmbeddedImageElement(java.lang.String src)
protected org.w3c.dom.Element createImageElement(double x, double y, double w, double h, java.lang.String src, boolean aspect, boolean flipH, boolean flipV, boolean embedded)
public void setDocument(org.w3c.dom.Document document)
public org.w3c.dom.Document getDocument()
public void setEmbedded(boolean value)
public boolean isEmbedded()
public java.lang.Object drawCell(mxCellState state)
mxICanvas
state
- State of the cell to be painted.public java.lang.Object drawLabel(java.lang.String label, mxCellState state, boolean html)
mxICanvas
label
- String that represents the label.state
- State of the cell whose label is to be painted.html
- Specifies if the label contains HTML markup.public org.w3c.dom.Element drawShape(int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
x
- X-coordinate of the shape.y
- Y-coordinate of the shape.w
- Width of the shape.h
- Height of the shape.style
- Style of the the shape.public org.w3c.dom.Element drawLine(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)
pts
- List of points that define the line.style
- Style to be used for painting the line.public mxPoint drawMarker(org.w3c.dom.Element parent, java.lang.Object type, mxPoint p0, mxPoint pe, float size, float strokeWidth, java.lang.String color)
public java.lang.Object drawText(java.lang.String text, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)
text
- Text to be painted.x
- X-coordinate of the text.y
- Y-coordinate of the text.w
- Width of the text.h
- Height of the text.style
- Style to be used for painting the text.Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.