From 926b31d76930f1bf591421967c7ba90b2609c793 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A0=20Arrufat?=
Date: Fri, 6 Dec 2024 09:45:49 +0900
Subject: [PATCH] examples: add seam carving
---
examples/build.zig | 1 +
examples/lib/index.html | 1 +
examples/lib/perlin-noise.html | 2 +-
examples/lib/perlin-noise.js | 2 +-
examples/lib/seam-carving.html | 23 ++++++
examples/lib/seam-carving.js | 128 +++++++++++++++++++++++++++++++++
examples/lib/styles.css | 8 ++-
7 files changed, 161 insertions(+), 4 deletions(-)
create mode 100644 examples/lib/seam-carving.html
create mode 100644 examples/lib/seam-carving.js
diff --git a/examples/build.zig b/examples/build.zig
index a82d68f..99b8391 100644
--- a/examples/build.zig
+++ b/examples/build.zig
@@ -6,6 +6,7 @@ pub fn build(b: *std.Build) void {
_ = buildModule(b, "colorspace", target, optimize);
_ = buildModule(b, "face_alignment", target, optimize);
_ = buildModule(b, "perlin_noise", target, optimize);
+ _ = buildModule(b, "seam_carving", target, optimize);
const fmt_step = b.step("fmt", "Run zig fmt");
const fmt = b.addFmt(.{
diff --git a/examples/lib/index.html b/examples/lib/index.html
index 38963b4..b4e1c73 100644
--- a/examples/lib/index.html
+++ b/examples/lib/index.html
@@ -16,6 +16,7 @@ Examples
Colorspace
Face aligment
Perlin noise
+ Seam carving
diff --git a/examples/lib/perlin-noise.html b/examples/lib/perlin-noise.html
index 7987e0c..b62bd30 100644
--- a/examples/lib/perlin-noise.html
+++ b/examples/lib/perlin-noise.html
@@ -37,7 +37,7 @@ Perlin Noise
-
+
+ Seam Carving
+
+
+
+
+
+
diff --git a/examples/lib/perlin-noise.js b/examples/lib/perlin-noise.js
index 2fb2677..dc39af2 100644
--- a/examples/lib/perlin-noise.js
+++ b/examples/lib/perlin-noise.js
@@ -22,7 +22,7 @@
wasm_exports = obj.instance.exports;
window.wasm = obj;
console.log("wasm loaded");
- const canvas = document.getElementById("canvas");
+ const canvas = document.getElementById("canvas-perlin");
const ctx = canvas.getContext("2d");
const rows = 512;
const cols = 512;
diff --git a/examples/lib/seam-carving.html b/examples/lib/seam-carving.html
new file mode 100644
index 0000000..89da4b3
--- /dev/null
+++ b/examples/lib/seam-carving.html
@@ -0,0 +1,23 @@
+
+
+