Belated thanks - I suddenly found it very useful! Perfect for garbage mattes.
To make coordinate generation quick & easy, here's an
AutoHotkey script to generate a
list of alt+left mouse click coordinates, ready to paste into pg_define():
Code:
/*
*************************************************
** MouseClickLogger: mouse click coordinates **
** for use with 'Polygon' filter for AviSynth **
*************************************************
NOTE:
alt-left clicks only
x,y origin at bottom-left
Polygon filter: https://forum.doom9.org/showthread.php?t=172388
USAGE:
- install AutoHotkey
- save this script anywhere as "MouseClickLogger.ahk"
- Run this script (double-click it)
- You will see a system tray tooltip showing it is alive
- Alt+left-click the mouse around the target window;
you will see a tooltip each time;
coordinates are appended to the Clipboard
- Right-click the tray icon to quit
- Paste coords into Polygon::pg_define
(don't include the trailing comma)
*/
#SingleInstance on
#Persistent
;;*************************************************
title:="MouseClick Logger"
about=
(
MouseClickLogger
by raffriff42, version 19-Feb-2017
)
OnExit, ExitSub ;
;;*************************************************
clipboard =
TrayTip , %title%,
(
Logging Alt+left mouse clicks to Clipboard
(right-click tray icon to quit)
)
return
;;*************************************************
ExitSub:
{
ExitApp ;
}
;;*************************************************
~!LButton::
MouseGetPos, x, y
clipboard = %clipboard% %x%`,%y%`,%a_space%
ToolTip, click_x`, y = %x%`,%y%
return
;; END ;;
And here's a minimal test script:
Code:
LoadPlugin(pathBase + "Polygon\polygon.dll")
#@ function pg_define(float [, float]*) ## list of x, y pairs
#@ function pg_draw(clip T, clip P) ## T=template, P=poly
## any old source
ColorbarsHD
ConvertToRGB32(matrix="Rec709")
KillAudio
## coords from MouseClickLogger (I traced a star shape)
m=pg_draw(pg_define(
\ 656,203, 704,335, 846,336, 733,427, 776,564,
\ 656,484, 537,563, 578,428, 467,337, 608,335
\ ))
## Windows' coords are flipped vs. AviSynth
m=m.FlipVertical
## adjust for window title & border (TODO: refine)
## and general fine-tuning
m=m.Shift(-12, 7)
## overlay on black BG
BlankClip(Last).Overlay(Last, mask=m)
return Last
## shift a clip up-down and left-right (with sub-pixel precision);
## this results in repeated edge pixels
function Shift(clip C, float offh, float offv) {
C
BilinearResize(Width, Height, -offh, -offv, Width, Height)
return Last
}