blend_image(3)
π blend_image(3) β the Arcan Lua API one, bestie
Okay so this is blend_image, straight out of the Arcan Lua API, and it's literally the glow-up button for your images β¨
πΈ NAME πΈ
blend_image β change image opacity, periodt. That's the whole job. π«Ά
π SYNOPSIS π
nil
blend_image( VID or VIDtbl, opacity, time, interp )
π¦ DESCRIPTION π¦
So here's the tea: blend_image changes the opacity of the VID(s) you picked β either instantly (that's the default, no waiting around π
) or, if you pass the optional time argument, as a lil' animation. And heads up: time has to be a non-negative integer, no cap.
It's flexible too, which is the way I like it: it takes either a single VID or a whole group of VIDs bundled up in a table. And when it's a table, the iteration follows the behavior of pairs() β iykyk. π₯
And interp? That's your easing vibe check. Set it to one of these constants:
INTERP_LINEARINTERP_SINEINTERP_EXPININTERP_EXPOUTINTERP_EXPINOUTINTERP_SMOOTHSTEP
Pick your fighter, bestie π
β NOTES β
- VIDs with an opacity other than
0.0(hidden) and1.0(opaque, visible) will be blended. Like, that's the whole point, bestie π - Values outside the allowed range will be clamped. The function said "not today" to your nonsense π
- The blend behavior is dictated by the default global
blendfuncvalue (src_alpha, 1-src_alpha) and can be overridden withforce_image_blend(mode). Iconic override behavior π
β¨ EXAMPLE β¨
The good path, the slay path π
function blend_image0()
a = fill_surface(128, 128, 255, 0, 0);
b = fill_surface(128, 128, 0, 255, 0);
move_image(b, 64, 64);
show_image({a,b});
blend_image(b, 0.5, 100);
end
π MISUSE π
Not me showing you exactly how to break it π Here's the first cursed one β negative opacity and negative time, absolutely unhinged behavior:
function blend_image0()
a = fill_surface(128, 128, 255, 0, 0);
b = fill_surface(128, 128, 0, 255, 0);
move_image(b, 64, 64);
show_image({a,b});
blend_image(b, -0.5, -100);
end
Second one: passing "a" as the VID. A string. Bestie. That's not a VID. That's a string. π«
function blend_image1()
a = fill_surface(128, 128, 255, 0, 0);
b = fill_surface(128, 128, 0, 255, 0);
move_image(b, 64, 64);
show_image({a,b});
blend_image("a", 0.5, 100);
end
Third one is a full-on chaos salad β a table of {-1, "a", true, 5.0} as the VIDs, true as the opacity, "error" as the time. It's giving "I woke up and chose violence" πππ
function blend_image2()
a = fill_surface(128, 128, 255, 0, 0);
b = fill_surface(128, 128, 0, 255, 0);
move_image(b, 64, 64);
show_image({a,b});
blend_image({-1, "a", true, 5.0}, true, "error");
end
Do NOT do these. They're here so you can recognize the red flags, not so you can copy them. π©
π SEE ALSO π
image_force_blend(3)β the override bestie you met in note 3 π«Ά
Okay that's the whole page, mwah π This gem comes from the image manual, dated October 2026 β go forth and blend responsibly, my love πΈπ¦π
π¦ 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