Plug-in API
This page describes the FrameAway plugin api, i.e. the variables and functions you can set or call from the Lua plugin to instruct FrameAway on how to draw certain frame types
The frameaway plugin can contain two blocks of code: one block that is executed once, when FrameAway starts and reads its plugin list, and another block that is executed each time FrameAway needs to draw a shape
Plugin structure
-- FrameAway plugin -- http://frameaway.dv8.ro -- (c) Modulo Consulting 2007 -- This plugin draws a frame called "Kiva", -- a play on circles and squares. |
Comments about the plugin |
-- the register function is called once
-- per each plugin, at startup time
function register()
constrainedAspectRatio = "1:1";
end
|
The function register() is called by FrameAway at startup time. You use the function only if you need to set some register-time variables (such as constraining aspect ratio). |
-- first the rectangle that makes the frame fp:moveTo__(originX, originY); fp:lineTo__(originX + width, originY); fp:lineTo__(originX + width, originY-height); fp:lineTo__(originX, originY-height); fp:lineTo__(originX, originY); |
And finally the drawing code. This gets called each time FrameAway needs to redraw the frame. |
FrameAway Proxy Methods
| Method Name | Description |
|---|---|
| moveTo__(x, y) | More cursor to point X, Y |
| lineTo__(x, y) | Draw a line from current point to point(X, Y) |
| curveTo______(p1x, p1y, p2x, p2y, p3x, p3y) | Draw cubic bezier curve to point (p1x, p1y) with control points (p2x, p2y), (p3x, p3y) |
| appendBezierPathWithArcWithCenter______(c1x, c2x, radius, startAngle, endAngle, clockwise) | Append an arc to FP's bezier path. The new arc is centered in (c1x, c2x), with radius, startAngle and endAngle. For clockwise arcs clockwise needs to be 1; counter-clockwise arcs are obtained with clockwise set to 0 |
Global variables
| Variable Name | Type | Read/Write | Evaluated | Description |
|---|---|---|---|---|
| constrainedAspectRatio | String | YES | At startup | When the user selects the plugin frame type, FrameAway will set the aspect ration to the value specified by this variable |
| width | Float | NO | When frame shape changes | The width of the frame |
| height | Float | NO | When frame shape changes | The height of the frame |
| originX | Float | NO | When frame shape changes | X coordinate of top left corner |
| originY | Float | NO | When frame shape changes | Y coordinate of top left corner |
| fp | Object | NO | Not applicable | Drawing object proxy, allows you to call its methods for draw operations |
Functions
| Function Name | Type | Called | Description |
|---|---|---|---|
| register() | Global | At startup | Plugin initialization function, allows you to initialize variables such as constrainedAspectRatio |