The meanings of the arguments used in these functions are as follows:
X and Y coordinates control positioning of start, end, or center points of shapes. The numeric index indicates the order in which points are arranged in the shape.
ControlX and ControlY coordinates control the positioning of curve control points.
Width controls the width of the shape outline.
Accuracy defines the number of segments used to construct arcs, circles, or curves.
Radius controls the radius of polygons, arcs, and circles.
Angle controls the from and to angles of arcs (Angle1 and Angle2 respectively).
R, G, B, and A control the red, green, blue, and alpha channel (transparency) settings for the shape color. The value of A is considered only when AlphaFlag is set to true.
Segments defines the number of segments used to construct polygons.
Careful readers will notice that there are two functions for drawing second-degree Bezier curves: DefineBezierQuad() and DefineCurvedLine(). DefineCurvedLine() creates curves which are always smooth, while DefineBezierQuad() creates curves with varying degrees of smoothness. Also, the third-degree Bezier curves can be drawn with a varying degree of accuracy.
To see a full set of basic non-filled shapes and learn how they are defined in FreeMovie fashion, the readers are encouraged to study the following example. The results should be similar to the drawing shown in the figure below, after the code listing.
//-----------------------------------------------------//
// the header() function must _always_ be called first //
//-----------------------------------------------------//
//-------------------------------------------------------
// import the FreeMovieCompilerTollbox
require_once("freemoviecompilertoolbox.php");
//-------------------------------------------------------
// initialize new SWF object.
$swf = new FreeMovieCompilerToolbox;
//-------------------------------------------------------
// set the global parameters of your movie
// frame size is in twips (1 twip = 20 pixels)
$swf->SetSWFVersion(5);
$swf->SetFrameSize(16000, 12000); // = 800 x 20, 600 x 20
$swf->SetFrameRate(24.0);
$swf->SetBackgroundColor(255, 255, 255);
//-------------------------------------------------------
// send movie to the browser
print $swf->GetMovie();
exit;
?>
Final Thoughts
As you can see, even though FreeMovie is a new kid on the block, it has some powerful abilities. I hope to show you other functions such as solid and gradient fills in a future article.
Jacek Artymiak
started his adventure with computers in 1986 with Sinclair ZX Spectrum. He's been using various commercial and Open Source Unix systems since 1991. Today, Jacek runs devGuide.net, writes and teaches about Open Source software and security, and tries to make things happen.