The PaintletScript Tag Set

<PAINTLET>
The top-level tag in PaintletScript.

<HEAD>
The header tag. Contains descriptive information that will be displayed to the user just prior to running the script. Encloses the title, author, date and description tags.
parameters
  • version: (optional) the version of Paintlet used to create the script

  • <TITLE>
    The script title tag. Encloses text. Valid within the HEAD tag.

    <AUTHOR>
    The script author tag. Encloses text. Valid within the HEAD tag.

    <DATE>
    The date tag. Script creation date. Valid within the HEAD tag.
    parameters
  • day: day of month, 1 thru 31
  • month: 1 thru 12
  • year: 2007

  • <DESCRIPTION>
    The description tag. Encloses text. Valid within the HEAD tag. Provides a useful information about the script that will be displayed to the user prior to running the script.

    <CONTEXT>
    The context tag. Supplies the initial paint and brush settings before a script is run. Encloses paint and brush tags. Normally placed just after the head tag.

    <PAINT>
    Specifies the paint attributes that affect graphic rendering.
    parameters
  • color: the paint color in r,g,b format or a PaintletScript color constant.
    red green blue black white gray lightgray darkgray
    yellow orange violet purple aqua pink hotpink brown
    palegreen paleblue palered paleyellow palepink palegray heavenlyblue pumpkin
    olive cranberry muddybrown salmon taupe lavendar skyblue sage
    seashellpink wheat peach sunshine springtime offwhite parchment silverblue
    gold coral coffee sunset seagreen rust oldeblue shamrock

    Two examples: color=255,0,0 and color=red

  • image: number of the image used to paint. values from 0 thru 39 corresponding to the Paintlet image palette.
  • solid: true or false. paint solid or hollow.
  • transparency: paint fully transparent (0.0) to fully opaque (1.0).
  • gradient: true or false. paint in a color gradient. additional parameters required are color0 and color1, in rgb or color constants.

  • <BRUSH>
    Specifies the attributres of the pen used to draw shapes.
    parameters
  • width: width of the pen. values 1 thru 75.
  • dash: draw with a skipped line. values true or false.
  • cap: endcap for lines. values are square (default), round or butt.
  • join: style of line joins. values miter (default), round or bevel.
  • density: specifies the snowBrush density. 0 thru 100.

  • <FREEHAND>
    The freeform painting tool.
    parameters
  • previousx: x coordinate of the line segment start point.
  • previousy: y coordinate of the line segment start point.
  • x: x coordinate of the line segment end point.
  • y: y coordinate of the line segment end point.

  • <LINE>
    The line painting tool.
    parameters
  • startx: x coordinate of the line start point.
  • starty: y coordinate of the line start point.
  • endx: x coordinate of the line end point.
  • endy: y coordinate of the line end point.

  • <ELLIPSE>
    The ellipse painting tool.
    parameters
  • startx: x coordinate of the enclosing rectangle's upper left point.
  • starty: y coordinate of the enclosing rectangle's upper left point.
  • endx: x coordinate of the enclosing rectangle's lower right point.
  • endy: y coordinate of the enclosing rectangle's lower right point.

  • <CURVE>
    The curve painting tool.
    parameters
  • startx: x coordinate of the curve segment's start point.
  • starty: y coordinate of the curve segment's start point.
  • midx: x coordinate of the curve segment's control point.
  • midy: y coordinate of the curve segment's control point.
  • endx: x coordinate of the curve segment's end point.
  • endy: y coordinate of the curve segment's end point.

  • <RECTANGLE>
    The rectangle painting tool.
    parameters
  • startx: x coordinate of the rectangle's upper left point.
  • starty: y coordinate of the rectangle's upper left point.
  • endx: x coordinate of the rectangle's lower right point.
  • endy: y coordinate of the rectangle's lower right point.

  • <BLEND>
    A soft-blending paint tool.
    parameters
  • startx: x coordinate of the blend drawing point.
  • starty: y coordinate of the blend drawing point.

  • <SPRAY>
    A spray paint tool.
    parameters
  • startx: x coordinate of the spray center point.
  • starty: y coordinate of the spray center point.

  • <ERASE>
    A paint eraser tool. Draws solid circles with background color.
    parameters
  • startx: x coordinate of the erase center point.
  • starty: y coordinate of the erase center point.

  • <BACKGROUND>
    Repaints the entire canvas in the current color.

    <UNDO>
    Undo the last paint operation.

    <IMAGE>
    Paint an image on the canvas.
    parameters
  • src: location of the image. a local file or a url.
  • y: x coordinate of the image upper left corner.
  • y: y coordinate of the image upper left corner.

  • <TEXT>
    Opening text tag. Encloses text attribute tags and text to be drawn.
    parameters
  • y: x coordinate of the text string.
  • y: y coordinate of the text string.

  • <FONT>
    The text font attribute. Enclosed by text tag.
    parameters
  • name: the font name, such as Lucida or Serif.
  • style: plain, bold or italic.
  • size: specify an integer value.

  • <TEXTPAINT>
    The text paint attribute. Enclosed by text tag.
    parameters
  • color: an rgb or color constant value.
  • transparency: fully transparent (0.0) to fully opaque (1.0).
  • gradient: true or false. paint text in a color gradient. additional parameters required are color0 and color1, in rgb or color constants. a gradient type parameter may also be supplied, with values n, ne, e, se, s, sw, w, nw

  • <TEXTLAYOUT>
    Spatial arrangement of the text. Enclosed by text tag.
    parameters
  • startx: x coordinate of the layout curve start point.
  • starty: y coordinate of the layout curve start point.
  • midx: x coordinate of the layout curve control point.
  • midy: y coordinate of the layout curve control point.
  • endx: x coordinate of the layout curve end point.
  • endy: y coordinate of the layout curve end point.

  • <TEXTHILITE>
    Text hilite attribute. Enclosed by text tag.
    parameters
  • color: hilite color. an rgb or color constant.
  • width: an integer value that specifies hilite width.
  • type: leading or trailing.

  • <TEXTSPECIAL>
    Specifies a special text rendering style. Enclosed by text tag.
    parameters
  • type: the special text style. values are shadow, image, crossword, reflect, radial, rainbow

  • </TEXT>
    The enclosing text tag.

    <FILTER>
    Specifies a filter operation on the canvas. x,y,width,height are optional.
    parameters
  • type: values are bleach, gray, negative, xred, xgreen, xblue, colorweave, frame, haze, blur, sharpen, rotate, reflect, emboss, flake, sine, sine2, scale
  • intensity: filter strength (does not apply to negative, colorweave, sharpen, rotate, reflect, emboss, flake or scale)
  • x: filter region x coordinate (upper left anchor point, default 0).
  • y: filter region y coordinate. default 0.
  • width: filter region width. default is canvaswidth constant
  • height: filter region height. default is canvasheight constant
  • degree: rotation filter parameter. 0 thru 360
  • scale: scale filter parameter. 5 thru 300 (percent of original)

  • <COLORMAP> Opening tag for a colorize operation. Contains tones and distribution tags.

    <TONES>
    Set of nine colors that define the color mapping.
    parameters
  • color0 thru color8: rgb or color constants.

  • <DISTRIBUTION>
    Weight given to tones in the color mapping.
    parameters
  • values: a comma separated list of eight color weight values. defaults to all 1.0

  • </COLORMAP> Closing tag for a color mapping. tags.

    <SPOTLIGHT>
    Add a spotlight to the canvas.
    parameters
  • color: rgb or color constant value.
  • intensity: values 1 thru 30 or low, medium, high
  • ambiance: surrounding light strength. value 0 thru 100 or low, medium, high
  • angle: spotlight direction. values are 0 thru 360 or n, ne, e, se, s, sw, w, nw (or north etc.)
  • x: spotlight rectangle's x coordinate (upper left point).
  • y: spotlight rectangle's y coordinate.
  • width: spotlight width.
  • height: spotlight height.

  • <EDIT>
    Standard cut, copy and paste functions applied to the canvas.
    parameters
  • action: cut, copy or paste.
  • intensity: values 1 thru 30 or low, medium, high
  • ambiance: surrounding light strength. value 0 thru 100 or low, medium, high
  • angle: spotlight direction. values are 0 thru 360 or n, ne, e, se, s, sw, w, nw (or north etc.)
  • x: edit region x coordinate (upper left point).
  • y: edit region y coordinate.
  • width: edit region width. (not required for paste)
  • height: edit region height. (not required for paste)

  • <CANVAS>
    Sets the area of the paintable canvas.
    parameters
  • x: x coordinate (upper left point) of the paintable canvas.
  • y: canvas y coordinate.
  • width: canvas paintable width.
  • height: canvas height.

  • <PAUSE>
    Pause time between executing paint operations.
    parameters
  • msec: pause time in milliseconds. (1000 equals one second pause)

  • <END/>
    Signals end of script. A The End. message is displayed.

    <END>
    Opening end tag. Signals end of script. Encloses text to be displayed.

    </END>
    Closing end tag. Displays message with enclosed text.

    <VARIABLE>
    Variable declaration and initialization. Remains in scope until script exits.
    parameters
  • type: variable type. int, float, boolean or string. required for initialization only.
  • name: variable name. always required.
  • value: variable value assignment. defaults to 0, 0.0, false and empty string.
    the following function values may also be used for assignment:
    abs(x) sin(x) cos(x) tan(x) asin(x) acos(x) atan(x)
    exp(x) log(x) log10(x) sqrt(x) todeg(x) torad(x) floor(x) ceil(x)
    rand(x) rand() eval(x+y) eval(x-y) eval(x*y) eval(x/y) eval(x%y)

    notes:
    rand(x) will return a random integer between 0 and x. the rand() function will return a float between 0.0 and 1.0
    x and y function arguments may be variables or PaintletScript constants.
    casting from (float to int) or (int to float) is implicit. loss of precision may result.
    examples:
    value=eval(x+10) where x is a previously defined variable
    value=eval(canvaswidth/2) where canvaswidth is a PaintletScript constant
    value=rand(255) assigns a random between 0 and 255

  • action: updates current variable value. ++, --, +=, -=, *=, /=
    examples:
    action=++ increments the variable value by 1.
    action=+=5 adds 5 to the current variable value.
    action=-=4 substracts 4 from the current value.

  • <LOOP>
    Loop opening tag. Executes enclosed tags in a loop.
    parameters
  • type: simple, for, while
  • iterations: number of iterations. simple loops only.
  • bex: boolean expression. must be enclosed in parenthesis. see examples below.

    examples:
    simple loop type=simple iterations=10
    for loop type=for bex=(<= 100)
    while loop type=while bex=(foo < canvaswidth)
    notes
    simple loops will execute for a specific number of iterations.
    for loops have an implicit counter, initialized to 0 and incrementing after each loop. the boolean expression bex is compared to this implicit counter.
    the while loop boolean expression requires two operands and a boolean operator.


  • </LOOP>
    Loop closing tag.

    <IF>
    An if conditional opening tag. Executes enclosed tags if conditional bex evaluates true.
    parameters
  • bex: boolean expression. must be enclosed in parenthesis. see example below.

    example:
    bex=(foo > bar)


  • </IF>
    An if conditional closing tag.

    <ELSEIF>
    An elseif conditional opening tag. Executes enclosed tags if conditional bex evaluates true and preceeding if and/or elseif tags were false. An if tag must precede this tag.
    parameters
  • bex: boolean expression. must be enclosed in parenthesis. see example below.

    example:
    bex=(foo > bar)


  • </ELSEIF>
    An elseif conditional closing tag.

    <ELSE>
    An else opening tag. Executes enclosed tags if preceeding if and optional elseif tags evaluated false.

    </ELSE>
    An else closing tag.

    <SCRIPT>
    Loads and executes another PaintletScript file. Scripts are executed in sequence.
    parameters
  • src: PaintletScript file name and location. local file or url.
  • </PAINTLET>
    The final tag enclosing a PaintletScript.