Commit b8d64d3d authored by Miguel Lopez's avatar Miguel Lopez Committed by Boudewijn Rempt

Final Series of IMBLEND blending modes, and including modulo modes.

Differential revision: https://phabricator.kde.org/D15584
parent b46ee111
...@@ -249,6 +249,22 @@ public: ...@@ -249,6 +249,22 @@ public:
return (dst_compositetype(a) * KoColorSpaceMathsTraits<_Tdst>::unitValue) / b; return (dst_compositetype(a) * KoColorSpaceMathsTraits<_Tdst>::unitValue) / b;
} }
inline static dst_compositetype modulus(_T a, _Tdst b) {
return (dst_compositetype(a) - floor(dst_compositetype(a)/((b != (KoColorSpaceMathsTraits<_T>::zeroValue - traits::epsilon) ? b : KoColorSpaceMathsTraits<_T>::zeroValue) + traits::epsilon))*(b + traits::epsilon));
}
inline static dst_compositetype xor(_T a, _Tdst b) {
return (int (a * std::numeric_limits<int>::max() - traits::epsilon) ^ int (b * std::numeric_limits<int>::max() - traits::epsilon));
}
inline static dst_compositetype and(_T a, _Tdst b) {
return (int (a * std::numeric_limits<int>::max() - traits::epsilon) & int (b * std::numeric_limits<int>::max() - traits::epsilon));
}
inline static dst_compositetype or(_T a, _Tdst b) {
return (int (a * std::numeric_limits<int>::max() - traits::epsilon) | int (b * std::numeric_limits<int>::max() - traits::epsilon));
}
/** /**
* Inversion : unitValue - a * Inversion : unitValue - a
* @param a * @param a
...@@ -576,6 +592,18 @@ namespace Arithmetic ...@@ -576,6 +592,18 @@ namespace Arithmetic
inline typename KoColorSpaceMathsTraits<T>::compositetype inline typename KoColorSpaceMathsTraits<T>::compositetype
div(T a, T b) { return KoColorSpaceMaths<T>::divide(a, b); } div(T a, T b) { return KoColorSpaceMaths<T>::divide(a, b); }
template<class T>
inline typename KoColorSpaceMathsTraits<T>::compositetype
xor(T a, T b) { return KoColorSpaceMaths<T>::xor(a, b); }
template<class T>
inline typename KoColorSpaceMathsTraits<T>::compositetype
and(T a, T b) { return KoColorSpaceMaths<T>::and(a, b); }
template<class T>
inline typename KoColorSpaceMathsTraits<T>::compositetype
or(T a, T b) { return KoColorSpaceMaths<T>::or(a, b); }
template<class T> template<class T>
inline T clamp(typename KoColorSpaceMathsTraits<T>::compositetype a) { inline T clamp(typename KoColorSpaceMathsTraits<T>::compositetype a) {
return KoColorSpaceMaths<T>::clamp(a); return KoColorSpaceMaths<T>::clamp(a);
...@@ -612,6 +640,13 @@ namespace Arithmetic ...@@ -612,6 +640,13 @@ namespace Arithmetic
inline T blend(T src, T srcAlpha, T dst, T dstAlpha, T cfValue) { inline T blend(T src, T srcAlpha, T dst, T dstAlpha, T cfValue) {
return mul(inv(srcAlpha), dstAlpha, dst) + mul(inv(dstAlpha), srcAlpha, src) + mul(dstAlpha, srcAlpha, cfValue); return mul(inv(srcAlpha), dstAlpha, dst) + mul(inv(dstAlpha), srcAlpha, src) + mul(dstAlpha, srcAlpha, cfValue);
} }
template<class T>
inline T epsilon() { return KoColorSpaceMathsTraits<T>::epsilon; }
template<class T>
inline typename KoColorSpaceMathsTraits<T>::compositetype
mod(T a, T b) { return KoColorSpaceMaths<T>::modulus(a, b); }
} }
struct HSYType struct HSYType
......
...@@ -32,6 +32,8 @@ QString KoCompositeOp::categoryColor() ...@@ -32,6 +32,8 @@ QString KoCompositeOp::categoryColor()
} }
QString KoCompositeOp::categoryArithmetic() { return i18n("Arithmetic"); } QString KoCompositeOp::categoryArithmetic() { return i18n("Arithmetic"); }
QString KoCompositeOp::categoryBinary() { return i18n("Binary"); }
QString KoCompositeOp::categoryModulo() { return i18n("Modulo"); }
QString KoCompositeOp::categoryNegative() { return i18n("Negative"); } QString KoCompositeOp::categoryNegative() { return i18n("Negative"); }
QString KoCompositeOp::categoryLight() { return i18n("Lighten"); } QString KoCompositeOp::categoryLight() { return i18n("Lighten"); }
QString KoCompositeOp::categoryDark() { return i18n("Darken"); } QString KoCompositeOp::categoryDark() { return i18n("Darken"); }
......
...@@ -42,6 +42,8 @@ public: ...@@ -42,6 +42,8 @@ public:
static QString categoryColor(); static QString categoryColor();
static QString categoryArithmetic(); static QString categoryArithmetic();
static QString categoryBinary();
static QString categoryModulo();
static QString categoryNegative(); static QString categoryNegative();
static QString categoryLight(); static QString categoryLight();
static QString categoryDark(); static QString categoryDark();
......
This diff is collapsed.
...@@ -42,6 +42,16 @@ const QString COMPOSITE_DESTINATION_IN = "destination-in"; ...@@ -42,6 +42,16 @@ const QString COMPOSITE_DESTINATION_IN = "destination-in";
const QString COMPOSITE_DESTINATION_ATOP = "destination-atop"; const QString COMPOSITE_DESTINATION_ATOP = "destination-atop";
const QString COMPOSITE_XOR = "xor"; const QString COMPOSITE_XOR = "xor";
const QString COMPOSITE_OR = "or";
const QString COMPOSITE_AND = "and";
const QString COMPOSITE_NAND = "nand";
const QString COMPOSITE_NOR = "nor";
const QString COMPOSITE_XNOR = "xnor";
const QString COMPOSITE_IMPLICATION = "implication";
const QString COMPOSITE_NOT_IMPLICATION = "not_implication";
const QString COMPOSITE_CONVERSE = "converse";
const QString COMPOSITE_NOT_CONVERSE = "not_converse";
const QString COMPOSITE_PLUS = "plus"; const QString COMPOSITE_PLUS = "plus";
const QString COMPOSITE_MINUS = "minus"; const QString COMPOSITE_MINUS = "minus";
const QString COMPOSITE_ADD = "add"; const QString COMPOSITE_ADD = "add";
...@@ -53,6 +63,14 @@ const QString COMPOSITE_DIVIDE = "divide"; ...@@ -53,6 +63,14 @@ const QString COMPOSITE_DIVIDE = "divide";
const QString COMPOSITE_ARC_TANGENT = "arc_tangent"; const QString COMPOSITE_ARC_TANGENT = "arc_tangent";
const QString COMPOSITE_GEOMETRIC_MEAN = "geometric_mean"; const QString COMPOSITE_GEOMETRIC_MEAN = "geometric_mean";
const QString COMPOSITE_ADDITIVE_SUBTRACTIVE = "additive_subtractive"; const QString COMPOSITE_ADDITIVE_SUBTRACTIVE = "additive_subtractive";
const QString COMPOSITE_NEGATION = "negation";
const QString COMPOSITE_MOD = "modulo";
const QString COMPOSITE_MOD_CON = "modulo_continuous";
const QString COMPOSITE_DIVISIVE_MOD = "divisive_modulo";
const QString COMPOSITE_DIVISIVE_MOD_CON = "divisive_modulo_continuous";
const QString COMPOSITE_MODULO_SHIFT = "modulo_shift";
const QString COMPOSITE_MODULO_SHIFT_CON = "modulo_shift_continuous";
const QString COMPOSITE_EQUIVALENCE = "equivalence"; const QString COMPOSITE_EQUIVALENCE = "equivalence";
const QString COMPOSITE_ALLANON = "allanon"; const QString COMPOSITE_ALLANON = "allanon";
...@@ -66,23 +84,44 @@ const QString COMPOSITE_OVERLAY = "overlay"; ...@@ -66,23 +84,44 @@ const QString COMPOSITE_OVERLAY = "overlay";
const QString COMPOSITE_BEHIND = "behind"; const QString COMPOSITE_BEHIND = "behind";
const QString COMPOSITE_GREATER = "greater"; const QString COMPOSITE_GREATER = "greater";
const QString COMPOSITE_HARD_OVERLAY = "hard overlay"; const QString COMPOSITE_HARD_OVERLAY = "hard overlay";
const QString COMPOSITE_INTERPOLATION = "interpolation";
const QString COMPOSITE_INTERPOLATIONB = "interpolation 2x";
const QString COMPOSITE_PENUMBRAA = "penumbra a";
const QString COMPOSITE_PENUMBRAB = "penumbra b";
const QString COMPOSITE_PENUMBRAC = "penumbra c";
const QString COMPOSITE_PENUMBRAD = "penumbra d";
const QString COMPOSITE_DARKEN = "darken"; const QString COMPOSITE_DARKEN = "darken";
const QString COMPOSITE_BURN = "burn";//this is also known as 'color burn'. const QString COMPOSITE_BURN = "burn";//this is also known as 'color burn'.
const QString COMPOSITE_BURN_LOGARITHMIC = "burn_logarithmic";
const QString COMPOSITE_LINEAR_BURN = "linear_burn"; const QString COMPOSITE_LINEAR_BURN = "linear_burn";
const QString COMPOSITE_GAMMA_DARK = "gamma_dark"; const QString COMPOSITE_GAMMA_DARK = "gamma_dark";
const QString COMPOSITE_SHADE_IFS_ILLUSIONS = "shade_ifs_illusions";
const QString COMPOSITE_FOG_DARKEN_IFS_ILLUSIONS = "fog_darken_ifs_illusions";
const QString COMPOSITE_EASY_BURN = "easy burn";
const QString COMPOSITE_LIGHTEN = "lighten"; const QString COMPOSITE_LIGHTEN = "lighten";
const QString COMPOSITE_DODGE = "dodge"; const QString COMPOSITE_DODGE = "dodge";
const QString COMPOSITE_DODGE_LOGARITHMIC = "dodge_logarithmic";
const QString COMPOSITE_LINEAR_DODGE = "linear_dodge"; const QString COMPOSITE_LINEAR_DODGE = "linear_dodge";
const QString COMPOSITE_SCREEN = "screen"; const QString COMPOSITE_SCREEN = "screen";
const QString COMPOSITE_HARD_LIGHT = "hard_light"; const QString COMPOSITE_HARD_LIGHT = "hard_light";
const QString COMPOSITE_SOFT_LIGHT_IFS_ILLUSIONS = "soft_light_ifs_illusions";
const QString COMPOSITE_SOFT_LIGHT_PEGTOP_DELPHI = "soft_light_pegtop_delphi";
const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP = "soft_light"; const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP = "soft_light";
const QString COMPOSITE_SOFT_LIGHT_SVG = "soft_light_svg"; const QString COMPOSITE_SOFT_LIGHT_SVG = "soft_light_svg";
const QString COMPOSITE_GAMMA_LIGHT = "gamma_light"; const QString COMPOSITE_GAMMA_LIGHT = "gamma_light";
const QString COMPOSITE_GAMMA_ILLUMINATION = "gamma_illumination";
const QString COMPOSITE_VIVID_LIGHT = "vivid_light"; const QString COMPOSITE_VIVID_LIGHT = "vivid_light";
const QString COMPOSITE_FLAT_LIGHT = "flat_light";
const QString COMPOSITE_LINEAR_LIGHT = "linear light"; const QString COMPOSITE_LINEAR_LIGHT = "linear light";
const QString COMPOSITE_PIN_LIGHT = "pin_light"; const QString COMPOSITE_PIN_LIGHT = "pin_light";
const QString COMPOSITE_PNORM_A = "pnorm_a";
const QString COMPOSITE_PNORM_B = "pnorm_b";
const QString COMPOSITE_SUPER_LIGHT = "super_light";
const QString COMPOSITE_TINT_IFS_ILLUSIONS = "tint_ifs_illusions";
const QString COMPOSITE_FOG_LIGHTEN_IFS_ILLUSIONS = "fog_lighten_ifs_illusions";
const QString COMPOSITE_EASY_DODGE = "easy dodge";
const QString COMPOSITE_HUE = "hue"; const QString COMPOSITE_HUE = "hue";
const QString COMPOSITE_COLOR = "color"; const QString COMPOSITE_COLOR = "color";
...@@ -142,6 +181,11 @@ const QString COMPOSITE_REFLECT = "reflect"; ...@@ -142,6 +181,11 @@ const QString COMPOSITE_REFLECT = "reflect";
const QString COMPOSITE_GLOW = "glow"; const QString COMPOSITE_GLOW = "glow";
const QString COMPOSITE_FREEZE = "freeze"; const QString COMPOSITE_FREEZE = "freeze";
const QString COMPOSITE_HEAT = "heat"; const QString COMPOSITE_HEAT = "heat";
const QString COMPOSITE_GLEAT = "glow_heat";
const QString COMPOSITE_HELOW = "heat_glow";
const QString COMPOSITE_REEZE = "reflect_freeze";
const QString COMPOSITE_FRECT = "freeze_reflect";
const QString COMPOSITE_FHYRD = "heat_glow_freeze_reflect_hybrid";
......
This diff is collapsed.
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