Skip to content

Commit b617d20

Browse files
committed
[crop] Add light curtain to make out selection in dark areas
po5@1ec3219 + Fixed the `opts.shade_opacity` condition
1 parent d586dc8 commit b617d20

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

script-opts/crop.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ draw_frame=yes
1313
frame_border_width=2
1414
frame_border_color=EEEEEE
1515
# hexadecimal: 00 is opaque, FF is transparent
16-
shade_opacity=77
16+
shade_opacity=44
17+
light_opacity=CC
1718
mouse_support=yes
1819

1920
# movement is defined in pixels in the window

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, use video-crop, if soft use 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",
@@ -118,14 +119,14 @@ function video_norm_to_screen(point, dim)
118119
}
119120
end
120121

121-
function draw_shade(ass, unshaded, window)
122+
function draw_shade(ass, unshaded, window, color, opacity)
122123
ass:new_event()
123124
ass:pos(0, 0)
124125
ass:append("{\\an7}")
125126
ass:append("{\\bord0}")
126127
ass:append("{\\shad0}")
127-
ass:append("{\\c&H000000&}")
128-
ass:append("{\\1a&H" .. opts.shade_opacity .. "}")
128+
ass:append("{\\c&H" .. color .. "&}")
129+
ass:append("{\\1a&H" .. opacity .. "}")
129130
ass:append("{\\2a&HFF}")
130131
ass:append("{\\3a&HFF}")
131132
ass:append("{\\4a&HFF}")
@@ -236,7 +237,8 @@ function draw_crop_zone()
236237
top_left = { x = 0, y = 0 },
237238
bottom_right = { x = dim.w, y = dim.h },
238239
}
239-
draw_shade(ass, frame, window)
240+
if opts.light_opacity:lower() ~= "ff" then draw_shade(ass, frame, window, "FFFFFF", opts.light_opacity) end
241+
if opts.shade_opacity:lower() ~= "ff" then draw_shade(ass, frame, window, "000000", opts.shade_opacity) end
240242
end
241243
if opts.draw_frame then
242244
draw_frame(ass, frame)

0 commit comments

Comments
 (0)