View Single Post
Old 27th December 2019, 11:16   #64  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
@ TcMullet,

I'm off to bed in a minute, but will come back later.

@ VoodooFX,
I've removed the InPaintDelogo v1.13 pretender script from SendSpace, its gone 4E4. [forever]

Have done a stub function just to manufacture InPaintDelogo style Loc string, add it to your script if your like it, if not then no sweat.

Code:
Function MakeLoc(clip c,Int x, Int y, Int w, Int h) { # https://forum.doom9.org/showthread.php?p=1893966#post1893966
/*
    Make Loc string for VoodooFX InPaintDelogo.
    Input X and Y, where -ve, is relative to c.Width or c.Height, and are converted to +ve X and Y in result string.
    Input W and H, where 0 or -ve, is relative c.Width or c.Height [as in Crop()],
        Where +ve, are converted to -ve W and H in result string [as required by InPaintDelogo].
    Allows to make Loc string programmatically using flexible coord system and not locked into hand editing Loc string.

       ColorBars                      # 640,480
       S=MakeLoc(   0,   0,  0,  0)   # "0,0,-0,-0"
       S=MakeLoc( 540, 380,-40,-40)   # "540,380,-40,-40"
       S=MakeLoc(-100,-100, 60, 60)   # "540,380,-40,-40"
       S=MakeLoc( 540, 380, 60, 60)   # "540,380,-40,-40"
       S=MakeLoc(-100,-100,-40,-40)   # "540,380,-40,-40"
*/
    c
    # First, Ensure/Convert X,Y,W,H ALL +ve
    x = (x >= 0) ? x : Width  + x
    y = (y >= 0) ? y : Height + y
    w = (w >  0) ? w : Width  - x + w
    h = (h >  0) ? h : Height - y + h
    # Check validity
    Assert(0 <= x <  Width    ,String(x,"MakeLoc: 0 <= X(%.0f)") + String(Width  ," < Width(%.0f)" ))
    Assert(0 <= y <  Height   ,String(y,"MakeLoc: 0 <= Y(%.0f)") + String(Height ," < Height(%.0f)"))
    Assert(1 <= w <= Width -x ,String(w,"MakeLoc: 1 <= W(%.0f)") + String(Width  ," <= Width-X(%.0f")  + String(x ," - %.0f)"))
    Assert(1 <= h <= Height-y ,String(h,"MakeLoc: 1 <= H(%.0f)") + String(Height ," <= Height-Y(%.0f") + String(y ," - %.0f)"))
    # Output string:  +ve X,Y :: -ve W,H, Ensure all (even W=0 and H=0) flagged as -ve eg -0
    return String(x,"%.0f") + String(y,",%.0f") + String(Abs(x+w-Width),",-%.0f") +String(Abs(y+h-Height),",-%.0f")
}
EDIT: If you DONT like the -ve x,y options, then can just delete the above lines in RED, and if you do include above without -ve x,y,
then please rename function to some other name, I dont want it to conflict with my stub. [you would likely want to edit the description too of course].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th December 2019 at 11:48.
StainlessS is offline   Reply With Quote