05-23-2020, 08:51 AM | #1 |
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
I need a video processor/gfx tutorial. Anyone can help?
I am trying to understand how things work with the video processor and its gfx functions. But they all seem very complicated. Could anyone help? I have lots of questions unfortunately..
1) Could someone explain me how the gfx_blit works? Code:
gfx_blit(input[,preserve_aspect=0,x,y,w,h,srcx,srcy,srcw,srch]) Draws input to framebuffer. preserve_aspect=-1 for no fill in pad areas Let's say that I have this code that will half the width of the video while preserving the aspect: Code:
input_info(0, w, h); // getting the w,h of the video gfx_blit(-1); // blitting a black layer on the frame gfx_blit(0, 1, 0, 0, w/2, h, 0, 0, w, h ); // halving the width of the frame Code:
input_info(0, w, h); gfx_blit(-1); // example for up right div = 0.5; vert_position = 1; //1 for up, -1 for down k = vert_position*(0.5*div - 0.5); horiz_position = w*div; // 0 for left, w*div for right gfx_blit(0, 1, w*div, h*k, w*div, h, 0, 0, w, h ); Code:
input_info(0, w, h); gfx_blit(-1); // example for up right div = 0.5; horiz_position = -1; //1 for left, -1 for right k = horiz_position*(0.5*div - 0.5); vert_position = 0; // 0 for up, h*div for down gfx_blit(0, 1, w*k, vert_position, w, h*div, 0, 0, w, h ); ... What happens with these: ? Code:
gfx_blit(input,1,x,y,w,h,srcx,srcy,srcw,srch) Is there a logic on how all these interact? 2) For gfx_blit the final layer was -1 but for the input_info function the current is 0 and not -1, right? So, for which functions is the current -1 and for which is it 0? Code:
input_info(input, w, h[,srctime, wet, parm1, ...]) Returns 1 if input is available, sets w/h to dimensions. If srctime specified, it will be set with the source-local time of the underlying media. if input is a video processor in effect form, automated parameters can be queried via wet/parm1/... Code:
input_info(0, w, h); gfx_set(0,0,0,1,0); gfx_fillrect(0,0,100,h);
__________________
Most of my scripts can be found in ReaPack. If you find them useful, a donation would be greatly appreciated! Thank you! :) Last edited by amagalma; 05-23-2020 at 08:59 AM. |
05-27-2020, 06:58 AM | #2 |
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
|
Code:
gfx_blit(input[,preserve_aspect=0,x,y,w,h,srcx,srcy,srcw,srch]) To avoid flickering, the best technique is to draw everything into an offscreen buffer first then blit the whole thing to the display when you're done. Hope that helps a bit. |
05-27-2020, 10:39 AM | #3 |
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thank you very much for helping me
So, is this the correct way?: Code:
// Crop Image (curtains) //@param1:x_pos 'Horiz Shift' 0 -1 1 0 0.01 //@param2:y_pos 'Vert Shift' 0 -1 1 0 0.01 //@param3:w_size 'Horizontal Curtains' 0 0 1 0.5 0.01 //@param4:h_size 'Vertical Curtains' 0 0 1 0.5 0.01 input_info(0, w, h); gfx_dest = mybuf = gfx_img_alloc(w,h); gfx_blit(0, 1, 0, 0, w, h, -x_pos*w, y_pos*h, w, h ); w_size != 0 ? ( w_size = w*w_size/2; gfx_fillrect(0,0,w_size,h); gfx_fillrect(w-w_size,0,w_size,h); ); h_size != 0 ? ( h_size = h*h_size/2; gfx_fillrect(0,0,w,h_size); gfx_fillrect(0,h-h_size,w,h_size); ); gfx_dest = -1; gfx_blit(mybuf, 1); gfx_img_free(mybuf);
__________________
Most of my scripts can be found in ReaPack. If you find them useful, a donation would be greatly appreciated! Thank you! :) |
05-27-2020, 10:49 AM | #4 |
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
A test image:
full size 1920x1080 I want to copy the red rectangle to point 0,0. I understood how the gfx_blit works.. But still I think I am not drawing correctly to the buffer because it flickers: Code:
input_info(0, w, h); gfx_dest = mybuf = gfx_img_alloc(w,h); gfx_blit(0,1,0,0,242,137,1200,540,242,137); gfx_dest = -1; gfx_blit(mybuf, 1); gfx_img_free(mybuf); Code:
input_info(0, w, h); mybuf = gfx_img_alloc(w,h); gfx_dest = mybuf; gfx_blit(0,1); gfx_blit(0,1,0,0,242,137,1200,540,242,137); gfx_dest = -1; gfx_blit(mybuf, 1); gfx_img_free(mybuf);
__________________
Most of my scripts can be found in ReaPack. If you find them useful, a donation would be greatly appreciated! Thank you! :) |
05-27-2020, 10:59 AM | #5 |
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
|
I've been playing with it this afternoon as well and tbh I'm not sure any advice I give you is worth the pixels it's displayed on!
It looks, to my untrained eye, like you're doing the right things but what do I know? I'm in the dark too! |
05-27-2020, 11:21 AM | #6 |
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Nahh... your advice cleared things up to me! Thank you!
__________________
Most of my scripts can be found in ReaPack. If you find them useful, a donation would be greatly appreciated! Thank you! :) Last edited by amagalma; 05-27-2020 at 11:28 AM. |
05-27-2020, 11:26 AM | #7 |
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
|
Miracles do happen! Looking good there.
|
06-01-2020, 10:09 AM | #8 |
Human being with feelings
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
|
This very strange moment when you look into a thread and don't understand it.
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
|
Thread Tools | |
Display Modes | |
|
|