PDA 个人数字助理

查看完全版本 : 我看到有PHP的SWF文件支持库!!


小东瓜
2000-07-22, 12:35 AM
A C Library for Writing Flash Movies
Paul Haeberli
Silicon Graphics
paulhaeberli@yahoo.com
Version 0.99
10 Feb 1999

This document describes the C interface to libswf.a, and gives some clues on how to use the library. To use this library, you must include the file swf.h. In addition you should be aware of this additional information. If you have comments or questions, please send 'em my way.

This work is based on the documents that Macromedia made available in April of 1998.

File Management
void swf_openfile(char *name, float xsize, float ysize , float framerate, float r, float g, float b)


This is the first function you should call to open a .swf file. If you want to write the output to a file, the filename should end in ".swf". If you want to write to stdout, give the special file name of "STDOUT". The xsize and ysize are the dimensions of the Flash movie in pixels. framerate specifies the frame rate in frames per second. The last three arguments r, g, and b select a color to be used for the backgound of the Flash movie.
void swf_closefile(void)


Closes the .swf file.
Managing the Contents of the Current Frame
void swf_labelframe(char *name)


This adds a string label to the current frame. This is only needed if you want to use swf_actionGoToLabel to get to this frame in future. If you want to put a secret message into your flash files, this is where to do it!
void swf_showframe(void)


Finish the current frame and start adding commands to the next frame.
void swf_setframe(int fromeno)


Selects the specified frame number for adding commands to.
int swf_getframe(void)


Returns the frame number of the current frame. The first frame is frame 0.
Setting the Current Color
void swf_mulcolor(float r, float g, float b, float a)


Sets the global multiply color to the rgba value specified. This color is used implicitly by swf_placeobject, swf_modifyobject and swf_addbuttonrecord. The color of the object will be multiplied by the values given when it is drawn. These values can be positive or negative.
void swf_addcolor(float r, float g, float b, float a)


Sets the global add color to the rgba value specified. This color is used implicitly by swf_placeobject, swf_modifyobject and swf_addbuttonrecord. This color is added to the original color of the object when it is drawn. These values can be positive or negative.
Placing and Removing Objects
void swf_placeobject(int objid, int depth)


Places the object identified by objid in the current frame at the given depth. objids must be between in the range [1..65535], while depths must be between in the range [1..65535]. This uses the current mulcolor and addcolor and matrix to position and color the object. Full RGBA colors are supported.
void swf_modifyobject(int depth, int how)


Updates the position and or color of the object at the specified depth. how determines what things are modified using the values MOD_MATRIX, MOD_COLOR or MOD_COLOR|MOD_MATRIX. This uses the current mulcolor and addcolor and matrix to position and color the object. Full RGBA colors are supported.
void swf_removeobject(int depth)


Removes the object at the specified depth.
int swf_nextid(void)


Returns a free objid. this makes it easier to manage the object ids used.
Defining an Action List for the Current Frame
An action list is described by a sequence of calls as shown here:

swf_startdoaction();
swf_actionGotoFrame(143);
swf_actionPlay();
swf_enddoaction();


You can put lots and lots of actions between swf_startdoaction and swf_enddoaction to create an actionlist. All the actions are performed in sequence after the current frame is drawn.

void swf_startdoaction(void)


This starts the description of an action list for the current frame. There should be only one action list associated with a single frame in the Flash movie.
void swf_enddoaction(void)


Ends the list of actions to perform for the current frame.
The Action Elements
void swf_actionGotoFrame(int frameno)


Causes the Flash movie to display the specified frame and stop.
void swf_actionGetURL(char *url, char *target)


Gets the specified URL. target indicates what to do with the content from the URL. If target is "_level0", data from the URL will replace the current Flash movie. If target is "_level1", The new URL will displayed on top of the current Flash movie.
void swf_actionNextFrame(void)


Goes forward one frame.
void swf_actionPrevFrame(void)


Goes backward one frame.
void swf_actionPlay(void)


Starts playing the Flash movie from the current frame.
void swf_actionStop(void)


Stops playing the Flash movie at the current frame.
void swf_actionToggleQuality(void)


Toggles between high and low quality.
void swf_actionStopSounds(void)


Stops playing sound.
void swf_actionWaitForFrame(int frame, int skipcount)


If the specified frame has not been loaded, skip the specified number of actions in the action list. This can be used to show an animation while frames are being loaded.
void swf_actionSetTarget(char *target)


Set the context for actions. This can be used to control other Flash movies that are playing.
void swf_actionGoToLabel(char *label)


Causes the Flash movie to display the frame with the given label, and stop.
Defining Shapes
Defining Simple Shapes
void swf_defineline(int objid, float x1, float y1, float x2, float y2, float width)


Defines a line segment from x1,y1 to x2,y2 with the given line width.
void swf_definerect(int objid, float x1, float y1, float x2, float y2, float width)


Defines an outlined rectangle from x1,y1 to x2,y2 with the given line width. If width is 0.0, the rectangle is filled instead of stroked.
void swf_definepoly(int objid, float coords[][2], int npoints, float width)


Defines a polygon with npoints with the specified line width. If width is 0.0, the polygonal shape is filled instead of stroked.
Defining Complex Shapes
void swf_startshape(int objid)


Starts the definition of a complex shape. An object with the specified objid will be created.
void swf_shapelinesolid(float r, float g, float b, float a, float width);


Sets the current line style. The color is given by r, g, b, and a. width specifies the thickness of the line. If a width of 0.0 is given, no lines are drawn.
void swf_shapefilloff(void)


Turns off filling.
void swf_shapefillsolid(float r, float g, float b, float a)


Sets the current fill style to a solid fill with the the specified color.
void swf_shapefillbitmapclip(int bitmapid)


Sets the current fill mode clipped bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas.
void swf_shapefillbitmaptile(int bitmapid)


Sets the current fill mode tiled bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas. The image will repeat across the area.
void swf_shapemoveto(float x, float y)


This moves the current position to the given x,y.
void swf_shapelineto(float x, float y)


Draws a line from the current position to x,y. Then the current position is set to x,y.
void swf_shapecurveto(float x1, float y1, float x2, float y2)


Draws a quadradic bezier curve starting at the current position using x1,y1 as an off curve control point and using x2,y2 as the end point. Then the current position is set to x2,y2.
void swf_shapecurveto3(float x1, float y1, float x2, float y2, float x3, float y3)


Draws a cubic bezier curve starting at the current position using x1,y1 and x2,y2 as off curve control points and using x3,y3 as the end point. Then the current position is set to x3,y3. The cubic bezier curve is converted to the quadradic beziers used internally by Flash.
void swf_shapearc(float x, float y, float r, float ang1, float ang2)


Draws a circular arc from ang1 to

reg
2000-07-22, 12:35 AM

2000-07-22, 12:35 AM

jackeycheung
2000-07-22, 01:43 PM
我看你不像是冬瓜耶?怎么这么多好东西?你太厉害了耶!像条超级蠕虫耶!!!!!!!!!

------------------
十倍龟波气功