Forums > Jitter

"Picture in picture" alpha blend


Feb 10 2017 | 8:45 am

I’m trying to put a small matrix (320×240) in the center of a large one (640×480) and use the alpha channel of the smaller one to fade it in (from 0. to 1. transparency). To do this, I’m sending the large one into a [[jit.matrix 4 char 640 480 @dstdimstart 160 120 @dstdimend 480 360]], with [usedstdim 0] and [thru 0], then, the second one with [usedstdim 1] and [thru 1].

When I ramp the alpha down to zero by multiplying it by a 1.->0. float using [[jit.op @op * pass pass pass]], I would expect it to fade out. However, I’m getting a black box, as if jit.matrix is ignoring the alpha channel. I’ve tried jit.alphablend with no results, but I’m probably using it wrong. Ideas?

Feb 10 2017 | 9:26 am

hard to say without seeing the patch, but strongly recommend you use opengl for this. 1 jit.world and 2 jit.gl.videoplanes are all that’s needed.

Feb 10 2017 | 6:56 pm

To wit: http://music.arts.uci.edu/dobrian/Music215/S13/examples.htm#Ex38

For the old-school jit.alphablend method, see http://music.arts.uci.edu/dobrian/IAP2006/examples.htm and scroll down to the examples called "make a mask image" and "mask by alphablend".

Feb 11 2017 | 8:23 am

hello ericsinger

here is a patch doing what you ask for , hope you learn from it :-)

— Pasted Max Patch, click to expand. —
Viewing 4 posts - 1 through 4 (of 4 total)

Forums > Jitter