Warning, file /office/calligra/libs/pigment/KoInvertColorTransformation.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net> 0003 * Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Lesser General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2.1 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Lesser General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Lesser General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KO_INVERT_COLOR_TRANSFORMATION_H 0022 #define KO_INVERT_COLOR_TRANSFORMATION_H 0023 0024 #include "KoColorTransformation.h" 0025 0026 class KoInvertColorTransformation : public KoColorTransformation 0027 { 0028 0029 public: 0030 0031 KoInvertColorTransformation(const KoColorSpace* cs) : m_colorSpace(cs), m_psize(cs->pixelSize()) { 0032 } 0033 0034 void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override { 0035 quint16 m_rgba[4]; 0036 while (nPixels--) { 0037 m_colorSpace->toRgbA16(src, reinterpret_cast<quint8 *>(m_rgba), 1); 0038 m_rgba[0] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[0]; 0039 m_rgba[1] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[1]; 0040 m_rgba[2] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[2]; 0041 m_colorSpace->fromRgbA16(reinterpret_cast<quint8 *>(m_rgba), dst, 1); 0042 src += m_psize; 0043 dst += m_psize; 0044 } 0045 0046 } 0047 0048 private: 0049 0050 const KoColorSpace* m_colorSpace; 0051 quint32 m_psize; 0052 }; 0053 0054 0055 #endif