link_image(3)
π link_image β bestie, let's re-parent some objects π
okay so real talk, this is link_image(3) from the Arcan Lua API and it's literally the glow-up your object hierarchy has been waiting for. it's giving "found family" but for property spaces π«Ά
β¨ NAME β¨
link_image β reassign the property-space so it's relative to another object. yes, that means your baby object gets a new parent and everything. slay.
πΈ SYNOPSIS πΈ
nil
link_image( vid:id, vid:newparent )
link_image( vid:id, vid:newparent, int:panchor )
link_image( vid:id, vid:newparent, int:panchor, int:anchor_opt )
four whole flavors, pick your fighter β¨
π¦ DESCRIPTION π¦
so by default, every single object out here defines its properties relative to an invisible WORLDID object β that's the default parent, the main character of the universe, whatever. but with this function you can swap that parent out dynamically and build the most complex hierarchies your heart desires. no cap, hierarchies are the vibe.
the default properties that get to be relative to another object in this way are opacity, position, orientation and lifetime β iconic set honestly. BUT π
that set can be changed with image_mask_set, image_mask_clear, image_mask_clearall, and image_mask_toggle. so you have range.
the vid argument refers to the object that shall be reassigned (the one getting adopted, basically π₯Ί) and the newparent argument specifies the object that it should be made relative to. found family, periodt.
π the panchor era π
if the panchor argument is specified, it defines the positional anchoring space in the parent, based on one of these values:
ANCHOR_UL: upper-leftANCHOR_CR: upper-centerANCHOR_UR: upper-rightANCHOR_CL: center-leftANCHOR_C: centerANCHOR_CR: center-rightANCHOR_LL: lower-leftANCHOR_LC: lower-centerANCHOR_LR: lower-right
(and yep, ANCHOR_CR really does show up twice in the manual β we report, we don't editorialize π copy it exactly as the manpage says, bestie.)
this is relative to the anchor origo of id β which defaults to ANCHOR_UL β and that origo can be changed with image_origo_offset. adorable.
π the anchor_opt era π
if the anchor_opt argument is specified, further anchor behavior can be controlled π. the valid values for anchor_opt right now are:
ANCHOR_SCALE_NONEβ the default, lowkey the chill optionANCHOR_SCALE_WANCHOR_SCALE_HANCHOR_SCALE_WH
with these, the object size is now defined relative to that of the width and/or height of the parent. the relative delta is calculated based on the current scale versus the initial (surface without a texture backing) or the current storage size. math but make it fashion β
β οΈ NOTES β οΈ (read these, i'm serious) β οΈ
- changing link ownership resets all scheduled transformations except for blending. all of them. gone. blending gets to stay, because blending is the favorite child apparently π
- rotation transforms do not take the positional anchor point into account β only its mask and origo offset. so don't come for rotation expecting anchor behavior, it simply will not do that π
- link to self is equivalent to linking back to
WORLDID. so linking to yourself is just... going home. mood. - linked scale means
1pxwill be subtracted fromidin each desired dimension when calculating final size, since no object can go below1x1 pxsize β which would otherwise make it impossible to describe the case where parent and child should have identical size for the shared dimension. hare dimensions π (the manpage says this, we're just the messenger)
ok but seriously note 1 is the one that bites people. transformations get yeeted on re-link. you've been warned, bestie.
π₯ EXAMPLE π₯
function link_image0()
a = fill_surface(64, 64, 255, 0, 0);
b = fill_surface(32, 32, 0, 255, 0);
link_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
look at b getting adopted by a and then a goes off and does a whole move/rotate/expire arc β main character energy fr fr π
and that's the whole page, bestie, you ate that π
cute lil sign-off: this came from the image manual, dated October 2026, and it's link_image(3) β go forth and re-parent responsibly πβ¨
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms