Commit 45414ad3 authored by Silvio Heinrich's avatar Silvio Heinrich
Browse files

Improved categorization of CompositeOps (blending modes).

parent b37f76d5
......@@ -22,26 +22,21 @@
#include "KoCompositeOp.h"
#include "KoColorSpace.h"
QString KoCompositeOp::categoryMix()
{
return i18n("Mix");
}
QString KoCompositeOp::categoryLight()
{
return i18n("Light");
}
QString KoCompositeOp::categoryArithmetic()
{
return i18n("Arithmetic");
}
QString KoCompositeOp::categoryColor()
{
return i18n("Color");
}
QString KoCompositeOp::categoryMisc()
{
return i18n("Misc");
}
QString KoCompositeOp::categoryArithmetic() { return i18n("Arithmetic"); }
QString KoCompositeOp::categoryNegative() { return i18n("Negative"); }
QString KoCompositeOp::categoryLight() { return i18n("Lighten"); }
QString KoCompositeOp::categoryDark() { return i18n("Darken"); }
QString KoCompositeOp::categoryHSY() { return i18n("HSY"); }
QString KoCompositeOp::categoryHSI() { return i18n("HSI"); }
QString KoCompositeOp::categoryHSL() { return i18n("HSL"); }
QString KoCompositeOp::categoryHSV() { return i18n("HSV"); }
QString KoCompositeOp::categoryMix() { return i18n("Mix"); }
QString KoCompositeOp::categoryMisc() { return i18n("Misc"); }
struct KoCompositeOp::Private {
const KoColorSpace * colorSpace;
......
......@@ -113,11 +113,19 @@ const QString COMPOSITE_UNDEF = "underfined";
class PIGMENTCMS_EXPORT KoCompositeOp
{
public:
static QString categoryMix();
static QString categoryLight();
static QString categoryArithmetic();
static QString categoryColor();
static QString categoryArithmetic();
static QString categoryNegative();
static QString categoryLight();
static QString categoryDark();
static QString categoryHSY();
static QString categoryHSI();
static QString categoryHSL();
static QString categoryHSV();
static QString categoryMix();
static QString categoryMisc();
public:
/**
......
......@@ -24,8 +24,8 @@
#include <boost/type_traits.hpp>
#include <KoColorSpace.h>
#include <KoColorSpaceMaths.h>
#include <KoColorSpaceTraits.h>
#include <KoColorSpaceMaths.h>
#include "compositeops/KoCompositeOpGeneric.h"
#include "compositeops/KoCompositeOpCopyChannel.h"
......@@ -34,21 +34,8 @@
#include "compositeops/KoCompositeOpCopy2.h"
#include "compositeops/KoCompositeOpAtop.h"
#include "compositeops/KoCompositeOpDissolve.h"
// #include "compositeops/KoCompositeOpAdd.h"
// #include "compositeops/KoCompositeOpBurn.h"
// #include "compositeops/KoCompositeOpDivide.h"
// #include "compositeops/KoCompositeOpDodge.h"
// #include "compositeops/KoCompositeOpMultiply.h"
// #include "compositeops/KoCompositeOpOver.h"
// #include "compositeops/KoCompositeOpOverlay.h"
// #include "compositeops/KoCompositeOpScreen.h"
// #include "compositeops/KoCompositeOpSubtract.h"
// #include "compositeops/KoCompositeOpInversedSubtract.h"
// #include "compositeops/KoCompositeOpSoftlight.h"
// #include "compositeops/KoCompositeOpHardlight.h"
namespace Private {
namespace _Private {
template<class Traits, bool flag>
struct AddGeneralOps
......@@ -60,6 +47,7 @@ template<class Traits>
struct AddGeneralOps<Traits, true>
{
typedef typename Traits::channels_type Arg;
static const qint32 alpha_pos = Traits::alpha_pos;
template<Arg compositeFunc(Arg, Arg)>
static void add(KoColorSpace* cs, const QString& id, const QString& description, const QString& category, bool userVisible=true) {
......@@ -72,42 +60,46 @@ struct AddGeneralOps<Traits, true>
cs->addCompositeOp(new KoCompositeOpCopy2<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpErase<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpAtop<Traits>(cs, KoCompositeOp::categoryMix()));
cs->addCompositeOp(new KoCompositeOpDissolve<Traits>(cs, KoCompositeOp::categoryMix()));
add<&cfGrainMerge> (cs, COMPOSITE_GRAIN_MERGE , i18n("Grain Merge") , KoCompositeOp::categoryMix());
add<&cfGrainExtract>(cs, COMPOSITE_GRAIN_EXTRACT, i18n("Grain Extract"), KoCompositeOp::categoryMix());
add<&cfHardMix> (cs, COMPOSITE_HARD_MIX , i18n("Hard Mix") , KoCompositeOp::categoryMix());
add<&cfOverlay> (cs, COMPOSITE_OVERLAY , i18n("Overlay") , KoCompositeOp::categoryMix());
add<&cfGrainMerge> (cs, COMPOSITE_GRAIN_MERGE , i18n("Grain Merge") , KoCompositeOp::categoryMix());
add<&cfGrainExtract> (cs, COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract") , KoCompositeOp::categoryMix());
add<&cfHardMix> (cs, COMPOSITE_HARD_MIX , i18n("Hard Mix") , KoCompositeOp::categoryMix());
add<&cfGeometricMean>(cs, COMPOSITE_GEOMETRIC_MEAN, i18n("Geometric Mean"), KoCompositeOp::categoryMix());
add<&cfParallel> (cs, COMPOSITE_PARALLEL , i18n("Parallel") , KoCompositeOp::categoryMix());
add<&cfAllanon> (cs, COMPOSITE_ALLANON , i18n("Allanon") , KoCompositeOp::categoryMix());
add<&cfColorBurn> (cs, COMPOSITE_BURN , i18n("Color Burn") , KoCompositeOp::categoryLight());
add<&cfScreen> (cs, COMPOSITE_SCREEN , i18n("Screen") , KoCompositeOp::categoryLight());
add<&cfColorDodge> (cs, COMPOSITE_DODGE , i18n("Color Dodge") , KoCompositeOp::categoryLight());
add<&cfLinearBurn> (cs, COMPOSITE_LINEAR_BURN , i18n("Linear Burn") , KoCompositeOp::categoryLight());
add<&cfAddition> (cs, COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge"), KoCompositeOp::categoryLight());
add<&cfDarkenOnly> (cs, COMPOSITE_DARKEN , i18n("Darken") , KoCompositeOp::categoryLight());
add<&cfLightenOnly>(cs, COMPOSITE_LIGHTEN , i18n("Lighten") , KoCompositeOp::categoryLight());
add<&cfHardLight> (cs, COMPOSITE_HARD_LIGHT , i18n("Hard Light") , KoCompositeOp::categoryLight());
add<&cfSoftLight> (cs, COMPOSITE_SOFT_LIGHT , i18n("Soft Light") , KoCompositeOp::categoryLight());
add<&cfGammaLight> (cs, COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light") , KoCompositeOp::categoryLight());
add<&cfGammaDark> (cs, COMPOSITE_GAMMA_DARK , i18n("Gamma Dark") , KoCompositeOp::categoryLight());
add<&cfVividLight> (cs, COMPOSITE_VIVID_LIGHT , i18n("Vivid Light") , KoCompositeOp::categoryLight());
add<&cfPinLight> (cs, COMPOSITE_PIN_LIGHT , i18n("Pin Light") , KoCompositeOp::categoryLight());
add<&cfLinearLight>(cs, COMPOSITE_LINEAR_LIGHT, i18n("Linear Light"), KoCompositeOp::categoryLight());
add<&cfColorBurn> (cs, COMPOSITE_BURN , i18n("Color Burn") , KoCompositeOp::categoryDark());
add<&cfLinearBurn>(cs, COMPOSITE_LINEAR_BURN , i18n("Linear Burn"), KoCompositeOp::categoryDark());
add<&cfDarkenOnly>(cs, COMPOSITE_DARKEN , i18n("Darken") , KoCompositeOp::categoryDark());
add<&cfGammaDark> (cs, COMPOSITE_GAMMA_DARK , i18n("Gamma Dark") , KoCompositeOp::categoryDark());
add<&cfAddition> (cs, COMPOSITE_ADD , i18n("Addition") , KoCompositeOp::categoryArithmetic());
add<&cfSubtract> (cs, COMPOSITE_SUBTRACT , i18n("Subtract") , KoCompositeOp::categoryArithmetic());
add<&cfDifference>(cs, COMPOSITE_DIFF , i18n("Difference"), KoCompositeOp::categoryArithmetic());
add<&cfMultiply> (cs, COMPOSITE_MULT , i18n("Multiply") , KoCompositeOp::categoryArithmetic());
add<&cfDivide> (cs, COMPOSITE_DIVIDE , i18n("Divide") , KoCompositeOp::categoryArithmetic());
add<&cfExclusion> (cs, COMPOSITE_EXCLUSION, i18n("Exclusion") , KoCompositeOp::categoryArithmetic());
add<&cfScreen> (cs, COMPOSITE_SCREEN , i18n("Screen") , KoCompositeOp::categoryColor());
add<&cfOverlay>(cs, COMPOSITE_OVERLAY, i18n("Overlay"), KoCompositeOp::categoryColor());
add<&cfArcTangent> (cs, COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent") , KoCompositeOp::categoryNegative());
add<&cfDifference> (cs, COMPOSITE_DIFF , i18n("Difference") , KoCompositeOp::categoryNegative());
add<&cfExclusion> (cs, COMPOSITE_EXCLUSION , i18n("Exclusion") , KoCompositeOp::categoryNegative());
add<&cfEquivalence> (cs, COMPOSITE_EQUIVALENCE , i18n("Equivalence") , KoCompositeOp::categoryNegative());
add<&cfAdditiveSubstractive>(cs, COMPOSITE_ADDITIVE_SUBSTRACTIVE, i18n("Additive-Substractive"), KoCompositeOp::categoryNegative());
cs->addCompositeOp(new KoCompositeOpDissolve<Traits>(cs, KoCompositeOp::categoryMisc()));
add<&cfArcTangent> (cs, COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent") , KoCompositeOp::categoryMisc());
add<&cfGeometricMean> (cs, COMPOSITE_GEOMETRIC_MEAN , i18n("Geometric Mean") , KoCompositeOp::categoryMisc());
add<&cfAllanon> (cs, COMPOSITE_ALLANON , i18n("Allanon") , KoCompositeOp::categoryMisc());
add<&cfParallel> (cs, COMPOSITE_PARALLEL , i18n("Parallel") , KoCompositeOp::categoryMisc());
add<&cfEquivalence> (cs, COMPOSITE_EQUIVALENCE , i18n("Equivalence") , KoCompositeOp::categoryMisc());
add<&cfAdditiveSubstractive>(cs, COMPOSITE_ADDITIVE_SUBSTRACTIVE, i18n("Additive-Substractive"), KoCompositeOp::categoryMisc());
if(alpha_pos != -1)
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,alpha_pos>(cs, COMPOSITE_COPY_OPACITY, i18n("Copy Alpha") , KoCompositeOp::categoryMisc()));
}
};
......@@ -125,7 +117,6 @@ struct AddRGBOps<Traits, true>
static const qint32 red_pos = Traits::red_pos;
static const qint32 green_pos = Traits::green_pos;
static const qint32 blue_pos = Traits::blue_pos;
static const qint32 alpha_pos = Traits::alpha_pos;
template<void compositeFunc(Arg, Arg, Arg, Arg&, Arg&, Arg&)>
static void add(KoColorSpace* cs, const QString& id, const QString& description, const QString& category, bool userVisible=true) {
......@@ -137,28 +128,25 @@ struct AddRGBOps<Traits, true>
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,green_pos>(cs, COMPOSITE_COPY_GREEN, i18n("Copy Green"), KoCompositeOp::categoryMisc()));
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,blue_pos >(cs, COMPOSITE_COPY_BLUE , i18n("Copy Blue") , KoCompositeOp::categoryMisc()));
if(alpha_pos != -1)
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,alpha_pos>(cs, COMPOSITE_COPY_OPACITY, i18n("Copy Alpha") , KoCompositeOp::categoryMisc()));
add<&cfColor <HSYType,Arg> >(cs, COMPOSITE_COLOR , i18n("Color HSY") , KoCompositeOp::categoryColor());
add<&cfHue <HSYType,Arg> >(cs, COMPOSITE_HUE , i18n("Hue HSY") , KoCompositeOp::categoryColor());
add<&cfSaturation<HSYType,Arg> >(cs, COMPOSITE_SATURATION, i18n("Saturation HSY"), KoCompositeOp::categoryColor());
add<&cfLightness <HSYType,Arg> >(cs, COMPOSITE_LUMINIZE , i18n("Luminosity") , KoCompositeOp::categoryColor());
add<&cfColor <HSYType,Arg> >(cs, COMPOSITE_COLOR , i18n("Color HSY") , KoCompositeOp::categoryHSY());
add<&cfHue <HSYType,Arg> >(cs, COMPOSITE_HUE , i18n("Hue HSY") , KoCompositeOp::categoryHSY());
add<&cfSaturation<HSYType,Arg> >(cs, COMPOSITE_SATURATION, i18n("Saturation HSY"), KoCompositeOp::categoryHSY());
add<&cfLightness <HSYType,Arg> >(cs, COMPOSITE_LUMINIZE , i18n("Luminosity") , KoCompositeOp::categoryHSY());
add<&cfColor <HSLType,Arg> >(cs, COMPOSITE_COLOR_HSL , i18n("Color HSL") , KoCompositeOp::categoryColor());
add<&cfHue <HSLType,Arg> >(cs, COMPOSITE_HUE_HSL , i18n("Hue HSL") , KoCompositeOp::categoryColor());
add<&cfSaturation<HSLType,Arg> >(cs, COMPOSITE_SATURATION_HSL, i18n("Saturation HSL"), KoCompositeOp::categoryColor());
add<&cfLightness <HSLType,Arg> >(cs, COMPOSITE_LIGHTNESS , i18n("Lightness") , KoCompositeOp::categoryColor());
add<&cfColor <HSLType,Arg> >(cs, COMPOSITE_COLOR_HSL , i18n("Color HSL") , KoCompositeOp::categoryHSL());
add<&cfHue <HSLType,Arg> >(cs, COMPOSITE_HUE_HSL , i18n("Hue HSL") , KoCompositeOp::categoryHSL());
add<&cfSaturation<HSLType,Arg> >(cs, COMPOSITE_SATURATION_HSL, i18n("Saturation HSL"), KoCompositeOp::categoryHSL());
add<&cfLightness <HSLType,Arg> >(cs, COMPOSITE_LIGHTNESS , i18n("Lightness") , KoCompositeOp::categoryHSL());
add<&cfColor <HSVType,Arg> >(cs, COMPOSITE_COLOR_HSV , i18n("Color HSV") , KoCompositeOp::categoryColor());
add<&cfHue <HSVType,Arg> >(cs, COMPOSITE_HUE_HSV , i18n("Hue HSV") , KoCompositeOp::categoryColor());
add<&cfSaturation<HSVType,Arg> >(cs, COMPOSITE_SATURATION_HSV, i18n("Saturation HSV"), KoCompositeOp::categoryColor());
add<&cfLightness <HSVType,Arg> >(cs, COMPOSITE_VALUE , i18n("Value") , KoCompositeOp::categoryColor());
add<&cfColor <HSVType,Arg> >(cs, COMPOSITE_COLOR_HSV , i18n("Color HSV") , KoCompositeOp::categoryHSV());
add<&cfHue <HSVType,Arg> >(cs, COMPOSITE_HUE_HSV , i18n("Hue HSV") , KoCompositeOp::categoryHSV());
add<&cfSaturation<HSVType,Arg> >(cs, COMPOSITE_SATURATION_HSV, i18n("Saturation HSV"), KoCompositeOp::categoryHSV());
add<&cfLightness <HSVType,Arg> >(cs, COMPOSITE_VALUE , i18n("Value") , KoCompositeOp::categoryHSV());
add<&cfColor <HSIType,Arg> >(cs, COMPOSITE_COLOR_HSI , i18n("Color HSI") , KoCompositeOp::categoryColor());
add<&cfHue <HSIType,Arg> >(cs, COMPOSITE_HUE_HSI , i18n("Hue HSI") , KoCompositeOp::categoryColor());
add<&cfSaturation<HSIType,Arg> >(cs, COMPOSITE_SATURATION_HSI, i18n("Saturation HSI"), KoCompositeOp::categoryColor());
add<&cfLightness <HSIType,Arg> >(cs, COMPOSITE_INTENSITY , i18n("Intensity") , KoCompositeOp::categoryColor());
add<&cfColor <HSIType,Arg> >(cs, COMPOSITE_COLOR_HSI , i18n("Color HSI") , KoCompositeOp::categoryHSI());
add<&cfHue <HSIType,Arg> >(cs, COMPOSITE_HUE_HSI , i18n("Hue HSI") , KoCompositeOp::categoryHSI());
add<&cfSaturation<HSIType,Arg> >(cs, COMPOSITE_SATURATION_HSI, i18n("Saturation HSI"), KoCompositeOp::categoryHSI());
add<&cfLightness <HSIType,Arg> >(cs, COMPOSITE_INTENSITY , i18n("Intensity") , KoCompositeOp::categoryHSI());
}
};
......@@ -171,31 +159,13 @@ struct AddRGBOps<Traits, true>
template<class _Traits_>
void addStandardCompositeOps(KoColorSpace* cs)
{
//cs->addCompositeOp(new KoCompositeOpAlphaDarken<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpCopy2<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpErase<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpAdd<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpAlphaDarken<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpBurn<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpCopy2<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpDivide<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpDodge<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpErase<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpMultiply<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpOver<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpOverlay<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpScreen<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpSubtract<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpSoftlight<_Traits_>(cs));
//cs->addCompositeOp(new KoCompositeOpHardlight<_Traits_>(cs));
typedef typename _Traits_::channels_type channels_type;
static const bool useGeneralOps = true;
static const bool useHSLOps = boost::is_base_of<KoRgbTraits<channels_type>, _Traits_>::value;
static const bool useRGBOps = boost::is_base_of<KoRgbTraits<channels_type>, _Traits_>::value;
Private::AddGeneralOps<_Traits_, useGeneralOps>::add(cs);
Private::AddRGBOps <_Traits_, useHSLOps >::add(cs);
_Private::AddGeneralOps<_Traits_, useGeneralOps>::add(cs);
_Private::AddRGBOps <_Traits_, useRGBOps >::add(cs);
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment