From b056a0edb305459b6cc8876fa599129f40e79e89 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 22 Jul 2019 19:28:55 -0300 Subject: [PATCH] add imagemagick linking --- README.md | 4 +++- build.zig | 10 ++++++++++ src/magick.zig | 9 +++++++++ src/runner.zig | 8 ++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/magick.zig diff --git a/README.md b/README.md index 05e0763..4e3d471 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ glitch art "framework", ???????? language??? something? - zig at https://ziglang.org - libc, lilv and libsndfile - an appreciation for glitched anime girls on your hard drive - - optional: imagemagick to convert from whatever to bmp + - imagemagick for + - running the `rotate` command + - optional manual step: convert from whatever to bmp ## plugin depedencies: - lv2 default plugins (most specifically the eg-amp plugin) diff --git a/build.zig b/build.zig index 65518df..f688314 100644 --- a/build.zig +++ b/build.zig @@ -10,7 +10,17 @@ pub fn build(b: *Builder) void { exe.linkSystemLibrary("sndfile"); exe.linkSystemLibrary("c"); + // magick libraries + exe.linkSystemLibrary("MagickWand-7.Q16HDRI"); + exe.linkSystemLibrary("MagickCore-7.Q16HDRI"); + + //exe.addArgs([_]u8{ + // "-DMAGICKCORE_HDRI_ENABLE=1", + // "-DMAGICKCORE_QUANTUM_DEPTH=16", + //}); + exe.addIncludeDir("/usr/include/lilv-0"); + exe.addIncludeDir("/usr/include/ImageMagick-7"); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); diff --git a/src/magick.zig b/src/magick.zig new file mode 100644 index 0000000..a41c5e9 --- /dev/null +++ b/src/magick.zig @@ -0,0 +1,9 @@ +// imagemagick plugins +const std = @import("std"); +const images = @import("image.zig"); + +const Image = images.Image; + +pub fn runRotate(image: *Image) !void { + return error.NotImplementedYet; +} diff --git a/src/runner.zig b/src/runner.zig index 1913fa2..2eeb5f7 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -3,6 +3,7 @@ const lang = @import("lang.zig"); const images = @import("image.zig"); const plugin = @import("plugin.zig"); const custom = @import("custom.zig"); +const magick = @import("magick.zig"); const Position = plugin.Position; const ParamList = plugin.ParamList; @@ -257,6 +258,11 @@ pub const Runner = struct { try image.runCustomPlugin(custom.WildNoise, pos, map); } + fn rotateCmd(self: *Runner) !void { + var image = try self.getImage(); + try magick.runRotate(image); + } + fn runCommand(self: *Runner, cmd: *lang.Command) !void { var params = ParamList.init(self.allocator); defer params.deinit(); @@ -418,6 +424,8 @@ pub const Runner = struct { try self.wildNoiseCmd(pos, &map); }, + .Rotate => try self.rotateCmd(), + else => blk: { std.debug.warn("Unsupported command: {}\n", cmd.command); break :blk RunError.UnknownCommand;