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();
}
fn rotateCmd(
self: *Runner,
deg: f32,
bgfill: []const u8,
) !void {
fn rotateCmd(self: *Runner, cmd: lang.Command) !void {
const rotate_cmd = cmd.cast(lang.Command.Rotate).?;
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);
try magick.runRotate(image, deg, c_bgfill);
try magick.runRotate(image, rotate_cmd.deg, c_bgfill);
}
fn executeLV2Command(self: *@This(), command: var) !void {
@ -263,11 +261,10 @@ pub const Runner = struct {
const command = cmd.cast(lang.Command.Load).?;
try self.loadCmd(command.path);
},
.quicksave => {
try self.quicksaveCmd();
},
.amp => try self.runSingleCommand(cmd, .amp),
.quicksave => try self.quicksaveCmd(),
.rotate => try self.rotateCmd(cmd),
.amp => try self.runSingleCommand(cmd, .amp),
.rflanger => try self.runSingleCommand(cmd, .rflanger),
.eq => try self.runSingleCommand(cmd, .eq),
.phaser => try self.runSingleCommand(cmd, .phaser),