Old 12-20-2018, 03:06 PM   #1
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 5,168
Default preset share - rectangle annotation

Just an empty rectangle with position, thickness, color, opacity.

Needs some optimization to solve occasional 1px overlaps if anyone wants to.

Most of this was done by Robert Randolph / Admiral Bumblebee and I added the color and default settings.

Code:
//RR: Draw box Annotation
//@param1:tlx 'Top left X' 0.25 0 1 0.5 0.01
//@param2:tly 'Top Left Y' 0.25 0 1 0.5 0.01
//@param3:blx 'Bottom Right X' 0.5 0 1 0.5 0.01
//@param4:bly 'Bottom Right Y' 0.5 0 1 0.5 0.01
//@param5:tk  'Thickness' 10 0 50 10 2

//@param7:R 'R' 1 0 1 0.5 0.1
//@param8:G 'G' 1 0 1 0.5 0.1
//@param9:B 'B' 1 0 1 0.5 0.1
//@param10:A 'A' 1 0 1 0.5 0.01

input = 0;
!project_wh_valid && input_info(input,w,h) ? ( project_w=w; project_h=h; );

input = 0;
gfx_blit(input,1);
gfx_set(R,G,B,A);
// convert percentages to pixels
tlxp = tlx * project_w;
blxp = blx * project_w;
tlyp = tly * project_h;
blyp = bly * project_h - tk; // subtrack thickness so we don't go under the frame

// left wall
// X/Y from left
// thickness and height is our bottom left Y
gfx_fillrect(tlxp, tlyp+tk, tk, blyp-(2*tk));

// top wall
// X/Y from left
// width is bottom right X
// height is thickness
gfx_fillrect(tlxp, tlyp, blxp, tk);

// right wall
// X is bottom left minus thickless (to shift it to the left), plus our left X (to offset)
// Y is left Y
// Width is thickness
// Height is bottom left Y
gfx_fillrect(blxp + tlxp-tk, tlyp+tk, tk, blyp-(2*tk));

// bottom wall
// X is top left X
// Y is bottom left Y plus top left Y
// width is bottom left X
// height is thickness
gfx_fillrect(tlxp, blyp + tlyp - tk, blxp, tk);
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog

Last edited by EpicSounds; 12-21-2018 at 02:10 AM.
EpicSounds is offline   Reply With Quote
Old 12-21-2018, 01:57 AM   #2
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 817
Default

Cool stuff! This is a nice addition for outlining fx windows or anything else in screen caps to get more focus. And of course to have a nice frame if the video borders are as black as the image window background.

Many thanks
Eliseat is offline   Reply With Quote
Old 12-21-2018, 02:23 AM   #3
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 817
Default



Short example.

Those 1px gap shows only up on automation.
Eliseat is offline   Reply With Quote
Old 12-21-2018, 04:36 AM   #4
wwwmaze
Human being with feelings
 
Join Date: Oct 2009
Posts: 115
Default

Cool thank you for sharing!
Those gaps could be rounding issues (again). See if this helps Eli. It rounds/floors to even indices because of this. If you find that step size too coarse just change all "&-2" parts to "|0" which just floors.
PHP Code:
//RR: Draw box Annotation
//@param1:tlx 'Top left X' 0.25 0 1 0.5 0.01
//@param2:tly 'Top Left Y' 0.25 0 1 0.5 0.01
//@param3:blx 'Bottom Right X' 0.5 0 1 0.5 0.01
//@param4:bly 'Bottom Right Y' 0.5 0 1 0.5 0.01
//@param5:tk  'Thickness' 10 0 50 10 2

//@param7:R 'R' 1 0 1 0.5 0.1
//@param8:G 'G' 1 0 1 0.5 0.1
//@param9:B 'B' 1 0 1 0.5 0.1
//@param10:A 'A' 1 0 1 0.5 0.01

input 0;
!
project_wh_valid && input_info(input,w,h) ? ( project_w=wproject_h=h; );

input 0;
gfx_blit(input,1);
gfx_set(R,G,B,A);
// convert percentages to pixels
tlxp = (tlx project_w)&-2;  // &-2 <-- floor to even indices, see https://forum.cockos.com/showthread.php?p=2072268#post2072268
blxp = (blx project_w)&-2;
tlyp = (tly project_h)&-2;
blyp = (bly project_h tk)&-2// subtrack thickness so we don't go under the frame

// left wall
// X/Y from left
// thickness and height is our bottom left Y
gfx_fillrect(tlxptlyp+tktkblyp-(2*tk));

// top wall
// X/Y from left
// width is bottom right X
// height is thickness
gfx_fillrect(tlxptlypblxptk);

// right wall
// X is bottom left minus thickless (to shift it to the left), plus our left X (to offset)
// Y is left Y
// Width is thickness
// Height is bottom left Y
gfx_fillrect(blxp tlxp-tktlyp+tktkblyp-(2*tk));

// bottom wall
// X is top left X
// Y is bottom left Y plus top left Y
// width is bottom left X
// height is thickness
gfx_fillrect(tlxpblyp tlyp tkblxptk); 
__________________
Video processor programming: (1) How inputs work: https://forum.cockos.com/showthread....26#post2057426 (2) YV12 colorspace: https://forum.cockos.com/showthread....54#post2059354 (3) EEL documentation: https://www.cockos.com/EEL2/
wwwmaze is offline   Reply With Quote
Old 12-21-2018, 08:45 AM   #5
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 817
Default

Hmmmm, this doesn't change a lot.

It seems more and more that something is odd respective scaling. The more I see about it in the forums the more I realize what lets Reaper videos look kind of choppy (for scaling) comparing to other video editors outputs.
I had no time to make my announced test in detail but I'm pretty sure this will show that something is elementary wrong with scaling. As I know for now it updates only after view frames. And this can't be right.

Here is another example: https://forum.cockos.com/showthread.php?t=196263

At the moment zooming is not usable for serious applications. By the way, your along the way released motionblur is so amazing. This alone is such a great addition to the video processor ... unbelievable. But it can't be the solution to stuck 10 of those presets on top of a slowly zoom. Okay, it could be the solution, but with a lot of silly feelings in the belly.

Last edited by Eliseat; 12-21-2018 at 08:55 AM.
Eliseat is offline   Reply With Quote
Old 12-21-2018, 09:19 AM   #6
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 5,168
Default

*I think* one way around it is to work in pixels instead of percents.
But then it needs to still work with all frame sizes from 720p to 4k.

I'm not really liking how this preset works now in actual practice.
It's harder than it should be to use.

What I think would be better is if it was center aligned so setting param to 0.5 is middle of video. Then change width and height from that point.

Param1 x position
Param2 y position
param3 width
param4 height
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
EpicSounds is offline   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 02:14 AM.


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