From 83aac1ce881caa789231cec4a06f63f1a6bcc89b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 20 Feb 2017 00:53:09 +0100 Subject: [PATCH] Add 2 more action-script icons --- scripts/bounce_replace.lua | 36 ++++++++++++++++++++++++++++++++++++ scripts/export_mp4chaps.lua | 23 +++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/scripts/bounce_replace.lua b/scripts/bounce_replace.lua index 8e6ddd6211..838fd8da64 100644 --- a/scripts/bounce_replace.lua +++ b/scripts/bounce_replace.lua @@ -62,3 +62,39 @@ function factory (params) return function () end end end + +function icon (params) return function (ctx, width, height, fg) + local wh = math.min (width, height) * .5 + local ar = wh * .2 + + ctx:set_line_width (1) + function stroke_outline (c) + ctx:set_source_rgba (0, 0, 0, 1) + ctx:stroke_preserve () + ctx:set_source_rgba (c, c, c, 1) + ctx:fill () + end + + ctx:rectangle (wh - wh * .6, wh - .7 * wh, wh * 1.2, .5 * wh) + stroke_outline (.7) + + ctx:rectangle (wh - wh * .6, wh + .1 * wh, wh * 1.2, .5 * wh) + stroke_outline (.9) + + -- arrow + ctx:set_source_rgba (0, 1, 0, 1) + ctx:set_line_width (ar * .7) + + ctx:move_to (wh, wh - .5 * wh) + ctx:rel_line_to (0, wh) + ctx:stroke () + + ctx:move_to (wh, wh + .5 * wh) + ctx:rel_line_to (-ar, -ar) + ctx:rel_line_to (2 * ar, 0) + ctx:close_path () + ctx:stroke () + + + +end end diff --git a/scripts/export_mp4chaps.lua b/scripts/export_mp4chaps.lua index d5e7a5708e..a58e678874 100644 --- a/scripts/export_mp4chaps.lua +++ b/scripts/export_mp4chaps.lua @@ -53,3 +53,26 @@ function factory (unused_params) return function () ::out:: end end + +function icon (params) return function (ctx, width, height, fg) + local mh = height - 3.5; + local m3 = width / 3; + local m6 = width / 6; + + ctx:set_line_width (.5) + ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg)) + + ctx:move_to (width / 2 - m6, 2) + ctx:rel_line_to (m3, 0) + ctx:rel_line_to (0, mh * 0.4) + ctx:rel_line_to (-m6, mh * 0.6) + ctx:rel_line_to (-m6, -mh * 0.6) + ctx:close_path () + ctx:stroke () + + local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(math.min (width, height) * .5) .. "px") + txt:set_text ("MP4") + local tw, th = txt:get_pixel_size () + ctx:move_to (.5 * (width - tw), .5 * (height - th)) + txt:show_in_cairo_context (ctx) +end end -- 2.30.2