Commit c1359294 authored by Silvio Heinrich's avatar Silvio Heinrich

Added global CompositeOp registry.

parent 1742d8c4
......@@ -17,11 +17,140 @@
* Boston, MA 02110-1301, USA.
*/
#include <kglobal.h>
#include <klocale.h>
#include <KoID.h>
#include <QList>
#include "KoCompositeOp.h"
#include "KoColorSpace.h"
KoCompositeOpRegistry::KoCompositeOpRegistry()
{
m_categories
<< KoID("arithmetic", i18n("Arithmetic"))
<< KoID("dark" , i18n("Darken"))
<< KoID("light" , i18n("Lighten"))
<< KoID("negative" , i18n("Negative"))
<< KoID("mix" , i18n("Mix"))
<< KoID("misc" , i18n("Misc"))
<< KoID("hsy" , i18n("HSY"))
<< KoID("hsi" , i18n("HSI"))
<< KoID("hsl" , i18n("HSL"))
<< KoID("hsv" , i18n("HSV"));
m_categoryMap[m_categories[0].id()] // Arithmetic
<< KoID(COMPOSITE_ADD , i18n("Addition"))
<< KoID(COMPOSITE_SUBTRACT , i18n("Substract"))
<< KoID(COMPOSITE_MULT , i18n("Multiply"))
<< KoID(COMPOSITE_DIVIDE , i18n("Divide"))
<< KoID(COMPOSITE_INVERSE_SUBTRACT, i18n("Inverse Substract"));
m_categoryMap[m_categories[1].id()] // Darken
<< KoID(COMPOSITE_BURN , i18n("Burn"))
<< KoID(COMPOSITE_LINEAR_BURN, i18n("Linear Burn"))
<< KoID(COMPOSITE_DARKEN , i18n("Darken"))
<< KoID(COMPOSITE_GAMMA_DARK , i18n("Gamma Dark"));
m_categoryMap[m_categories[2].id()] // Lighten
<< KoID(COMPOSITE_DODGE , i18n("Color Dodge"))
<< KoID(COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge"))
<< KoID(COMPOSITE_LIGHTEN , i18n("Lighten"))
<< KoID(COMPOSITE_LINEAR_LIGHT, i18n("Linear Light"))
<< KoID(COMPOSITE_SCREEN , i18n("Screen"))
<< KoID(COMPOSITE_PIN_LIGHT , i18n("Pin Light"))
<< KoID(COMPOSITE_VIVID_LIGHT , i18n("Vivid Light"))
<< KoID(COMPOSITE_HARD_LIGHT , i18n("Hard Light"))
<< KoID(COMPOSITE_SOFT_LIGHT , i18n("Soft Light"))
<< KoID(COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light"));
m_categoryMap[m_categories[3].id()] // Negative
<< KoID(COMPOSITE_DIFF , i18n("Difference"))
<< KoID(COMPOSITE_EQUIVALENCE , i18n("Equivalence"))
<< KoID(COMPOSITE_ADDITIVE_SUBSTRACTIVE, i18n("Additive Substractive"))
<< KoID(COMPOSITE_EXCLUSION , i18n("Exclusion"))
<< KoID(COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent"));
m_categoryMap[m_categories[4].id()] // Mix
<< KoID(COMPOSITE_OVER , i18n("Normal"))
<< KoID(COMPOSITE_OVERLAY , i18n("Overlay"))
<< KoID(COMPOSITE_ERASE , i18n("Erase"))
<< KoID(COMPOSITE_ALPHA_DARKEN , i18n("Alpha Darken"))
<< KoID(COMPOSITE_HARD_MIX , i18n("Hard Mix"))
<< KoID(COMPOSITE_GRAIN_MERGE , i18n("Grain Merge"))
<< KoID(COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract"))
<< KoID(COMPOSITE_PARALLEL , i18n("Parallel"))
<< KoID(COMPOSITE_ALLANON , i18n("Allanon"))
<< KoID(COMPOSITE_GEOMETRIC_MEAN, i18n("Geometric Mean"));
m_categoryMap[m_categories[5].id()] // Misc
<< KoID(COMPOSITE_BUMPMAP , i18n("Bumpmap"))
<< KoID(COMPOSITE_DISSOLVE , i18n("Dissolve"))
<< KoID(COMPOSITE_COPY_RED , i18n("Copy Red"))
<< KoID(COMPOSITE_COPY_GREEN, i18n("Copy Green"))
<< KoID(COMPOSITE_COPY_BLUE , i18n("Copy Blue"));
m_categoryMap[m_categories[6].id()] // HSY
<< KoID(COMPOSITE_COLOR , i18n("Color"))
<< KoID(COMPOSITE_HUE , i18n("Hue"))
<< KoID(COMPOSITE_SATURATION , i18n("Saturation"))
<< KoID(COMPOSITE_LUMINIZE , i18n("Luminosity"))
<< KoID(COMPOSITE_DEC_SATURATION, i18n("Decrease Saturation"))
<< KoID(COMPOSITE_INC_SATURATION, i18n("Increase Saturation"))
<< KoID(COMPOSITE_DEC_LUMINOSITY, i18n("Decrease Luminosity"))
<< KoID(COMPOSITE_INC_LUMINOSITY, i18n("Increase Luminosity"));
m_categoryMap[m_categories[7].id()] // HSI
<< KoID(COMPOSITE_COLOR_HSI , i18n("Color HSI"))
<< KoID(COMPOSITE_HUE_HSI , i18n("Hue HSI"))
<< KoID(COMPOSITE_SATURATION_HSI , i18n("Saturation HSI"))
<< KoID(COMPOSITE_INTENSITY , i18n("Intensity"))
<< KoID(COMPOSITE_DEC_SATURATION_HSI, i18n("Decrease Saturation HSI"))
<< KoID(COMPOSITE_INC_SATURATION_HSI, i18n("Increase Saturation HSI"))
<< KoID(COMPOSITE_DEC_INTENSITY , i18n("Decrease Intensity"))
<< KoID(COMPOSITE_INC_INTENSITY , i18n("Increase Intensity"));
m_categoryMap[m_categories[8].id()] // HSL
<< KoID(COMPOSITE_COLOR_HSL , i18n("Color HSL"))
<< KoID(COMPOSITE_HUE_HSL , i18n("Hue HSL"))
<< KoID(COMPOSITE_SATURATION_HSL , i18n("Saturation HSL"))
<< KoID(COMPOSITE_LIGHTNESS , i18n("Lightness"))
<< KoID(COMPOSITE_DEC_SATURATION_HSL, i18n("Decrease Saturation HSL"))
<< KoID(COMPOSITE_INC_SATURATION_HSL, i18n("Increase Saturation HSL"))
<< KoID(COMPOSITE_DEC_LIGHTNESS , i18n("Decrease Lightness"))
<< KoID(COMPOSITE_INC_LIGHTNESS , i18n("Increase Lightness"));
m_categoryMap[m_categories[9].id()] // HSV
<< KoID(COMPOSITE_COLOR_HSV , i18n("Color HSV"))
<< KoID(COMPOSITE_HUE_HSV , i18n("Hue HSV"))
<< KoID(COMPOSITE_SATURATION_HSV , i18n("Saturation HSV"))
<< KoID(COMPOSITE_VALUE , i18n("Lightness"))
<< KoID(COMPOSITE_DEC_SATURATION_HSV, i18n("Decrease Saturation HSV"))
<< KoID(COMPOSITE_INC_SATURATION_HSV, i18n("Increase Saturation HSV"))
<< KoID(COMPOSITE_DEC_VALUE , i18n("Decrease Value"))
<< KoID(COMPOSITE_INC_VALUE , i18n("Increase Value"));
}
const KoCompositeOpRegistry& KoCompositeOpRegistry::instance()
{
K_GLOBAL_STATIC(KoCompositeOpRegistry, registry);
return *registry;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCompositeOps(const QString& categoryID) const
{
if(m_categoryMap.contains(categoryID))
return m_categoryMap[categoryID];
return KoIDList();
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCategories() const
{
return m_categories;
}
QString KoCompositeOp::categoryColor()
{
return i18n("Color");
......
......@@ -19,8 +19,10 @@
#ifndef KOCOMPOSITEOP_H
#define KOCOMPOSITEOP_H
#include <QString>
#include <klocale.h>
#include <QString>
#include <QList>
#include <QMap>
#include "pigment_export.h"
......@@ -121,6 +123,24 @@ const QString COMPOSITE_NO = "nocomposition";
const QString COMPOSITE_PASS_THROUGH = "pass through"; // XXX: not implemented anywhere yet
const QString COMPOSITE_UNDEF = "undefined";
class KoID;
class PIGMENTCMS_EXPORT KoCompositeOpRegistry
{
typedef QList<KoID> KoIDList;
KoCompositeOpRegistry();
public:
static const KoCompositeOpRegistry& instance();
KoIDList getCompositeOps(const QString& categoryID) const;
KoIDList getCategories() const;
private:
KoIDList m_categories;
QMap<QString,KoIDList> m_categoryMap;
};
/**
* Base for colorspace-specific blending modes.
*/
......
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