1-- center_image 2-- @short: move a video object relative to an external reference object 3-- @inargs: vid:src, vid:ref 4-- @inargs: vid:src, vid:ref, int:anchor 5-- @inargs: vid:src, vid:ref, int:anchor, int x_ofs 6-- @inargs: vid:src, vid:ref, int:anchor, int x_ofs, y_ofs 7-- @longdescr: This positions the center of *src* relative to the 8-- center anchor point on *ref*. The anchor point can be changed by 9-- specifying the *anchor* object to one of: 10-- ANCHOR_UL : upper-left, ANCHOR_CR : upper-center, ANCHOR_UR : upper-right, 11-- ANCHOR_CL : center-left, ANCHOR_C : center, ANCHOR_CR : center-right, 12-- ANCHOR_LL : lower-left, ANCHOR-LC : lower-center, ANCHOR_LR : lower-right. 13-- The final position can also be shifted by specifying *x_ofs* (px) and 14-- *y_ofs*. This is a one-time alignment and resolves *src* and *ref* into 15-- world-space when calculating the final coordinates. For automatic response 16-- to changes in *ref*, use the ref:link_image function. 17-- @group: image 18-- @cfunction: centerimage 19-- @related: link_image 20function main() 21 local a = fill_surface(64, 32, 255, 0, 0); 22 local b = fill_surface(127, 127, 0, 255, 0); 23 show_image({a, b}); 24#ifdef MAIN 25 center_image(a, b); 26#endif 27 28#ifdef ERROR1 29 center_image(a, b, 919191); 30#endif 31end 32