Drawing Methods

Return to Introduction  Previous page  Next page

Method Name

Description

moveto(
       int x,
       int y)

Moves the pen cursor to the point specified by x and y.

lineto(
       int x,
       int y)

Moves the pen cursor to the point specified by x and y.

rectangle(
       int left,
       int top,
       int right,
       int bottom)

Draws a rectangle with extents at left, top, right, bottom.

roundrect(
       int left,
       int top,
       int right,
       int bottom,
       int abs_cornerwidth,
       int abs_cornerheight)

Draws a rectangle with rounded corners, with extents defined by left, top, right and bottom.  The size for the corners is defined by abs_cornerwidth and abs_cornerheight; these values do not scale with the shape.

ellipse(
       int left,
       int top,
       int right,
       int bottom)

Draws an ellipse with extents defined by left, top, right and bottom.

arc(
       int left,
       int top,
       int right,
       int bottom,
       int startingpointx,
       int startingpointy,
       int endingpointx,
       int endingpointy)

Draws an elliptical arc with the ellipse having extents at left, top, right and bottom.  The start point of the arc is defined by the intersection of the ellipse and the line from the center of the ellipse and the point (startingpointx, startingpointy).  The end of the arc is similarly defined by (endingpointx, endingpointy).

bezierto(
       int controlpoint1x,
       int controlpoint1y,
       int controlpoint2x,
       int controlpoint2y,
       int endpointx,
       int endpointy)

Draws a bezier curve and updates the pen position.

polygon(
       int centerx,
       int centery, 
       int numberofsides,
       int radius,
       float rotation)

Draws a regular polygon with center at the point (centerx, centery), and numberofsides number of sides.

image(
       string imageId,
       int left,
       int top,
       int right,
       int bottom)

Draws the image that has the name imageId in the Image Manager.

startpath()

 

startcloudpath(
       puffWidth,
       puffHeight,
       noise)

Parameters:

·float puffWidth (default = 30), the distance between puffs
·float puffHeight (default = 15), the distance
·float noise (default = 1.0), the randomization of the puffs positions.

Similar to StartPath, except that it draws the path with cloud-like curved segments ("puffs"). 

endpath()

Ends the sequence of drawing commands that define a path.

fillpath()

Fills the previously defined path with the current fill color.

strokepath()

Draws the outline of the previously defined path with the current pen.

fillandstrokepath()

Fills the previously defined path with the current fill color, then draws its outline with the current pen.

drawnativeshape()

Causes Enterprise Architect to render the shape using its usual, non-shapescript notation.  Subsequent drawing commands are super-imposed over the native notation.

This method is only enabled for element shape scripts; line shape scripts are not supported.

setpen(
       int red,
       int green,
       int blue,
       [int penwidth])

Sets the pen to the color and optionally the pen width.

setlinestyle(
       string linestyle)

Parameters:

string linestyle: the following styles are valid:

·"solid"
·"dash"
·"dot"
·"dashdot"
·"dashdotdot"

Changes the stroke pattern for commands that use the pen.

setpenwidth(
       int penwidth)

Sets the width of the pen.  Pen width should be between 1 and 5.

setfillcolor(
       int red,
       int green,
       int blue)

Sets the fill color.

setpencolor(
       int red,
       int green,
       int blue)

Sets the pen color.

setdefaultcolors()

Returns the brush and pen color to the default settings, or to the user-defined colors if available. See Color Queries.

addsubshape(
       string shapename,
       [int width,
       int height]);

Adds a sub shape with the name shapename that must be defined with in the current shape definition.

hidelabel(
       string labelname)

Hides the label.

showlabel(
       string labelname)

Reveals a hidden label.

println(
       string text)

Appends a line of text to the shape and a line break.

print(
       string text)

Prints the specified text string.