Old 11-26-2020, 10:32 PM   #1
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 5,883
Default Cropped Overlay

This might already exist, but I couldn't find it. It needs to be on its own track, then you use the overlay and background parameters to find the appropriate inputs, then you can crop the overlay and move it around on top of the background. It only lets you move to the edges of the project window. If you need to go beyond, crop more. I tried to add like zoom/scaling, but that got weird, so probably just use a different preset on the individual input tracks for that.



Code:
// ashcat_lt cropped overlay
//@param 1:in1 'overlay (-1=next video track)' -1 -1 50 0 1
//@param 2:in2 'background (-1=second next)' -1 -1 50 0 1
//@param 3:source_L 'source Left edge' 0 0 1 0.5
//@param 4:source_R 'source Right edge' 1 0 1 0.5
//@param 5:source_T 'source Top edge' 0 0 1 0.5
//@param 6:source_B 'source Bottom edge' 1 0 1 0.5
//@param 7:xoffs_d 'destination X offset (right)' 0 -1 1 0
//@param 8:yoffs_d 'destination Y offset (down)' 0 -1 1 0



in1 = in1== -1? input_track(0): in1;
in2 = in2== -1 ? input_track(1): in2;


source_x1 = source_L * project_w;
source_x2 = max(source_x1, source_R * project_w);
source_w = source_x2 - source_x1;
R_pad = project_w - source_x2;
dest_x = xoffs_d <= 0 ? source_x1 * (1 + xoffs_d) : source_x1 + (R_pad * xoffs_d); 

source_y1 = source_T * project_h;
source_y2 = max(source_y1, source_B * project_h);
source_h = source_y2 - source_y1;
B_pad = project_h - source_y2;
dest_y = yoffs_d <= 0 ?  source_y1 * (1 + yoffs_d) : source_y1 + (B_pad * yoffs_d); 



oldCS=colorspace;
colorspace='YV12';
gfx_set (0,0,0,1,0,-1);
gfx_fillrect (0,0,project_w,project_h);

temp = gfx_img_resize (temp,project_w,project_h);
gfx_dest = temp;
gfx_blit (in2);

gfx_blit (in1,0,dest_x,dest_y,source_w,source_h,source_x1,source_y1,source_w,source_h);




gfx_dest = -1;

gfx_blit(temp);

colorspace=oldCS;
ashcat_lt is offline   Reply With Quote
Old 03-30-2021, 10:01 AM   #2
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 7,669
Default

Nice one! You can add it here: https://forum.cockos.com/showthread.php?t=213832
vitalker is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.