add proper support on rotateCmd for lang.Command.Rotate

This commit is contained in:
Luna 2020-06-01 22:06:15 -03:00
parent 54919110a5
commit b0525f2386

View file

@ -190,16 +190,14 @@ pub const Runner = struct {
_ = try proc.spawnAndWait(); _ = try proc.spawnAndWait();
} }
fn rotateCmd( fn rotateCmd(self: *Runner, cmd: lang.Command) !void {
self: *Runner, const rotate_cmd = cmd.cast(lang.Command.Rotate).?;
deg: f32,
bgfill: []const u8,
) !void {
var image = try self.getImage(); var image = try self.getImage();
var c_bgfill = try std.cstr.addNullByte(self.allocator, bgfill); var c_bgfill = try std.cstr.addNullByte(self.allocator, rotate_cmd.bgfill);
defer self.allocator.free(c_bgfill); defer self.allocator.free(c_bgfill);
try magick.runRotate(image, deg, c_bgfill); try magick.runRotate(image, rotate_cmd.deg, c_bgfill);
} }
fn executeLV2Command(self: *@This(), command: var) !void { fn executeLV2Command(self: *@This(), command: var) !void {
@ -263,11 +261,10 @@ pub const Runner = struct {
const command = cmd.cast(lang.Command.Load).?; const command = cmd.cast(lang.Command.Load).?;
try self.loadCmd(command.path); try self.loadCmd(command.path);
}, },
.quicksave => { .quicksave => try self.quicksaveCmd(),
try self.quicksaveCmd(); .rotate => try self.rotateCmd(cmd),
},
.amp => try self.runSingleCommand(cmd, .amp),
.amp => try self.runSingleCommand(cmd, .amp),
.rflanger => try self.runSingleCommand(cmd, .rflanger), .rflanger => try self.runSingleCommand(cmd, .rflanger),
.eq => try self.runSingleCommand(cmd, .eq), .eq => try self.runSingleCommand(cmd, .eq),
.phaser => try self.runSingleCommand(cmd, .phaser), .phaser => try self.runSingleCommand(cmd, .phaser),