no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / overlaydirect.h
1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published
4  * by the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public
13  * License along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
15  * USA
16  */
17
18
19 #ifndef __OVERLAYDIRECT_H__
20 #define __OVERLAYDIRECT_H__
21 #include "overlayframe.h"
22
23 #define XBLEND(FN, temp_type, type, max, components, ofs, round) { \
24         temp_type opcty = fade * max + round, trnsp = max - opcty; \
25         type** output_rows = (type**)output->get_rows(); \
26         type** input_rows = (type**)input->get_rows(); \
27         ix *= components;  ox *= components; \
28  \
29         for( int i=pkg->out_row1; i<pkg->out_row2; ++i ) { \
30                 type* in_row = input_rows[i + iy] + ix; \
31                 type* output = output_rows[i] + ox; \
32                 for( int j=ow; --j>=0; ) { \
33                         if( components == 4 ) { \
34                                 temp_type r, g, b, a; \
35                                 ALPHA4_BLEND(FN, temp_type, in_row, output, max, ofs, ofs, round); \
36                                 ALPHA4_STORE(output, ofs, max); \
37                         } \
38                         else { \
39                                 temp_type r, g, b; \
40                                 ALPHA3_BLEND(FN, temp_type, in_row, output, max, ofs, ofs, round); \
41                                 ALPHA3_STORE(output, ofs, max); \
42                         } \
43                         in_row += components;  output += components; \
44                 } \
45         } \
46 } break
47
48 #endif