add canvas_image builtin for PNG rendering with alpha blending

Registers canvas_image(path, x, y, w, h) in the type system and
implements it in the interpreter using the image crate — scales to
exact dimensions via Lanczos3 and alpha-composites onto the pixmap.
This commit is contained in:
Will Anderson
2026-04-28 14:51:24 -05:00
parent 18b60e3bf1
commit d86bbc3740
5 changed files with 106 additions and 1 deletions
+1
View File
@@ -278,6 +278,7 @@ impl TypeEnv {
env.functions.insert("canvas_events".into(), str_fn(vec![], s.clone()));
env.functions.insert("canvas_swap".into(), str_fn(vec![], Type::Void));
env.functions.insert("canvas_run_loop".into(), str_fn(vec![s.clone()], Type::Void));
env.functions.insert("canvas_image".into(), str_fn(vec![s.clone(), i.clone(), i.clone(), i.clone(), i.clone()], Type::Void));
env.functions.insert("state_set".into(), str_fn(vec![s.clone(), s.clone()], Type::Void));
env.functions.insert("state_get".into(), str_fn(vec![s.clone()], s.clone()));