Warning, file /office/calligra/libs/pigment/KoCompositeOpRegistry.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) 2005 Adrian Page <adrian@pagenet.plus.com>
0003  * Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
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 #ifndef KOCOMPOSITEOPREGISTRY_H
0021 #define KOCOMPOSITEOPREGISTRY_H
0022 
0023 // clazy:excludeall=non-pod-global-static
0024 
0025 #include <QString>
0026 #include <QList>
0027 #include <QMultiMap>
0028 #include <QBitArray>
0029 
0030 #include "pigment_export.h"
0031 
0032 class KoColorSpace;
0033 #include <KoID.h>
0034 
0035 const QString COMPOSITE_OVER         = "normal";
0036 const QString COMPOSITE_ERASE        = "erase";
0037 const QString COMPOSITE_IN           = "in";
0038 const QString COMPOSITE_OUT          = "out";
0039 const QString COMPOSITE_ALPHA_DARKEN = "alphadarken";
0040 
0041 const QString COMPOSITE_XOR                   = "xor";
0042 const QString COMPOSITE_PLUS                  = "plus";
0043 const QString COMPOSITE_MINUS                 = "minus";
0044 const QString COMPOSITE_ADD                   = "add";
0045 const QString COMPOSITE_SUBTRACT              = "subtract";
0046 const QString COMPOSITE_INVERSE_SUBTRACT      = "inverse_subtract";
0047 const QString COMPOSITE_DIFF                  = "diff";
0048 const QString COMPOSITE_MULT                  = "multiply";
0049 const QString COMPOSITE_DIVIDE                = "divide";
0050 const QString COMPOSITE_ARC_TANGENT           = "arc_tangent";
0051 const QString COMPOSITE_GEOMETRIC_MEAN        = "geometric_mean";
0052 const QString COMPOSITE_ADDITIVE_SUBTRACTIVE  = "additive_subtractive";
0053 
0054 const QString COMPOSITE_EQUIVALENCE   = "equivalence";
0055 const QString COMPOSITE_ALLANON       = "allanon";
0056 const QString COMPOSITE_PARALLEL      = "parallel";
0057 const QString COMPOSITE_GRAIN_MERGE   = "grain_merge";
0058 const QString COMPOSITE_GRAIN_EXTRACT = "grain_extract";
0059 const QString COMPOSITE_EXCLUSION     = "exclusion";
0060 const QString COMPOSITE_HARD_MIX      = "hard mix";
0061 const QString COMPOSITE_OVERLAY       = "overlay";
0062 const QString COMPOSITE_BEHIND        = "behind";
0063 const QString COMPOSITE_GREATER        = "greater";
0064 
0065 const QString COMPOSITE_DARKEN      = "darken";
0066 const QString COMPOSITE_BURN        = "burn";//this is also known as 'color burn'.
0067 const QString COMPOSITE_LINEAR_BURN = "linear_burn";
0068 const QString COMPOSITE_GAMMA_DARK  = "gamma_dark";
0069 
0070 const QString COMPOSITE_LIGHTEN      = "lighten";
0071 const QString COMPOSITE_DODGE        = "dodge";
0072 const QString COMPOSITE_LINEAR_DODGE = "linear_dodge";
0073 const QString COMPOSITE_SCREEN       = "screen";
0074 const QString COMPOSITE_HARD_LIGHT   = "hard_light";
0075 const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP = "soft_light";
0076 const QString COMPOSITE_SOFT_LIGHT_SVG  = "soft_light_svg";
0077 const QString COMPOSITE_GAMMA_LIGHT  = "gamma_light";
0078 const QString COMPOSITE_VIVID_LIGHT  = "vivid_light";
0079 const QString COMPOSITE_LINEAR_LIGHT = "linear light";
0080 const QString COMPOSITE_PIN_LIGHT    = "pin_light";
0081 
0082 const QString COMPOSITE_HUE            = "hue";
0083 const QString COMPOSITE_COLOR          = "color";
0084 const QString COMPOSITE_SATURATION     = "saturation";
0085 const QString COMPOSITE_INC_SATURATION = "inc_saturation";
0086 const QString COMPOSITE_DEC_SATURATION = "dec_saturation";
0087 const QString COMPOSITE_LUMINIZE       = "luminize";
0088 const QString COMPOSITE_INC_LUMINOSITY = "inc_luminosity";
0089 const QString COMPOSITE_DEC_LUMINOSITY = "dec_luminosity";
0090 
0091 const QString COMPOSITE_HUE_HSV            = "hue_hsv";
0092 const QString COMPOSITE_COLOR_HSV          = "color_hsv";
0093 const QString COMPOSITE_SATURATION_HSV     = "saturation_hsv";
0094 const QString COMPOSITE_INC_SATURATION_HSV = "inc_saturation_hsv";
0095 const QString COMPOSITE_DEC_SATURATION_HSV = "dec_saturation_hsv";
0096 const QString COMPOSITE_VALUE              = "value";
0097 const QString COMPOSITE_INC_VALUE          = "inc_value";
0098 const QString COMPOSITE_DEC_VALUE          = "dec_value";
0099 
0100 const QString COMPOSITE_HUE_HSL            = "hue_hsl";
0101 const QString COMPOSITE_COLOR_HSL          = "color_hsl";
0102 const QString COMPOSITE_SATURATION_HSL     = "saturation_hsl";
0103 const QString COMPOSITE_INC_SATURATION_HSL = "inc_saturation_hsl";
0104 const QString COMPOSITE_DEC_SATURATION_HSL = "dec_saturation_hsl";
0105 const QString COMPOSITE_LIGHTNESS          = "lightness";
0106 const QString COMPOSITE_INC_LIGHTNESS      = "inc_lightness";
0107 const QString COMPOSITE_DEC_LIGHTNESS      = "dec_lightness";
0108 
0109 const QString COMPOSITE_HUE_HSI            = "hue_hsi";
0110 const QString COMPOSITE_COLOR_HSI          = "color_hsi";
0111 const QString COMPOSITE_SATURATION_HSI     = "saturation_hsi";
0112 const QString COMPOSITE_INC_SATURATION_HSI = "inc_saturation_hsi";
0113 const QString COMPOSITE_DEC_SATURATION_HSI = "dec_saturation_hsi";
0114 const QString COMPOSITE_INTENSITY          = "intensity";
0115 const QString COMPOSITE_INC_INTENSITY      = "inc_intensity";
0116 const QString COMPOSITE_DEC_INTENSITY      = "dec_intensity";
0117 
0118 const QString COMPOSITE_COPY         = "copy";
0119 const QString COMPOSITE_COPY_RED     = "copy_red";
0120 const QString COMPOSITE_COPY_GREEN   = "copy_green";
0121 const QString COMPOSITE_COPY_BLUE    = "copy_blue";
0122 const QString COMPOSITE_TANGENT_NORMALMAP    = "tangent_normalmap";
0123 
0124 const QString COMPOSITE_COLORIZE     = "colorize";
0125 const QString COMPOSITE_BUMPMAP      = "bumpmap";
0126 const QString COMPOSITE_COMBINE_NORMAL = "combine_normal";
0127 const QString COMPOSITE_CLEAR        = "clear";
0128 const QString COMPOSITE_DISSOLVE     = "dissolve";
0129 const QString COMPOSITE_DISPLACE     = "displace";
0130 const QString COMPOSITE_NO           = "nocomposition";
0131 const QString COMPOSITE_PASS_THROUGH = "pass through"; // XXX: not implemented anywhere yet
0132 const QString COMPOSITE_DARKER_COLOR = "darker color";
0133 const QString COMPOSITE_LIGHTER_COLOR = "lighter color";
0134 const QString COMPOSITE_UNDEF        = "undefined";
0135 
0136 
0137 class PIGMENTCMS_EXPORT KoCompositeOpRegistry
0138 {
0139     typedef QMultiMap<KoID,KoID> KoIDMap;
0140     typedef QList<KoID>          KoIDList;
0141 
0142 public:
0143     KoCompositeOpRegistry();
0144     static const KoCompositeOpRegistry& instance();
0145 
0146     KoID     getDefaultCompositeOp() const;
0147     KoID     getKoID(const QString& compositeOpID) const;
0148     KoIDMap  getCompositeOps() const;
0149     KoIDList getCategories() const;
0150     KoIDList getCompositeOps(const KoColorSpace* colorSpace) const;
0151     KoIDList getCompositeOps(const KoID& category, const KoColorSpace* colorSpace=0) const;
0152     bool     colorSpaceHasCompositeOp(const KoColorSpace* colorSpace, const KoID& compositeOp) const;
0153 
0154     template<class TKoIdIterator>
0155     KoIDList filterCompositeOps(TKoIdIterator begin, TKoIdIterator end, const KoColorSpace* colorSpace, bool removeInvaliOps=true) const {
0156         KoIDList list;
0157 
0158         for(; begin!=end; ++begin){
0159             if( colorSpaceHasCompositeOp(colorSpace, *begin) == removeInvaliOps)
0160                 list.push_back(*begin);
0161         }
0162 
0163         return list;
0164     }
0165 
0166 private:
0167     KoIDList m_categories;
0168     KoIDMap  m_map;
0169 };
0170 
0171 
0172 #endif // KOCOMPOSITEOPREGISTRY_H