Username: Password:

Draw Plug-in Scripting Reference



Overview

The draw plugin is the workhorse of DreamFactory. You can have text, bitmap, rectangle, roundrect, arc, line, polygon, and oval objects.

The bitmap objects allow import of a variety of image file formats, importing is slow, but display is very fast.

Text objects are not editable, use the text plugin for rich edit controls.

The geometric objects allow for fades, arbitrary polygons, reshaping, and style conversion.

Messages: nodemove, nodechange

Nodemove is sent when the position of the draw object changes.

Nodechange is sent when the data in a text, bitmap or polygon object changes.

 

Commands and Functions



alignget, alignset

text align # = alignget(node name $)
alignset(node name $, text align #)

Get or set text alignment, -1 to 1 for left, center, and right.



antialiasget, antialiasset

antialias TF = antialiasget(node name $)
antialiasset(node name $, antialias TF)

Turn on and off antialiasing for draw objects.

This property does not effect bitmaps or text. Antialiasing for text depends on the selected font.





arcstartget, arcstartset, arcstopget, arcstopset

arc start # = arcstartget(node name $)
arcstartset(node name $, arc start #)
arc stop # = arcstopget(node name $)
arcstopset(node name $, arc stop #)

Get or set the start and stop angles for an arc.
See: arcstartstop


arcstartstop

arcstartstop(node name $, arc start #, arc stop #)

Set the start and stop angles for an arc.
See: arcstartset, arcstartget, arcstopset, arcstopget





begincolorget, begincolorset, endcolorget, endcolorset

begin color $ = begincolorget(node name $)
begincolorset(node name $, begin color $)
end color $ = endcolorget(node name $)
endcolorset(node name $, end color $)

These functions set the colors for radial and regular fades.











beginhorget, beginhorset, beginhorver, beginverget, beginverset, endhorget, endhorset, endhorver, endverget, endverset

hor # = beginhorget(node name $)
beginhorset(node name $, hor #)
beginhorver(node name $, hor #, ver #)
ver # = beginverget(node name $)
beginverset(node name $, ver #)
hor # = endhorget(node name $)
endhorset(node name $, hor #)
endhorver(node name $, hor #, ver #)
ver # = endverget(node name $)
endverset(node name $, ver #)

Get or set the fade and radial fade start and end points. These are relative to the top, left of the bounds of the object.



binaryget, binaryset

binary data $ = binaryget(node name $)
binaryset(node name $, binary data $)

Get or set binary data for any bitmap.

This routine is useful for serialization into xml and trading data between bitmaps.


bitsreset

bitsreset(node name $)

Bitsreset will give the bitmap native width and height for a 100% scale and maximum drawing speed.



boundsget, boundsset

rectangle $ = boundsget(node name $)
boundsset(node name $, rectangle $)

Get or set the boundary rectangle of the object. Polygons and bitmaps are losslessly scaled to the new bounds.



copy, paste

copy(node name $)
paste(node name $)

Move the bitmap on or off the system clipboard as graphics.






cornerhorget, cornerhorset, cornerhorver, cornerverget, cornerverset

hor # = cornerhorget(node name $)
cornerhorset(node name $, hor #)
cornerhorver(node name $, hor #, ver #)
ver # = cornerverget(node name $)
cornerverset(node name $, ver #)

Get or set the corner for a round rectangle. This is the height or width of the oval at each corner.



dataget, dataset

data $ = dataget(node name $)
dataset(node name $, data $)

get or set the data for text or polygon objects.

If the object is something else, dataset does nothing and dataget returns an empty string.
See: textdataget, textdataset, polydataset, polydataget



export, import

export(node name $, file name $)
import(node name $, file name $, percent reduce #)

Import data into a bitmap. The percent reduce parameter will control final data size at the expense of quality.

Use negative one to dither, which is maximum quality.



fadeget, fadeset

fade TF = fadeget(node name $)
fadeset(node name $, fade TF)

Turn fades on and off.
See: begincolorset, endcolorset, begincolorget, endcolorget





fillbackcolorget, fillbackcolorset, fillforecolorget, fillforecolorset

fill back color $ = fillbackcolorget(node name $)
fillbackcolorset(node name $, fill back color $)
fill fore color $ = fillforecolorget(node name $)
fillforecolorset(node name $, fill fore color $)

Get or set the fill fore and back colors. The fore color is for "on" bits in the pattern, the back color is for "off" bits.

All alpha channels work fine, 255 for opaque, 0 for clear. Example:

draw.fillforecolorset("myobject", "100, 100, 100, 255")





fillcolorget, fillcolorset, textcolorget, textcolorset

text fill color $ = fillcolorget(node name $)
fillcolorset(node name $, text fill color $)
text color $ = textcolorget(node name $)
textcolorset(node name $, text color $)

Get or set the text color and fill color for a text object.



fillget, fillset

fill TF = fillget(node name $)
fillset(node name $, fill TF)

Turn on and off filled objects.





fillpatternget, fillpatternset, linepatternget, linepatternset

fillpattern $ = fillpatternget(node name $)
fillpatternset(node name $, fillpattern $)
linepattern $ = linepatternget(node name $)
linepatternset(node name $, linepattern $)

Get or set the fill and/or line patterns. Example:

draw.fillpatternset("myobject", "gray")



fontnameget, fontnameset

font name $ = fontnameget(node name $)
fontnameset(node name $, font name $)

Get or set the font name.



fontsizeget, fontsizeset

font size # = fontsizeget(node name $)
fontsizeset(node name $, font size #)

Get or set the font size.



fontstyleget, fontstyleset

font style $ = fontstyleget(node name $)
fontstyleset(node name $, font style $)

Get or set the font style. Available styles include: plain, bold, italic, and underline.





fullget, fullset, infoget, infoset

full $ = fullget(node name $)
fullset(node name $, full $)
info $ = infoget(node name $)
infoset(node name $, info $)

Get or set XML data that describes all the settings for this node.

The fullget and fullset routines have a header element with appropriate namespaces, infoget and infoset are an XML snippet for access as a property. Example:

mynode.info.title = "new title"



gutterget, gutterset

text gutter # = gutterget(node name $)
gutterset(node name $, text gutter #)

Get or set the gutter, which is the border size for the text.



handlesget, handlesset

handles TF = handlesget(node name $)
handlesset(node name $, handles TF)

Turn on or off dragable handles for reshaping the node.

This routine is used by the system tool palettes for manual positioning.
See: markersget, markersset, partget, partset



hiliteget, hiliteset

hilite TF = hiliteget(node name $)
hiliteset(node name $, hilite TF)

Get or set the hilite of the object, which inverts the object's image.

This is useful to show mouse control of the object.


hittest

hit TF = hittest(node name $, hor #, ver #)

Returns true if the point is in the draw object.



leadingget, leadingset

text leading # = leadingget(node name $)
leadingset(node name $, text leading #)

Get or set the leading of the text object for double spacing, etc.




length, polyhor, polyver

length # = length(node name $)
hor point # = polyhor(node name $, length #)
ver point # = polyver(node name $, length #)

Get the length of a polygon with length.

Use polyhor and polyver to calculate points along the polygon at various lengths.

These functions can be used to move an object along a polygon.





linebackcolorget, linebackcolorset, lineforecolorget, lineforecolorset

line back color $ = linebackcolorget(node name $)
linebackcolorset(node name $, line back color $)
line fore color $ = lineforecolorget(node name $)
lineforecolorset(node name $, line fore color $)

Get or set the line fore and back colors. The fore color is for "on" bits in the pattern, the back color is for "off" bits.

All alpha channels work fine, 255 for opaque, 0 for clear. Example:

draw.lineforecolorset("myobject", "100, 100, 100, 255")






lineheightget, lineheightset, linewidthget, linewidthheight, linewidthset

lineheight # = lineheightget(node name $)
lineheightset(node name $, lineheight #)
linewidth # = linewidthget(node name $)
linewidthheight(node name $, width #, height #)
linewidthset(node name $, linewidth #)

Get or set the line width and height for all objects except text and bitmaps.



lockedget, lockedset

is locked TF = lockedget(node name $)
lockedset(node name $, locked TF)

Get or set the locked attribute to fix a bitmap in memory during a drag or rotation.

Don't leave bitmaps locked because they can take up RAM.



markersget, markersset

markers TF = markersget(node name $)
markersset(node name $, markers TF)

Turn on or off the node outline to show selection.

This routine is used by the system tool palettes to show that a node is selected.
See: handlesset, handlesget, partget, partset



maskget, maskset

mask TF = maskget(node name $)
maskset(node name $, mask TF)

Turn on or off the masking of bitmaps. Pure white is clear.



miterget, miterset

miter $ = miterget(node name $)
miterset(node name $, miter $)

The miter property controls how lines are drawn and connected. This property is available for lines and framed polygons.

Miter styles include: classic, beveled, rounded, and none.

The classic miter supports a pen width and height. The pen hangs to the lower right of the line point.

The beveled miter draws square caps on the line. The line thickness is the average of the pen width and height.

The rounded miter draws round caps on the line. The line thickness is the average of the pen width and height.



partget, partset

part # = partget(node name $, hor #, ver #)
partset(node name $, hor #, ver #, part #)

Get or set the points for an individual handle.
See: markersget, markersset, handlesset, handlesget



polydataget, polydataset

poly data $ = polydataget(node name $)
polydataset(node name $, polygon data $)

Get or set the polygon data.

The data is a string with a series of horizontal and vertical points separated by commas. Example:

draw.polydataset("mysquare", "100, 100, 200, 100, 200, 200, 200, 100, 100, 100")

See: dataget, dataset, polyreset


polyreset

polyreset(node name $)

Polyreset will set the boundary of the polygon to fit the points.

Call this command after dataset or smooth.
See: dataget, dataset, smooth



radialget, radialset

radial TF = radialget(node name $)
radialset(node name $, radial TF)

Turn radial fades on and off.
See: begincolorset, endcolorset, begincolorget, endcolorget


reset

reset(node name $)

Reset the boundary rectangle for text, bitmap or polygon objects.

If the object is something else, reset does nothing.
See: bitsreset, textreset, polyreset



reshapeget, reshapeset

reshape TF = reshapeget(node name $)
reshapeset(node name $, reshape TF)

Turn on or off handles for reshaping polygons, lines, and arcs.

Polygons and lines have handles on every vertex, arcs have handles on the start and stop angles.



rotateget, rotateset

degree # = rotateget(node name $)
rotateset(node name $, degree #)

Get or set rotation for bitmaps and polygons.


smooth

smooth(node name $)

This command will knock the corners off the polygon. Call it about 3 times to make the polygon quite smooth.
See: polyreset











starthorget, starthorset, starthorver, startverget, startverset, stophorget, stophorset, stophorver, stopverget, stopverset

hor # = starthorget(node name $)
starthorset(node name $, hor #)
starthorver(node name $, hor #, ver #)
ver # = startverget(node name $)
startverset(node name $, ver #)
hor # = stophorget(node name $)
stophorset(node name $, hor #)
stophorver(node name $, hor #, ver #)
ver # = stopverget(node name $)
stopverset(node name $, ver #)

Get or set the start or stop points of a line.



styleget, styleset

style name $ = styleget(node name $)
styleset(node name $, style name $)

Get or set the draw style: text, bitmap, rectangle, roundrect, arc, line, polygon, and oval.

Some draw commands and functions only work with certain styles.



textdataget, textdataset

text data $ = textdataget(node name $)
textdataset(node name $, text data $)

Get or set text data.
See: dataget, dataset



textfillget, textfillset

fill TF = textfillget(node name $)
textfillset(node name $, fill TF)

Get or set the fill of text objects.
See: fillget, fillset


textreset

textreset(node name $)

Textreset will set the width and height of the text object to fit the text exactly.



wordwrapget, wordwrapset

text has word wrap TF = wordwrapget(node name $)
wordwrapset(node name $, has word wrap TF)

Get or set the word wrap for text objects.