mxGraph
|
Used for exporting images. To render to an image from a given XML string, graph size and and background color, the following code is used: More...
Classes | |
class | CanvasState |
Public Member Functions | |
mxGdiCanvas2D (Graphics g) | |
void | Save () |
void | Restore () |
void | Scale (double value) |
Sets the given scale. More... | |
void | Translate (double dx, double dy) |
Translates the canvas. More... | |
void | Rotate (double theta, bool flipH, bool flipV, double cx, double cy) |
Rotates the canvas. More... | |
void | SetShadowOffset (double dx, double dy) |
Prepares the canvas to draw a gradient. More... | |
void | SetGradient (String color1, String color2, double x, double y, double w, double h, String direction, double alpha1, double alpha2) |
Sets the given gradient. More... | |
void | Rect (double x, double y, double w, double h) |
Draws a rectangle. More... | |
void | Roundrect (double x, double y, double w, double h, double dx, double dy) |
void | Ellipse (double x, double y, double w, double h) |
Draws an ellipse. More... | |
void | Image (double x, double y, double w, double h, String src, bool aspect, bool flipH, bool flipV) |
Draws an image. More... | |
void | Text (double x, double y, double w, double h, string str, string align, string valign, bool wrap, string format, string overflow, bool clip, double rotation, string dir) |
void | Begin () |
void | MoveTo (double x, double y) |
void | LineTo (double x, double y) |
void | QuadTo (double x1, double y1, double x2, double y2) |
void | CurveTo (double x1, double y1, double x2, double y2, double x3, double y3) |
void | Close () |
void | Stroke () |
void | Fill () |
void | FillAndStroke () |
Public Member Functions inherited from com.mxgraph.mxICanvas2D | |
void | SetGradient (string color1, string color2, double x, double y, double w, double h, string direction, double alpha1, double alpha2) |
Prepares the canvas to draw a gradient. More... | |
void | Image (double x, double y, double w, double h, string src, bool aspect, bool flipH, bool flipV) |
Draws the given image. More... | |
Static Public Member Functions | |
static StringFormat | CreateStringFormat (string align, string valign, bool wrap, bool clip) |
Creates the specified string format. More... | |
Protected Member Functions | |
Color | ParseColor (string hex) |
Helper method that uses mxUtils#parseColor(String). Subclassers More... | |
Color | ParseColor (string hex, double alpha) |
Helper method that uses mxUtils#parseColor(String). Subclassers More... | |
void | DrawImage (Image image, Rectangle bounds) |
Implements the call to the graphics API. More... | |
Image | LoadImage (String src) |
Loads the specified image. More... | |
Rectangle | GetImageBounds (Image img, double x, double y, double w, double h, bool aspect) |
Returns the bounds for the given image. More... | |
Size | GetImageSize (Image image) |
Returns the size for the given image. More... | |
void | ConfigureImageGraphics (double x, double y, double w, double h, bool flipH, bool flipV) |
PointF | GetMargin (String align, String valign) |
void | PaintCurrentPath (bool filled, bool stroked) |
void | PaintShadow (bool filled, bool stroked) |
void | UpdateFont () |
Font | CreateFont (String family, FontStyle style, float size) |
String | GetFontName (String family) |
Returns a font name for the given font family. More... | |
void | UpdatePen () |
Protected Attributes | |
bool | matchHtmlAlignment = true |
matchHtmlAlignment More... | |
bool | htmlAsPlainText = true |
htmlAsPlainText More... | |
bool | wrapPlainText = true |
htmlAsPlainText More... | |
Graphics | graphics |
CanvasState | state = new CanvasState() |
Stack< CanvasState > | stack = new Stack<CanvasState>() |
GraphicsPath | currentPath |
mxPoint | lastPoint |
Holds the last point of a moveTo or lineTo operation to determine if the More... | |
Font | lastFont = null |
FontCaching More... | |
FontStyle | lastFontStyle = 0 |
FontCaching More... | |
float | lastFontSize = 0 |
FontCaching More... | |
String | lastFontFamily = "" |
FontCaching More... | |
Properties | |
double | StrokeWidth [set] |
Sets the strokewidth. More... | |
string | StrokeColor [set] |
bool | Dashed [set] |
Specifies if lines are dashed. More... | |
string | DashPattern [set] |
Sets the dashpattern. More... | |
string | LineCap [set] |
Sets the linecap. More... | |
string | LineJoin [set] |
Sets the linejoin. More... | |
double | MiterLimit [set] |
Sets the miterlimit. More... | |
double | FontSize [set] |
Sets the fontsize. More... | |
string | FontColor [set] |
Sets the fontcolor. More... | |
string | FontBackgroundColor [set] |
Default value 0. See mxConstants#STYLE_FONTSTYLE. More... | |
string | FontBorderColor [set] |
Default value 0. See mxConstants#STYLE_FONTSTYLE. More... | |
string | FontFamily [set] |
Sets the font family. More... | |
int | FontStyle [set] |
Sets the given fontstyle. More... | |
double | Alpha [set] |
Sets the given alpha. More... | |
double | StrokeAlpha [set] |
Sets the given alpha. More... | |
double | FillAlpha [set] |
Sets the given alpha. More... | |
string | FillColor [set] |
Sets the given fillcolor. More... | |
bool | Shadow [set] |
Default value mxConstants#NONE. More... | |
string | ShadowColor [set] |
Default value mxConstants#NONE. More... | |
double | ShadowAlpha [set] |
Default value 1. This method may add rendering overhead and should be used with care. More... | |
Properties inherited from com.mxgraph.mxICanvas2D | |
double | StrokeWidth [set] |
Sets the stroke width. This should default to 1 if unset. More... | |
string | StrokeColor [set] |
Sets the stroke color. This should default to mxConstants.NONE if unset. More... | |
bool | Dashed [set] |
Sets the dashed state. This should default to false if unset. More... | |
string | DashPattern [set] |
Sets the dash pattern. This should default to "3 3" if unset. More... | |
string | LineCap [set] |
Sets the linecap. This should default to "flat" if unset. More... | |
string | LineJoin [set] |
Sets the linejoin. This should default to "miter" if unset. More... | |
double | MiterLimit [set] |
Sets the miterlimit. This should default to 10 if unset. More... | |
double | FontSize [set] |
Default value mxConstants.DEFAULT_FONTSIZE. More... | |
string | FontColor [set] |
Default value "#000000". More... | |
string | FontFamily [set] |
Default value mxConstants#DEFAULT_FONTFAMILY. More... | |
int | FontStyle [set] |
Default value 0. See mxConstants#STYLE_FONTSTYLE. More... | |
string | FontBackgroundColor [set] |
Default value 0. See mxConstants#STYLE_FONTSTYLE. More... | |
string | FontBorderColor [set] |
Default value 0. See mxConstants#STYLE_FONTSTYLE. More... | |
double | Alpha [set] |
Default value 1. This method may add rendering overhead and should be used with care. More... | |
double | FillAlpha [set] |
Default value 1. More... | |
double | StrokeAlpha [set] |
Default value 1. More... | |
string | FillColor [set] |
Default value mxConstants#NONE. More... | |
bool | Shadow [set] |
Default value mxConstants#NONE. More... | |
string | ShadowColor [set] |
Default value mxConstants#NONE. More... | |
double | ShadowAlpha [set] |
Default value 1. This method may add rendering overhead and should be used with care. More... | |
Used for exporting images.
To render to an image from a given XML string, graph size and and background color, the following code is used:
Image image = mxUtils.CreateImage(width, height, background); Graphics g = Graphics.FromImage(image); g.SmoothingMode = SmoothingMode.HighQuality; mxSaxOutputHandler handler = new mxSaxOutputHandler(new mxGdiCanvas2D(g)); handler.Read(new XmlTextReader(new StringReader(xml)));
Text rendering is available for plain text only, with optional word wrapping.
|
inline |
Constructs a new graphics export canvas.
|
inline |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Closes the current path.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlineprotected |
Creates a graphic instance for rendering an image.
|
inlineprotected |
Hook for subclassers to implement font caching.
|
inlinestatic |
Creates the specified string format.
References com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_LEFT, com.mxgraph.mxConstants.ALIGN_MIDDLE, com.mxgraph.mxConstants.ALIGN_RIGHT, and com.mxgraph.mxConstants.ALIGN_TOP.
|
inline |
Implements com.mxgraph.mxICanvas2D.
References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlineprotected |
Implements the call to the graphics API.
|
inline |
Draws an ellipse.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlineprotected |
Returns a font name for the given font family.
|
inlineprotected |
Returns the bounds for the given image.
|
inlineprotected |
Returns the size for the given image.
|
inline |
Draws an image.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Implements com.mxgraph.mxICanvas2D.
References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlineprotected |
Loads the specified image.
References com.mxgraph.mxUtils.LoadImage().
|
inline |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlineprotected |
value |
|
inlineprotected |
value |
|
inlineprotected |
Helper method that uses mxUtils#parseColor(String). Subclassers
can override this to implement caching for frequently used colors.
|
inlineprotected |
Helper method that uses mxUtils#parseColor(String). Subclassers
can override this to implement caching for frequently used colors.
References com.mxgraph.mxConstants.NONE.
|
inline |
Implements com.mxgraph.mxICanvas2D.
References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Draws a rectangle.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Restores the last canvas state.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Rotates the canvas.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.PaintShape().
|
inline |
Draws a rounded rectangle.
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Saves the current canvas state.
Implements com.mxgraph.mxICanvas2D.
References com.mxgraph.mxGdiCanvas2D.CanvasState.Clone().
Referenced by com.mxgraph.mxStencil.DrawElement(), and com.mxgraph.mxStencil.PaintShape().
|
inline |
|
inline |
Sets the given gradient.
References com.mxgraph.mxConstants.DIRECTION_EAST, com.mxgraph.mxConstants.DIRECTION_NORTH, com.mxgraph.mxConstants.DIRECTION_SOUTH, and com.mxgraph.mxConstants.DIRECTION_WEST.
Referenced by com.mxgraph.mxStencil.PaintShape().
|
inline |
Prepares the canvas to draw a gradient.
Implements com.mxgraph.mxICanvas2D.
|
inline |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Draws the given text.
Implements com.mxgraph.mxICanvas2D.
References com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_MIDDLE, and com.mxgraph.mxConstants.ALIGN_RIGHT.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inline |
Translates the canvas.
dx | |
dy |
Implements com.mxgraph.mxICanvas2D.
Referenced by com.mxgraph.mxStencil.DrawShadow().
|
inlineprotected |
|
inlineprotected |
|
protected |
Holds the current path.
|
protected |
Reference to the graphics instance for painting.
|
protected |
htmlAsPlainText
|
protected |
FontCaching
|
protected |
FontCaching
|
protected |
FontCaching
|
protected |
FontCaching
|
protected |
Holds the last point of a moveTo or lineTo operation to determine if the
current path is orthogonal.
|
protected |
matchHtmlAlignment
|
protected |
Stack of states for save/restore.
|
protected |
Represents the current state of the canvas.
|
protected |
htmlAsPlainText
|
set |
Sets the given alpha.
Referenced by com.mxgraph.mxStencil.DrawShadow(), and com.mxgraph.mxStencil.PaintShape().
|
set |
Specifies if lines are dashed.
Referenced by com.mxgraph.mxStencil.DrawElement(), and com.mxgraph.mxStencil.PaintShape().
|
set |
Sets the dashpattern.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the given alpha.
|
set |
Sets the given fillcolor.
Referenced by com.mxgraph.mxStencil.DrawElement(), and com.mxgraph.mxStencil.PaintShape().
|
set |
Default value 0. See mxConstants#STYLE_FONTSTYLE.
|
set |
Default value 0. See mxConstants#STYLE_FONTSTYLE.
|
set |
Sets the fontcolor.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the font family.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the fontsize.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the given fontstyle.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the linecap.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the linejoin.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Sets the miterlimit.
Referenced by com.mxgraph.mxStencil.DrawElement().
|
set |
Default value mxConstants#NONE.
|
set |
Default value 1. This method may add rendering overhead and should be used with care.
|
set |
Default value mxConstants#NONE.
|
set |
Sets the given alpha.
|
set |
Caches color conversion as it is expensive.
Referenced by com.mxgraph.mxStencil.DrawElement(), and com.mxgraph.mxStencil.PaintShape().
|
set |
Sets the strokewidth.
Referenced by com.mxgraph.mxStencil.DrawElement(), com.mxgraph.mxStencil.DrawShape(), and com.mxgraph.mxStencil.PaintShape().