SWFShape


$s = new SWFShape();
s = SWFShape()
SWFShape *s = new SWFShape();
SWFShape s = newSWFShape();

Creates a new shape object.


$s->setLine($width, $r, $g, $b [, $a]);
s.setLine(width, r, g, b [, a])
s->setLine(width, r, g, b [, a]);
SWFShape_setLine(width, r, g, b, a);
Sets the shape's line style.


$s->setLine(0);
s.setLine(0)
s->setLine(0, r, g, b [, a]);
SWFShape_setLine(0, r, g, b, a);
Removes the shape's line style.


$f = $s->addFill($r, $g, $b [, $a]);
f = s.addFill(r, g, b [, a])
f = s->addSolidFill(r, g, b [, a]);
f = SWFShape_addSolidFill(r, g, b, a);
Adds a solid fill to the shape's list of fill styles. Returns an SWFFill object for use with the setFill functions described below.


$f = $s->addFill($bitmap [, $flags]);
f = s.addFill(bitmap [, flags])
f = s->addBitmapFill(b [, flags]);
f = SWFShape_addBitmapFill(bitmap, flags);
Adds a bitmap fill to the shape's fill styles. Returns an SWFFill object.

The bitmap argument is an SWFBitmap object. The flags argument can be SWFFILL_CLIPPED_BITMAP or SWFFILL_TILED_BITMAP. Default is SWFFILL_TILED_BITMAP. I think.



$f = $s->addFill($gradient [, $flags]);
f = s.addFill(gradient [, flags])
f = s->addGradientFill(g [, flags]);
f = SWFShape_addGradientFill(gradient, flags);
Adds a gradient fill to the shape's fill styles. Returns an SWFFill object.

The gradient argument is an SWFGradient object. The flags argument can be SWFFILL_RADIAL_GRADIENT or SWFFILL_LINEAR_GRADIENT. Default is SWFFILL_LINEAR_GRADIENT. I'm sure about this one. Really.



$s->setLeftFill($fill);
s.setLeftFill(fill)
s->setLeftFill(fill);
SWFShape_setLeftFill(fill);

$s->setRightFill($fill);
s.setRightFill(fill)
s->setRightFill(fill);
SWFShape_setRightFill(fill);

What this nonsense is about is, every edge segment borders at most two fills. When rasterizing the object, it's pretty handy to know what those fills are ahead of time, so the swf format requires these to be specified.

setLeftFill sets the fill on the left side of the edge- that is, on the interior if you're defining the outline of the shape in a counter-clockwise fashion. The fill object is an SWFFill object returned from one of the addFill functions above.

This seems to be reversed when you're defining a shape in a morph, though. If your browser crashes, just try setting the fill on the other side.



$s->setLeftFill($r, $g, $b [, $a]);
s.setLeftFill(r, g, b [, a])
s->setLeftFill(r, g, b [, a]);

$s->setRightFill($r, $g, $b [, $a]);
s.setRightFill(r, g, b [, a])
s->setRightFill(r, g, b [, a]);

Shortcut for $s->set[Left/Right]Fill($s->addFill($r, $g, $b [, $a]));


$s->movePenTo($x, $y);
s.movePenTo(x, y)
s->movePenTo(x, y);
SWFShape_movePenTo(x, y);
Move the shape's pen to (x,y) in the shape's coordinate space.


$s->movePen($dx, $dy);
s.movePen(dx, dy)
s->movePen(dx, dy);
SWFShape_movePen(dx, dy);
Add dx to pen's current x position, dy to y.


$s->drawLineTo($x, $y);
s.drawLineTo(x, y)
s->drawLineTo(x, y);
SWFShape_drawLineTo(x, y);
Draw a line (using the current line style) from the current pen position to point (x,y) in the shape's coordinate space.


$s->drawLine($dx, $dy);
s.drawLine(dx, dy)
s->drawLine(dx, dy);
SWFShape_drawLine(dx, dy);
Draw a line (using the current line style) from the current pen position to displacement (dx,dy).


$s->drawCurveTo($controlx, $controly, $anchorx, $anchory);
s.drawCurveTo(controlx, controly, anchorx, anchory)
s->drawCurveTo(controlx, controly, anchorx, anchory);
SWFShape_drawCurveTo(controlx, controly, anchorx, anchory);
Draw a quadratic curve (using the current line style) from the current pen position to (anchorx,anchory) using (controlx,controly) as a control point. That is, head towards the control point, then smoothly turn to the anchor point. Wait, maybe a diagram will help:

..see?



$s->drawCurve($controldx, $controldy, $anchordx, $anchordy);
s.drawCurve(controldx, controldy, anchordx, anchordy)
s->drawCurve(controldx, controldy, anchordx, anchordy);
SWFShape_drawCurve(controldx, controldy, anchordx, anchordy);
Draw a quadratic curve (using the current line style) from the current pen position to displacement (anchordx,anchordy) using displacement (controldx,controldy) as a control point.


Shape example

back to index


All content Copyright (C) 2000-2002 Opaque Industries except where noted otherwise.