center_image(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸŽ€ NAME πŸŽ€

hey bestie, welcome to center_image(3) from the Arcan Lua API β€” it moves a video object relative to an external reference object. It’s giving β€œalign my video bestie against an outside anchor” energy, and honestly? iconic. πŸ’–

✨ SYNOPSIS ✨

okay so the call shapes are exactly these, and yes the first line is literally nil:

nil
center_image( vid:src, vid:ref )
center_image( vid:src, vid:ref, int:anchor )
center_image( vid:src, vid:ref, int:anchor, int x_ofs )
center_image( vid:src, vid:ref, int:anchor, int x_ofs, y_ofs )

πŸ’… DESCRIPTION πŸ’…

This positions the center of src relative to the center anchor point on ref. 🫢

The anchor point can be changed by specifying the anchor object to one of these, bestie:

  • ANCHOR_UL β€” upper-left
  • ANCHOR_CR β€” upper-center
  • ANCHOR_UR β€” upper-right
  • ANCHOR_CL β€” center-left
  • ANCHOR_C β€” center
  • ANCHOR_CR β€” center-right
  • ANCHOR_LL β€” lower-left
  • ANCHOR - LC β€” lower-center
  • ANCHOR_LR β€” lower-right

yep, ANCHOR_CR really shows up twice in the source list with two different labels β€” keeping it exactly as-is, no cap πŸ’…

The final position can also be shifted by specifying x_ofs (px) and y_ofs. ✨

This is a one-time alignment and resolves src and ref into world-space when calculating the final coordinates. For automatic response to changes in ref, use the link_image function. πŸ¦‹

🌸 EXAMPLE 🌸

here’s the example, verbatim, because I would never mess with code:

function center_image0()
      local a = fill_surface(64, 32, 255, 0, 0);
      local b = fill_surface(127, 127, 0, 255, 0);
      show_image({a, b});
      center_image(a, b);
end

πŸ¦‹ SEE ALSO πŸ¦‹

mwah πŸ’‹ β€” this page’s source/version is image, and it’s dated October 2026; catch you in the next manpage, bestie 🫢

πŸ“¦ where this page comes from