add imagemagick linking

This commit is contained in:
Luna 2019-07-22 19:28:55 -03:00
parent 67c9f425bb
commit b056a0edb3
4 changed files with 30 additions and 1 deletions

View file

@ -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)

View file

@ -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());

9
src/magick.zig Normal file
View file

@ -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;
}

View file

@ -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;