Debian Codegraph @

src/mixer2/alphaout/alphaout.cpp

raw symbols SCIP
1 /* alphaout.cpp
2 * Copyright (C) 2005 Jean-Sebastien Senecal ([email protected])
3 * This file is a Frei0r plugin.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "frei0r.hpp"cxx . . $ `<file>/include/frei0r.hpp`/
21 #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/
22
23 #include <algorithm>
24
25 class alphaoutcxx . . $ alphaout# : public frei0rcxx . . $ frei0r/::mixer2cxx . . $ frei0r/mixer2#
26 {
27 public:
28 alphaoutcxx . . $ alphaout#alphaout(b4d55b1286ff73e8).(unsigned int width, unsigned int height)
29 {
30 }
31
32 void updatecxx . . $ alphaout#update(aea6c563decfb03a).(double time,
33 uint32_t* out,
34 const uint32_t* in1,
35 const uint32_t* in2)
36 {
37 uint8_t *dst = reinterpret_cast<uint8_t*>(out);
38 const uint8_t *src1 = reinterpret_cast<const uint8_t*>(in1);
39 const uint8_t *src2 = reinterpret_cast<const uint8_t*>(in2);
40
41 for (unsigned int i=0; i<sizecxx . . $ frei0r/fx#size.; ++i)
42 {
43 uint32_t tmp;
44 uint8_t alpha_src1 = src1[3];
45 uint8_t alpha_dst;
46 uint8_t w1 = 0xff ^ src2[3]; // w2 = 255 - alpha_2
47
48 // compute destination alpha
49 alpha_dst = dst[3] = INT_MULTcxx . . $ `include/frei0r/math.h:31:9`!(alpha_src1, w1, tmp);
50
51 // compute destination values
52 if (alpha_dst == 0)
53 for (int b=0; b<3; ++b)
54 dst[b] = 0;
55 else
56 for (int b=0; b<3; ++b)
57 dst[b] = CLAMP0255cxx . . $ CLAMP0255(bc0fba5608a0bfe7).( (uint32_t)( (uint32_t) (INT_MULTcxx . . $ `include/frei0r/math.h:31:9`!(src1[b], alpha_src1, tmp) * w1) / alpha_dst) );
58
59 src1 += 4;
60 src2 += 4;
61 dst += 4;
62 }
63 }
64
65 };
66
67
68 frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<alphaoutcxx . . $ alphaout#> plugincxx . . $ plugin.("alphaout"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
69 "the alpha OUT operation"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
70 "Jean-Sebastien Senecal"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
71 0,2,
72 F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!);
73