13
0

Fix some script icons for non-square buttons

This commit is contained in:
Robin Gareus 2019-11-19 03:33:28 +01:00
parent 7aaf212a9b
commit cf8a808bd7
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 14 additions and 10 deletions

View File

@ -13,12 +13,12 @@ end end
function icon (params) return function (ctx, width, height, fg)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(math.min (width, height) * .33) .. "px")
local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(height / 3) .. "px")
txt:set_alignment (Cairo.Alignment.Center);
txt:set_width (width);
txt:set_ellipsize (Cairo.EllipsizeMode.Middle);
txt:set_text ("plot\ngraph")
txt:set_text ("plot\ngrph")
local tw, th = txt:get_pixel_size ()
ctx:move_to (.5 * (width - tw), .5 * (height - th))
ctx:move_to (0, .5 * (height - th))
txt:show_in_cairo_context (ctx)
end end

View File

@ -111,7 +111,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(math.min (width, height) * .5) .. "px")
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(math.min (width, height) * .45) .. "px")
txt:set_text ("S")
ctx:move_to (1, 1)
txt:show_in_cairo_context (ctx)

View File

@ -61,6 +61,7 @@ function icon (params) return function (ctx, width, height)
local wh = math.min (width, height) * .5
local x0 = math.ceil (wh * .4)
local x1 = math.floor (wh * 1.6)
ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh * .4, wh * .4, wh * 1.2, wh * 1.2)
ctx:set_source_rgba (.7, .7, .7, 1)
ctx:fill ()

View File

@ -75,6 +75,7 @@ function icon (params) return function (ctx, width, height, fg)
ctx:fill ()
end
ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh - wh * .6, wh - .7 * wh, wh * 1.2, .5 * wh)
stroke_outline (.7)

View File

@ -176,14 +176,14 @@ function factory (unused_params)
end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height) * .5
local x0 = math.ceil (wh * .2)
local x1 = math.floor (wh * 1.8)
local yc = height * .5
local x0 = math.ceil (width * .1)
local x1 = math.floor (width * .9)
ctx:set_line_width (1)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
ctx:move_to (x0, wh * 1.5)
ctx:move_to (x0, yc * 1.5)
for x = x0, x1 do
ctx:line_to (x, wh + math.cos (3 * math.pi * (x-x0) / (x1-x0)) * wh * .5)
ctx:line_to (x, yc + math.cos (3 * math.pi * (x-x0) / (x1-x0)) * yc * .5)
end
ctx:stroke ()
end end

View File

@ -121,7 +121,7 @@ function factory () return function ()
end end
function icon (params) return function (ctx, width, height, fg)
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (width * .45) .. "px")
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (height / 3) .. "px")
txt:set_text ("CC\nPA")
local tw, th = txt:get_pixel_size ()
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))

View File

@ -25,6 +25,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height) * .5
ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh * .6, wh * .6, wh * .8, wh * .8)
ctx:set_source_rgba (.1, .1, .1, 1)

View File

@ -43,6 +43,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height) * .5
ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:set_line_width (1)
ctx:rectangle (wh * .25, wh * .75, wh * 1.5 , .5 * wh)