Old 07-10-2020, 04:06 PM   #1
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default Overlay image with highlighting

This preset lets you display an image dimmed, with a rectangle inside of the image undimmed, i.e. highlighted. With midi-learning, you can control the position and size of both the image and the highlighted area with the mouse.

You can automate the opacity to make the outer part of an image appear or disappear. You can set the opacity to zero and automate the edge parameters to make an image grow or shrink without zooming.

How to midi-learn: https://forum.cockos.com/showthread.php?t=217581

Code:
//overlay image with cropping/highlighting
// July 11 2020 TallKite Software
// midi-learn X/Y offset to mouse XY-drag
// midi-learn zoom to mousewheel or shift-Y-drag reversed
// midi-learn left/top edge to command-X/Y-drag 
// midi-learn right/bottom edge to alt-X/Y-drag
// save as an FX chain to make midi-learn permanent

//@param1:xoffs 'X offset' 0 -1 1 0
//@param2:yoffs 'Y offset' 0 -1 1 0
//@param3:opacity 'bg opacity' 0.5
//@param4:zoom 'zoom' 0 -15 15 0

//@param6:x1 'left edge' 0.25 0 1 0.5 0.01
//@param7:x2 'right edge' 0.75 0 1 0.5 0.01
//@param8:y1 'top edge' 0.25 0 1 0.5 0.01
//@param9:y2 'bottom edge' 0.75 0 1 0.5 0.01

//@param11:filter 'filter' 0 0 1 0.5 1
//@param12:use_srca 'alpha channel' 1 0 1 0.5 1

img1=input_track(0);
img2=0;
img2 != img1 ? colorspace='RGBA';
input_info(img1,img1w,img1h) && project_wh_valid===0 ?
  (project_w = img1w; project_h = img1h);

img2 != img1 && input_info(img2,sw,sh) ? (
  gfx_blit(img1,0);
  gfx_mode = (filter>0.5 ? 256 : 0)|(use_srca?0x10000:0);
  z = 10^(zoom/10);
  dw = (sw*z)|0;
  dh = (sh*z)|0;
  x = ((project_w - dw + (project_w + dw)*xoffs)*.5)|0;
  y = ((project_h - dh + (project_h + dh)*yoffs)*.5)|0;
  gfx_a = opacity;
  gfx_blit (img2, 0, x|0,y|0,dw,dh);
  gfx_a = 1;
  gfx_blit (img2, 0, x + x1*dw, y + y1*dh, (x2-x1)*dw, (y2-y1)*dh,
            x1*img1w, y1*img1h, (x2-x1)*img1w, (y2-y1)*img1h);
);
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com

Last edited by Kite; 07-11-2020 at 02:07 PM. Reason: renamed the effect and the bg opacity knob
Kite is offline   Reply With Quote
Old 07-11-2020, 08:53 AM   #2
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Its kind of a vignette effect with a sharp rectangle. And again its a very unconventional contribution from you, kite.

Many thanks.
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 07-11-2020, 02:06 PM   #3
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

Haha, yeah, I'm pretty unconventional

It would be nice if there was a knob to turn that somehow made all the edges less sharp.

With the background opacity set to zero, this is actually a simple cropping effect. In the OP I changed the name to reflect that.

I figured out an easy way to have multiple highlights. You put the image on a track with a highlighted area. Then you control-drag the image to duplicate it in another track directly beneath it. In the 2nd track, you set the bg opacity to zero and set the highlighted area to somewhere different. If you then select both images, you can use the mouse to zoom and pan the whole thing, and you can also resize both highlight areas in sync.
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com
Kite 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 04:28 PM.


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