Skip to content

Commit 1ec3219

Browse files
committed
[crop] Add light curtain to make out selection in dark areas
1 parent f0c326c commit 1ec3219

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

scripts/crop.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
local opts = {
22
mode = "hard", -- can be "hard" or "soft". If hard, apply a crop filter, if soft zoom + pan. Or a bonus "delogo" mode
33
draw_shade = true,
4-
shade_opacity = "77",
4+
shade_opacity = "44",
5+
light_opacity = "CC",
56
draw_frame = false,
67
frame_border_width = 2,
78
frame_border_color = "EEEEEE",
@@ -111,14 +112,14 @@ function position_to_ensure_ratio(moving, fixed, ratio)
111112
}
112113
end
113114

114-
function draw_shade(ass, unshaded, window)
115+
function draw_shade(ass, unshaded, window, color, opacity)
115116
ass:new_event()
116117
ass:pos(0, 0)
117118
ass:append("{\\an7}")
118119
ass:append("{\\bord0}")
119120
ass:append("{\\shad0}")
120-
ass:append("{\\c&H000000&}")
121-
ass:append("{\\1a&H" .. opts.shade_opacity .. "}")
121+
ass:append("{\\c&H" .. color .. "&}")
122+
ass:append("{\\1a&H" .. opacity .. "}")
122123
ass:append("{\\2a&HFF}")
123124
ass:append("{\\3a&HFF}")
124125
ass:append("{\\4a&HFF}")
@@ -231,7 +232,8 @@ function draw_crop_zone()
231232
top_left = { x = 0, y = 0 },
232233
bottom_right = { x = dim.w, y = dim.h },
233234
}
234-
draw_shade(ass, frame, window)
235+
if opts.light_opacity:lower() ~= "ff" then draw_shade(ass, frame, window, "FFFFFF", opts.light_opacity) end
236+
if opts.light_opacity:lower() ~= "ff" then draw_shade(ass, frame, window, "000000", opts.shade_opacity) end
235237
end
236238
if opts.draw_frame then
237239
draw_frame(ass, frame)

0 commit comments

Comments
 (0)