relink_image(3)

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

okay so bestie, we're talking about relink_image from the Arcan Lua API. it's the glow-up sibling of link_image, and it does exactly what it says on the tin: reassigns and translates the property-space so it's relative to another object. no cap. πŸŽ€


πŸ’« SYNOPSIS

nil
relink_image( vid:id, vid:newparent )
relink_image( vid:id, vid:newparent, int:panchor )
relink_image( vid:id, vid:newparent, int:panchor, int:anchor_opt )

four ways to call it, zero returns (it gives you nil, queen of not making a scene) 🫢


🌸 DESCRIPTION

so this one is a specialized variant of link_image β€” pls go read that function's docs first if you want the full breakdown of the arguments, because relink_image reuses them all, fr fr. πŸ“–

the ONE thing that makes it different? it preserves the relative resolved world-space position between id and newparent. literally the whole personality. πŸ’…

here's the vibe check, side by side:

  • with link_image, if id is at 100,100 and newparent is at 100,100, the post-link world coordinate of id will be 200,200. yeah. it stacked them. 😭
  • with relink_image, the post-link world coordinate will be 100,100, and its local properties will put it at 0,0. slay. ✨

so it's roughly equivalent to resolving id and newparent before linking, calculating the relative position difference, and moving the object to that new position. same energy, way less code on your end. πŸ‘‘

ngl this is the one you want when you're reparenting something and you don't want it to teleport across the screen like it got caught in a glitch. πŸ”₯

πŸ¦‹ EXAMPLE

function relink_image0()
      a = fill_surface(64, 64, 255, 0, 0);
      b = fill_surface(32, 32, 0, 255, 0);
      move_image(a, 100, 100)
      move_image(b, 110, 110)
      relink_image(b, a);
      show_image(b);
      blend_image(a, 1.0, 50);
      move_image(a, VRESW, VRESH, 100);
      rotate_image(a, 100, 100);
      expire_image(a, 100);
end

two surfaces, a 64Γ—64 red one and a 32Γ—32 green one, both moved off to their little corners, and then relink_image(b, a) snaps b under a without yeeting it. iconic behaviour. then it does the whole show: show_image(b), blend_image(a, 1.0, 50), move_image(a, VRESW, VRESH, 100), rotate_image(a, 100, 100), and finally expire_image(a, 100). main character energy from start to finish. 🌈⭐


mwah πŸ’œ this page came to you from the image section, snapped in October 2026, and it's forever filed under relink_image(3) β€” go forth and reparent responsibly, bestie πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from