mxGraph
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
com.mxgraph.mxGdiCanvas Class Reference

Implementation of a canvas that uses GDI for painting. More...

Inheritance diagram for com.mxgraph.mxGdiCanvas:
com.mxgraph.mxBasicCanvas com.mxgraph.mxICanvas

Public Member Functions

 mxGdiCanvas ()
 Constructs a new GDI canvas. More...
 
 mxGdiCanvas (Graphics g)
 Constructs a new GDI canvas for the given graphics instance. More...
 
override Object DrawCell (mxCellState state)
 see com.mxgraph.mxICanvas.DrawCell() More...
 
override Object DrawLabel (string text, mxCellState state, bool html)
 see com.mxgraph.mxICanvas.DrawLabel() More...
 
void DrawShape (int x, int y, int w, int h, Dictionary< string, Object > style)
 Draws the shape specified with the STYLE_SHAPE key in the given style. More...
 
void DrawLine (List< mxPoint > pts, Dictionary< string, Object > style)
 Draws the given lines as segments between all points of the given list of mxPoints. More...
 
mxPoint DrawMarker (Object type, mxPoint p0, mxPoint pe, float size, Pen pen)
 Draws the given type of marker. More...
 
void DrawText (string text, int x, int y, int w, int h, Dictionary< string, Object > style)
 Draws the specified text either using drawHtmlString or using drawString. More...
 
void Destroy ()
 Destroys the canvas and frees all allocated resources. More...
 

Static Public Member Functions

static int getArcSize (int w, int h)
 Computes the arc size for the given dimension. More...
 

Static Public Attributes

static bool PRESERVE_IMAGE_ASPECT = true
 Specifies if image aspect should be preserved in drawImage. More...
 
- Static Public Attributes inherited from com.mxgraph.mxBasicCanvas
static string DEFAULT_IMAGEBASEPATH = ""
 Defines the default value for the imageBasePath in all GDI canvases. Default is an empty string. More...
 

Protected Member Functions

Image LoadImage (String image)
 Returns an image instance for the given URL. If the URL has been loaded before than an instance of the same instance is returned as in the previous call. More...
 
void DrawGlassEffect (int x, int y, int w, int h, Dictionary< string, Object > style)
 Draws the glass effect. More...
 
void DrawPolygon (Point[] polygon, Brush brush, Pen pen, bool shadow)
 Draws a a polygon for the given parameters. More...
 
void DrawPath (GraphicsPath path, Brush brush, Pen pen, bool shadow)
 Draws a path for the given parameters. More...
 
void DrawRect (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow, bool rounded)
 Draws a rectangle for the given parameters. More...
 
void DrawImage (int x, int y, int w, int h, String image)
 Draws an image for the given parameters. More...
 
void DrawImage (int x, int y, int w, int h, String image, bool preserveAspect, bool flipH, bool flipV)
 Draws an image for the given parameters. More...
 
void DrawOval (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow)
 Draws an oval for the given parameters. More...
 
void DrawRhombus (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow)
 Draws an rhombus (aka. diamond) for the given parameters. More...
 
void DrawCylinder (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow)
 Draws a cylinder for the given parameters. More...
 
void DrawActor (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow)
 Draws an actor shape for the given parameters. More...
 
void DrawCloud (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow)
 Draws a cloud shape for the given parameters. More...
 
void DrawTriangle (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow, string direction)
 Draws a triangle shape for the given parameters. More...
 
void DrawHexagon (int x, int y, int w, int h, Brush brush, Pen pen, bool shadow, string direction)
 Draws a hexagon shape for the given parameters. More...
 
- Protected Member Functions inherited from com.mxgraph.mxBasicCanvas
string GetImageForStyle (Dictionary< string, Object > style)
 Gets the image path from the given style. If the path is relative (does not start with a slash) then it is appended to the imageBasePath. More...
 

Protected Attributes

Dictionary< string, Image > imageCache = new Dictionary<string, Image>()
 Cache for loading images. More...
 
Graphics g
 Global graphics handle to the image. More...
 
- Protected Attributes inherited from com.mxgraph.mxBasicCanvas
string imageBasePath = DEFAULT_IMAGEBASEPATH
 Defines the base path for images with relative paths. Trailing slash is required. Default value is DEFAULT_IMAGEBASEPATH. More...
 
Point translate = new Point(0, 0)
 Specifies the current translation. Default is (0,0). More...
 
double scale
 Specifies the current scale. Default is 1. More...
 
bool drawLabels = true
 Specifies whether labels should be painted. Default is true. More...
 

Properties

Graphics Graphics [get, set]
 Sets or gets the graphics object to paint the canvas. More...
 
- Properties inherited from com.mxgraph.mxBasicCanvas
Point Translate [get, set]
 see com.mxgraph.mxICanvas.Translate More...
 
double Scale [get, set]
 see com.mxgraph.mxICanvas.Scale More...
 
bool DrawLabels [get, set]
 Sets if labels should be visible. More...
 
string ImageBasePath [get, set]
 Sets or gets the image base path. More...
 
- Properties inherited from com.mxgraph.mxICanvas
Point Translate [get, set]
 Sets or returns the user object of the cell. More...
 
double Scale [get, set]
 Sets or returns the user object of the cell. More...
 

Detailed Description

Implementation of a canvas that uses GDI for painting.

Constructor & Destructor Documentation

com.mxgraph.mxGdiCanvas.mxGdiCanvas ( )
inline

Constructs a new GDI canvas.

com.mxgraph.mxGdiCanvas.mxGdiCanvas ( Graphics  g)
inline

Constructs a new GDI canvas for the given graphics instance.

Member Function Documentation

void com.mxgraph.mxGdiCanvas.Destroy ( )
inline

Destroys the canvas and frees all allocated resources.

void com.mxgraph.mxGdiCanvas.DrawActor ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws an actor shape for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
override Object com.mxgraph.mxGdiCanvas.DrawCell ( mxCellState  state)
inlinevirtual
void com.mxgraph.mxGdiCanvas.DrawCloud ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws a cloud shape for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
void com.mxgraph.mxGdiCanvas.DrawCylinder ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws a cylinder for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
void com.mxgraph.mxGdiCanvas.DrawGlassEffect ( int  x,
int  y,
int  w,
int  h,
Dictionary< string, Object >  style 
)
inlineprotected
void com.mxgraph.mxGdiCanvas.DrawHexagon ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow,
string  direction 
)
inlineprotected

Draws a hexagon shape for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
directionSpecifies the direction of the hexagon.

References com.mxgraph.mxConstants.DIRECTION_NORTH, and com.mxgraph.mxConstants.DIRECTION_SOUTH.

void com.mxgraph.mxGdiCanvas.DrawImage ( int  x,
int  y,
int  w,
int  h,
String  image 
)
inlineprotected

Draws an image for the given parameters.

Parameters
xX-coordinate of the image.
yY-coordinate of the image.
wWidth of the image.
hHeight of the image.
imageURL of the image.
void com.mxgraph.mxGdiCanvas.DrawImage ( int  x,
int  y,
int  w,
int  h,
String  image,
bool  preserveAspect,
bool  flipH,
bool  flipV 
)
inlineprotected

Draws an image for the given parameters.

Parameters
xX-coordinate of the image.
yY-coordinate of the image.
wWidth of the image.
hHeight of the image.
imageURL of the image.
override Object com.mxgraph.mxGdiCanvas.DrawLabel ( string  text,
mxCellState  state,
bool  html 
)
inlinevirtual
void com.mxgraph.mxGdiCanvas.DrawLine ( List< mxPoint pts,
Dictionary< string, Object >  style 
)
inline
mxPoint com.mxgraph.mxGdiCanvas.DrawMarker ( Object  type,
mxPoint  p0,
mxPoint  pe,
float  size,
Pen  pen 
)
inline
void com.mxgraph.mxGdiCanvas.DrawOval ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws an oval for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.

References com.mxgraph.mxConstants.SHADOW_OFFSETX, com.mxgraph.mxConstants.SHADOW_OFFSETY, and com.mxgraph.mxConstants.SHADOWCOLOR.

void com.mxgraph.mxGdiCanvas.DrawPath ( GraphicsPath  path,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws a path for the given parameters.

Parameters
pathPath object to be drawn.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.

References com.mxgraph.mxConstants.SHADOW_OFFSETX, com.mxgraph.mxConstants.SHADOW_OFFSETY, and com.mxgraph.mxConstants.SHADOWCOLOR.

void com.mxgraph.mxGdiCanvas.DrawPolygon ( Point[]  polygon,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws a a polygon for the given parameters.

Parameters
polygonPoints of the polygon.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.

References com.mxgraph.mxConstants.SHADOW_OFFSETX, com.mxgraph.mxConstants.SHADOW_OFFSETY, and com.mxgraph.mxConstants.SHADOWCOLOR.

void com.mxgraph.mxGdiCanvas.DrawRect ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow,
bool  rounded 
)
inlineprotected

Draws a rectangle for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
roundedBoolean indicating if the rectangle is rounded.

References com.mxgraph.mxConstants.SHADOW_OFFSETX, com.mxgraph.mxConstants.SHADOW_OFFSETY, and com.mxgraph.mxConstants.SHADOWCOLOR.

void com.mxgraph.mxGdiCanvas.DrawRhombus ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow 
)
inlineprotected

Draws an rhombus (aka. diamond) for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
void com.mxgraph.mxGdiCanvas.DrawShape ( int  x,
int  y,
int  w,
int  h,
Dictionary< string, Object >  style 
)
inline

Draws the shape specified with the STYLE_SHAPE key in the given style.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
styleStyle of the the shape.

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, com.mxgraph.mxConstants.ALIGN_TOP, com.mxgraph.mxConstants.DEFAULT_IMAGESIZE, com.mxgraph.mxConstants.DIRECTION_EAST, com.mxgraph.mxConstants.DIRECTION_NORTH, com.mxgraph.mxConstants.DIRECTION_SOUTH, com.mxgraph.mxConstants.DIRECTION_WEST, com.mxgraph.mxUtils.GetColor(), com.mxgraph.mxUtils.GetFloat(), com.mxgraph.mxUtils.GetInt(), com.mxgraph.mxUtils.GetString(), com.mxgraph.mxUtils.IsTrue(), com.mxgraph.mxConstants.SHAPE_ACTOR, com.mxgraph.mxConstants.SHAPE_CLOUD, com.mxgraph.mxConstants.SHAPE_CYLINDER, com.mxgraph.mxConstants.SHAPE_DOUBLE_ELLIPSE, com.mxgraph.mxConstants.SHAPE_ELLIPSE, com.mxgraph.mxConstants.SHAPE_HEXAGON, com.mxgraph.mxConstants.SHAPE_LABEL, com.mxgraph.mxConstants.SHAPE_LINE, com.mxgraph.mxConstants.SHAPE_RHOMBUS, com.mxgraph.mxConstants.SHAPE_TRIANGLE, com.mxgraph.mxConstants.STYLE_DASHED, com.mxgraph.mxConstants.STYLE_DIRECTION, com.mxgraph.mxConstants.STYLE_FILLCOLOR, com.mxgraph.mxConstants.STYLE_GLASS, com.mxgraph.mxConstants.STYLE_GRADIENT_DIRECTION, com.mxgraph.mxConstants.STYLE_GRADIENTCOLOR, com.mxgraph.mxConstants.STYLE_IMAGE, com.mxgraph.mxConstants.STYLE_IMAGE_ALIGN, com.mxgraph.mxConstants.STYLE_IMAGE_BACKGROUND, com.mxgraph.mxConstants.STYLE_IMAGE_BORDER, com.mxgraph.mxConstants.STYLE_IMAGE_FLIPH, com.mxgraph.mxConstants.STYLE_IMAGE_FLIPV, com.mxgraph.mxConstants.STYLE_IMAGE_HEIGHT, com.mxgraph.mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, com.mxgraph.mxConstants.STYLE_IMAGE_WIDTH, com.mxgraph.mxConstants.STYLE_OPACITY, com.mxgraph.mxConstants.STYLE_ROUNDED, com.mxgraph.mxConstants.STYLE_SHADOW, com.mxgraph.mxConstants.STYLE_SHAPE, com.mxgraph.mxConstants.STYLE_SPACING, com.mxgraph.mxConstants.STYLE_STROKECOLOR, and com.mxgraph.mxConstants.STYLE_STROKEWIDTH.

void com.mxgraph.mxGdiCanvas.DrawText ( string  text,
int  x,
int  y,
int  w,
int  h,
Dictionary< string, Object >  style 
)
inline

Draws the specified text either using drawHtmlString or using drawString.

Parameters
text
xX-coordinate of the text.
yY-coordinate of the text.
wWidth of the text.
hHeight of the text.
styleStyle to be used for painting the text.

References com.mxgraph.mxUtils.GetColor(), com.mxgraph.mxUtils.GetFloat(), com.mxgraph.mxUtils.GetFont(), com.mxgraph.mxUtils.GetStringFormat(), com.mxgraph.mxUtils.IsTrue(), com.mxgraph.mxConstants.STYLE_FONTCOLOR, com.mxgraph.mxConstants.STYLE_HORIZONTAL, com.mxgraph.mxConstants.STYLE_LABEL_BACKGROUNDCOLOR, com.mxgraph.mxConstants.STYLE_LABEL_BORDERCOLOR, and com.mxgraph.mxConstants.STYLE_OPACITY.

void com.mxgraph.mxGdiCanvas.DrawTriangle ( int  x,
int  y,
int  w,
int  h,
Brush  brush,
Pen  pen,
bool  shadow,
string  direction 
)
inlineprotected

Draws a triangle shape for the given parameters.

Parameters
xX-coordinate of the shape.
yY-coordinate of the shape.
wWidth of the shape.
hHeight of the shape.
brushOptional brush for painting the background.
penOptional pen for painting the border.
shadowBoolean indicating if a shadow should be painted.
directionSpecifies the direction of the triangle.

References com.mxgraph.mxConstants.DIRECTION_NORTH, com.mxgraph.mxConstants.DIRECTION_SOUTH, and com.mxgraph.mxConstants.DIRECTION_WEST.

static int com.mxgraph.mxGdiCanvas.getArcSize ( int  w,
int  h 
)
inlinestatic

Computes the arc size for the given dimension.

Parameters
wWidth of the rectangle.
hHeight of the rectangle.
Returns
Returns the arc size for the given dimension.
Image com.mxgraph.mxGdiCanvas.LoadImage ( String  image)
inlineprotected

Returns an image instance for the given URL. If the URL has been loaded before than an instance of the same instance is returned as in the previous call.

References com.mxgraph.mxUtils.LoadImage().

Member Data Documentation

Graphics com.mxgraph.mxGdiCanvas.g
protected

Global graphics handle to the image.

Dictionary<string, Image> com.mxgraph.mxGdiCanvas.imageCache = new Dictionary<string, Image>()
protected

Cache for loading images.

bool com.mxgraph.mxGdiCanvas.PRESERVE_IMAGE_ASPECT = true
static

Specifies if image aspect should be preserved in drawImage.

Property Documentation

Graphics com.mxgraph.mxGdiCanvas.Graphics
getset

Sets or gets the graphics object to paint the canvas.

Referenced by com.mxgraph.mxStencil.CreateCanvas(), and com.mxgraph.mxImageCanvas.mxImageCanvas().


The documentation for this class was generated from the following file: