Debian Codegraph @

src/mixer2/alphaatop/alphaatop.cpp

raw symbols SCIP
1 /* alphaatop.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 alphaatopcxx . . $ alphaatop# : public frei0rcxx . . $ frei0r/::mixer2cxx . . $ frei0r/mixer2#
26 {
27 public:
28 alphaatopcxx . . $ alphaatop#alphaatop(b4d55b1286ff73e8).(unsigned int width, unsigned int height)
29 {
30 }
31
32 void updatecxx . . $ alphaatop#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 tmp1, tmp2;
44 uint8_t alpha_src1 = src1[3];
45 uint8_t alpha_src2 = src2[3];
46 uint8_t alpha_dst;
47 uint8_t w1 = alpha_src2;
48 uint8_t w2 = 0xff ^ alpha_src1; // w2 = 255 - alpha_1
49
50 // compute destination alpha
51 alpha_dst = dst[3] = w1;
52
53 // compute destination values
54 if (alpha_dst == 0)
55 for (int b=0; b<3; ++b)
56 dst[b] = 0;
57 else
58 for (int b=0; b<3; ++b)
59 dst[b] = CLAMP0255cxx . . $ CLAMP0255(bc0fba5608a0bfe7).( (uint32_t)( (uint32_t) (INT_MULTcxx . . $ `include/frei0r/math.h:31:9`!(src1[b], alpha_src1, tmp1) * w1 + INT_MULTcxx . . $ `include/frei0r/math.h:31:9`!(src2[b], alpha_src2, tmp2) * w2) / alpha_dst) );
60
61 src1 += 4;
62 src2 += 4;
63 dst += 4;
64 }
65 }
66
67 };
68
69
70 frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<alphaatopcxx . . $ alphaatop#> plugincxx . . $ plugin.("alphaatop"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
71 "the alpha ATOP operation"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
72 "Jean-Sebastien Senecal"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
73 0,2,
74 F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!);
75