| 1 | /* lighten.cpp |
| 2 | * Copyright (C) 2006 Jean-Sebastien Senecal ([email protected]) |
| 3 | * This file is a Frei0r plugin. |
| 4 | * The code is a modified version of code from the Gimp. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ |
| 20 | |
| 21 | #include "frei0r.hpp"cxx . . $ `<file>/include/frei0r.hpp`/ |
| 22 | #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/ |
| 23 | |
| 24 | #define NBYTEScxx . . $ `src/mixer2/lighten/lighten.cpp:24:9`! 4 |
| 25 | #define ALPHAcxx . . $ `src/mixer2/lighten/lighten.cpp:25:9`! 3 |
| 26 | |
| 27 | class lightencxx . . $ lighten# : public frei0rcxx . . $ frei0r/::mixer2cxx . . $ frei0r/mixer2# |
| 28 | { |
| 29 | public: |
| 30 | lightencxx . . $ lighten#lighten(b4d55b1286ff73e8).(unsigned int width, unsigned int height) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * |
| 36 | * Perform a lighten operation between sources in1 and in2, using the |
| 37 | * generalised algorithm: |
| 38 | * D_r = max(A_r, B_r); |
| 39 | * D_g = max(A_g, B_g); |
| 40 | * D_b = max(A_b, B_b); |
| 41 | * D_a = min(A_a, B_a); |
| 42 | * |
| 43 | **/ |
| 44 | void updatecxx . . $ lighten#update(aea6c563decfb03a).(double time, |
| 45 | uint32_t* out, |
| 46 | const uint32_t* in1, |
| 47 | const uint32_t* in2) |
| 48 | { |
| 49 | const uint8_t *src1 = reinterpret_cast<const uint8_t*>(in1); |
| 50 | const uint8_t *src2 = reinterpret_cast<const uint8_t*>(in2); |
| 51 | uint8_t *dst = reinterpret_cast<uint8_t*>(out); |
| 52 | uint32_t sizeCounter = sizecxx . . $ frei0r/fx#size.; |
| 53 | |
| 54 | uint32_t b; |
| 55 | uint8_t s1, s2; |
| 56 | |
| 57 | while (sizeCounter--) |
| 58 | { |
| 59 | for (b = 0; b < ALPHAcxx . . $ `src/mixer2/lighten/lighten.cpp:25:9`!; b++) |
| 60 | { |
| 61 | s1 = src1[b]; |
| 62 | s2 = src2[b]; |
| 63 | dst[b] = MAXcxx . . $ `include/frei0r/math.h:71:9`!(s1,s2); |
| 64 | } |
| 65 | |
| 66 | dst[ALPHAcxx . . $ `src/mixer2/lighten/lighten.cpp:25:9`!] = MINcxx . . $ `include/frei0r/math.h:67:9`!(src1[ALPHAcxx . . $ `src/mixer2/lighten/lighten.cpp:25:9`!], src2[ALPHAcxx . . $ `src/mixer2/lighten/lighten.cpp:25:9`!]); |
| 67 | |
| 68 | src1 += NBYTEScxx . . $ `src/mixer2/lighten/lighten.cpp:24:9`!; |
| 69 | src2 += NBYTEScxx . . $ `src/mixer2/lighten/lighten.cpp:24:9`!; |
| 70 | dst += NBYTEScxx . . $ `src/mixer2/lighten/lighten.cpp:24:9`!; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | |
| 75 | |
| 76 | }; |
| 77 | |
| 78 | |
| 79 | frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<lightencxx . . $ lighten#> plugincxx . . $ plugin.("lighten"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 80 | "Perform a lighten operation between two sources (maximum value of both sources)."cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 81 | "Jean-Sebastien Senecal"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 82 | 0,2, |
| 83 | F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!); |
| 84 |