Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCompositeOpFunctions.h File Reference
#include <KoColorSpaceMaths.h>
#include <KoCompositeOpGenericFunctorBase.h>
#include <KoCompositeOpClampPolicy.h>
#include <type_traits>
#include <cmath>

Go to the source code of this file.

Classes

struct  CFAdditiveSubtractive< T >
 
struct  CFColor< HSXType, channels_type >
 
struct  CFColorBurn< T >
 
struct  CFColorDodge< T, ClampPolicy >
 
struct  CFDarkerColor< HSXType, channels_type >
 
struct  CFDecreaseLightness< HSXType, channels_type >
 
struct  CFDecreaseSaturation< HSXType, channels_type >
 
struct  CFDivide< T >
 
struct  CFEquivalence< T >
 
struct  CFExclusion< T >
 
struct  CFFlatLight< T >
 
struct  CFFrect< T >
 
struct  CFGammaDark< T >
 
struct  CFGammaIllumination< T >
 
struct  CFGammaLight< T >
 
struct  CFGeometricMean< T >
 
struct  CFGleat< T >
 
struct  CFGrainExtract< T >
 
struct  CFGrainMerge< T >
 
struct  CFHardLight< T >
 
struct  CFHardMix< T, ClampPolicy >
 
struct  CFHardMixPhotoshop< T >
 
struct  CFHardMixSofterPhotoshop< T >
 
struct  CFHardOverlay< T, ClampPolicy >
 
struct  CFHelow< T >
 
struct  CFHue< HSXType, channels_type >
 
struct  CFIncreaseLightness< HSXType, channels_type >
 
struct  CFIncreaseSaturation< HSXType, channels_type >
 
struct  CFInverseSubtract< T >
 
struct  CFLambertLighting< HSXType, channels_type >
 
struct  CFLambertLightingGamma2_2< HSXType, channels_type >
 
struct  CFLighterColor< HSXType, channels_type >
 
struct  CFLightness< HSXType, channels_type >
 
struct  CFLinearBurn< T, ClampPolicy >
 
struct  CFNegation< T >
 
struct  CFOverlay< T >
 
struct  CFParallel< T >
 
struct  CFPenumbraA< T >
 
struct  CFPenumbraB< T >
 
struct  CFPinLight< T >
 
struct  CFReeze< T >
 
struct  CFReorientedNormalMapCombine< channels_type >
 
struct  CFSaturation< HSXType, channels_type >
 
struct  CFSoftLight< T >
 
struct  CFSoftLightSvg< T >
 
struct  CFTangentNormalmap< channels_type >
 
struct  CFTint< HSXType, channels_type >
 
struct  CFVividLight< T, ClampPolicy >
 

Functions

template<class T >
cfAddition (T src, T dst)
 
template<class HSXType , class TReal >
void cfAdditionSAI (TReal src, TReal sa, TReal &dst, TReal &da)
 
template<class T >
cfAllanon (T src, T dst)
 
template<class T >
cfAnd (T src, T dst)
 
template<class T >
cfArcTangent (T src, T dst)
 
template<class T >
cfConverse (T src, T dst)
 
template<class T >
cfDarkenOnly (T src, T dst)
 
template<class T >
cfDifference (T src, T dst)
 
template<class T >
cfDivisiveModulo (T src, T dst)
 
template<class T >
cfDivisiveModuloContinuous (T src, T dst)
 
template<class T >
cfEasyBurn (T src, T dst)
 
template<class T >
cfEasyDodge (T src, T dst)
 
template<class T >
cfFhyrd (T src, T dst)
 
template<class T >
cfFogDarkenIFSIllusions (T src, T dst)
 
template<class T >
cfFogLightenIFSIllusions (T src, T dst)
 
template<class T >
cfFreeze (T src, T dst)
 
template<class T >
cfGlow (T src, T dst)
 
template<class T >
cfHeat (T src, T dst)
 
template<class T >
cfImplies (T src, T dst)
 
template<class T >
cfInterpolation (T src, T dst)
 
template<class T >
cfInterpolationB (T src, T dst)
 
template<class T >
cfLightenOnly (T src, T dst)
 
template<class T >
cfLinearLight (T src, T dst)
 
template<class T >
cfModulo (T src, T dst)
 
template<class T >
cfModuloContinuous (T src, T dst)
 
template<class T >
cfModuloShift (T src, T dst)
 
template<class T >
cfModuloShiftContinuous (T src, T dst)
 
template<class T >
cfMultiply (T src, T dst)
 
template<class T >
cfNand (T src, T dst)
 
template<class T >
cfNor (T src, T dst)
 
template<class T >
cfNotConverse (T src, T dst)
 
template<class T >
cfNotImplies (T src, T dst)
 
template<class T >
cfOr (T src, T dst)
 
template<class T >
cfOver (T src, T dst)
 
template<class T >
cfPenumbraC (T src, T dst)
 
template<class T >
cfPenumbraD (T src, T dst)
 
template<class T >
cfPNormA (T src, T dst)
 
template<class T >
cfPNormB (T src, T dst)
 
template<class T >
cfReflect (T src, T dst)
 
template<class T >
cfScreen (T src, T dst)
 
template<class T >
cfShadeIFSIllusions (T src, T dst)
 
template<class T >
cfSoftLightIFSIllusions (T src, T dst)
 
template<class T >
cfSoftLightPegtopDelphi (T src, T dst)
 
template<class T >
cfSubtract (T src, T dst)
 
template<class T >
cfSuperLight (T src, T dst)
 
template<class T >
cfTintIFSIllusions (T src, T dst)
 
template<class T >
cfXnor (T src, T dst)
 
template<class T >
cfXor (T src, T dst)
 

Function Documentation

◆ cfAddition()

template<class T >
T cfAddition ( T src,
T dst )
inline

Definition at line 406 of file KoCompositeOpFunctions.h.

406 {
407 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
408 return Arithmetic::clamp<T>(composite_type(src) + dst);
409}

◆ cfAdditionSAI()

template<class HSXType , class TReal >
void cfAdditionSAI ( TReal src,
TReal sa,
TReal & dst,
TReal & da )
inline

Definition at line 1336 of file KoCompositeOpFunctions.h.

1337{
1338 using namespace Arithmetic;
1339 typedef typename KoColorSpaceMathsTraits<TReal>::compositetype composite_type;
1340
1341 Q_UNUSED(da);
1342 composite_type newsrc;
1343 newsrc = mul(src, sa);
1344 dst = clamp<TReal>(newsrc + dst);
1345}
T mul(T a, T b)

◆ cfAllanon()

template<class T >
T cfAllanon ( T src,
T dst )
inline

Definition at line 597 of file KoCompositeOpFunctions.h.

597 {
598 using namespace Arithmetic;
599 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
600 // (dst + src) / 2 [or (dst + src) * 0.5]
601 return T((composite_type(src) + dst) * halfValue<T>() / unitValue<T>());
602}

◆ cfAnd()

template<class T >
T cfAnd ( T src,
T dst )
inline

Definition at line 1092 of file KoCompositeOpFunctions.h.

1092 {
1093 using namespace Arithmetic;
1094
1095 return cfNor(inv(src),inv(dst));
1096}
T cfNor(T src, T dst)

References cfNor().

◆ cfArcTangent()

template<class T >
T cfArcTangent ( T src,
T dst )
inline

Definition at line 591 of file KoCompositeOpFunctions.h.

591 {
592 using namespace Arithmetic;
593 return scale<T>(2.0 * atan2(scale<qreal>(src), scale<qreal>(dst)) / Arithmetic::pi);
594}
static const qreal pi
KRITAIMAGE_EXPORT qreal atan2(qreal y, qreal x)
atan2 replacement

References Arithmetic::pi.

◆ cfConverse()

template<class T >
T cfConverse ( T src,
T dst )
inline

Definition at line 1106 of file KoCompositeOpFunctions.h.

1106 {
1107 using namespace Arithmetic;
1108
1109 return cfOr(inv(src),dst);
1110}
T cfOr(T src, T dst)

References cfOr().

◆ cfDarkenOnly()

template<class T >
T cfDarkenOnly ( T src,
T dst )
inline

Definition at line 846 of file KoCompositeOpFunctions.h.

846{ return qMin(src, dst); }

◆ cfDifference()

template<class T >
T cfDifference ( T src,
T dst )
inline

Definition at line 840 of file KoCompositeOpFunctions.h.

840{ return qMax(src,dst) - qMin(src,dst); }

◆ cfDivisiveModulo()

template<class T >
T cfDivisiveModulo ( T src,
T dst )
inline

Definition at line 1252 of file KoCompositeOpFunctions.h.

1252 {
1253 using namespace Arithmetic;
1254 //I have to use 1.00000 as unitValue failed to work for those area.
1255
1256 qreal fsrc = scale<qreal>(src);
1257 qreal fdst = scale<qreal>(dst);
1258
1259 if (fsrc == zeroValue<T>()) {
1260 return scale<T>(mod(((1.0000000000/epsilon<T>()) * fdst),1.0000000000));
1261 }
1262
1263 return scale<T>(mod(((1.0000000000/fsrc) * fdst),1.0000000000));
1264}
KoColorSpaceMathsTraits< T >::compositetype mod(T a, T b)

◆ cfDivisiveModuloContinuous()

template<class T >
T cfDivisiveModuloContinuous ( T src,
T dst )
inline

Definition at line 1267 of file KoCompositeOpFunctions.h.

1267 {
1268 using namespace Arithmetic;
1269
1270 qreal fsrc = scale<qreal>(src);
1271 qreal fdst = scale<qreal>(dst);
1272
1273 if (fdst == zeroValue<T>()) {
1274 return zeroValue<T>();
1275 }
1276
1277 if (fsrc == zeroValue<T>()) {
1278 return cfDivisiveModulo(fsrc,fdst);
1279 }
1280
1281
1282 return scale<T>( int(ceil(fdst/fsrc)) % 2 != 0 ? cfDivisiveModulo(fsrc,fdst) : inv(cfDivisiveModulo(fsrc,fdst)));
1283}
T cfDivisiveModulo(T src, T dst)

References cfDivisiveModulo().

◆ cfEasyBurn()

template<class T >
T cfEasyBurn ( T src,
T dst )
inline

Definition at line 1308 of file KoCompositeOpFunctions.h.

1308 {
1309 using namespace Arithmetic;
1310 // The 13 divided by 15 can be adjusted to taste. See imgblend.m
1311
1312 qreal fsrc = scale<qreal>(src);
1313 qreal fdst = scale<qreal>(dst);
1314
1315
1316 return scale<T>(inv(pow(inv(fsrc != 1.0 ? fsrc : .999999999999),mul(fdst,1.039999999))));
1317}

◆ cfEasyDodge()

template<class T >
T cfEasyDodge ( T src,
T dst )
inline

Definition at line 1293 of file KoCompositeOpFunctions.h.

1293 {
1294 using namespace Arithmetic;
1295 // The 13 divided by 15 can be adjusted to taste. See imgblend.m
1296
1297 qreal fsrc = scale<qreal>(src);
1298 qreal fdst = scale<qreal>(dst);
1299
1300 if (fsrc == 1.0) {
1301 return scale<T>(1.0);}
1302
1303
1304 return scale<T>(pow(fdst,mul(inv(fsrc != 1.0 ? fsrc : .999999999999),1.039999999)));
1305}

◆ cfFhyrd()

template<class T >
T cfFhyrd ( T src,
T dst )
inline

Definition at line 955 of file KoCompositeOpFunctions.h.

955 {
956 using namespace Arithmetic;
957
958 return (cfAllanon(CFFrect<T>::composeChannel(src,dst),
960}
T cfAllanon(T src, T dst)

References cfAllanon().

◆ cfFogDarkenIFSIllusions()

template<class T >
T cfFogDarkenIFSIllusions ( T src,
T dst )
inline

Definition at line 1202 of file KoCompositeOpFunctions.h.

1202 {
1203 using namespace Arithmetic;
1204 //Known as Dark Blending mode found in IFS Illusions. Picked this name because the shading reminds me of fog when overlaying with a gradient.
1205
1206 qreal fsrc = scale<qreal>(src);
1207 qreal fdst = scale<qreal>(dst);
1208
1209 if (fsrc < .5) {
1210 return scale<T>(inv(fsrc)*fsrc+fsrc*fdst);
1211 }
1212
1213 return scale<T>(fsrc*fdst+fsrc-pow(fsrc,2));
1214}

◆ cfFogLightenIFSIllusions()

template<class T >
T cfFogLightenIFSIllusions ( T src,
T dst )
inline

Definition at line 1187 of file KoCompositeOpFunctions.h.

1187 {
1188 using namespace Arithmetic;
1189 //Known as Bright Blending mode found in IFS Illusions. Picked this name because the shading reminds me of fog when overlaying with a gradient.
1190
1191 qreal fsrc = scale<qreal>(src);
1192 qreal fdst = scale<qreal>(dst);
1193
1194 if (fsrc < .5) {
1195 return scale<T>(inv(inv(fsrc)*fsrc)-inv(fdst)*inv(fsrc));
1196 }
1197
1198 return scale<T>(fsrc-inv(fdst)*inv(fsrc)+pow(inv(fsrc),2));
1199}

◆ cfFreeze()

template<class T >
T cfFreeze ( T src,
T dst )
inline

Definition at line 887 of file KoCompositeOpFunctions.h.

887 {
888 using namespace Arithmetic;
889
890 return (cfHeat(dst,src));
891}
T cfHeat(T src, T dst)

References cfHeat().

◆ cfGlow()

template<class T >
T cfGlow ( T src,
T dst )
inline

Definition at line 852 of file KoCompositeOpFunctions.h.

852 {
853 using namespace Arithmetic;
854 // see http://www.pegtop.net/delphi/articles/blendmodes/quadratic.htm for formulas of Quadratic Blending Modes like Glow, Reflect, Freeze, and Heat
855
856 if (dst == unitValue<T>()) {
857 return unitValue<T>();
858 }
859
860 return clamp<T>(div(mul(src, src), inv(dst)));
861}
KoColorSpaceMathsTraits< T >::compositetype div(T a, T b)

◆ cfHeat()

template<class T >
T cfHeat ( T src,
T dst )
inline

Definition at line 872 of file KoCompositeOpFunctions.h.

872 {
873 using namespace Arithmetic;
874
875 if(src == unitValue<T>()) {
876 return unitValue<T>();
877 }
878
879 if(dst == zeroValue<T>()) {
880 return zeroValue<T>();
881 }
882
883 return inv(clamp<T>(div(mul(inv(src), inv(src)),dst)));
884}

◆ cfImplies()

template<class T >
T cfImplies ( T src,
T dst )
inline

Definition at line 1120 of file KoCompositeOpFunctions.h.

1120 {
1121 using namespace Arithmetic;
1122
1123 return cfOr(src,inv(dst));
1124}

References cfOr().

◆ cfInterpolation()

template<class T >
T cfInterpolation ( T src,
T dst )
inline

Definition at line 963 of file KoCompositeOpFunctions.h.

963 {
964 using namespace Arithmetic;
965
966 qreal fsrc = scale<qreal>(src);
967 qreal fdst = scale<qreal>(dst);
968
969 if(dst == zeroValue<T>() && src == zeroValue<T>()) {
970 return zeroValue<T>();
971 }
972
973 return scale<T>(.5f-.25f*cos(pi*(fsrc))-.25f*cos(pi*(fdst)));
974}

◆ cfInterpolationB()

template<class T >
T cfInterpolationB ( T src,
T dst )
inline

Definition at line 977 of file KoCompositeOpFunctions.h.

977 {
978 using namespace Arithmetic;
979
980 return cfInterpolation(cfInterpolation(src,dst),cfInterpolation(src,dst));
981}
T cfInterpolation(T src, T dst)

References cfInterpolation().

◆ cfLightenOnly()

template<class T >
T cfLightenOnly ( T src,
T dst )
inline

Definition at line 849 of file KoCompositeOpFunctions.h.

849{ return qMax(src, dst); }

◆ cfLinearLight()

template<class T >
T cfLinearLight ( T src,
T dst )
inline

Definition at line 605 of file KoCompositeOpFunctions.h.

605 {
606 using namespace Arithmetic;
607 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
608
609 // min(1,max(0,(dst + 2*src)-1))
610 return clamp<T>((composite_type(src) + src + dst) - unitValue<T>());
611}

◆ cfModulo()

template<class T >
T cfModulo ( T src,
T dst )
inline

Definition at line 1217 of file KoCompositeOpFunctions.h.

1217 {
1218 using namespace Arithmetic;
1219
1220 return mod(dst,src);
1221}

◆ cfModuloContinuous()

template<class T >
T cfModuloContinuous ( T src,
T dst )
inline

Definition at line 1286 of file KoCompositeOpFunctions.h.

1286 {
1287 using namespace Arithmetic;
1288
1289 return cfMultiply(cfDivisiveModuloContinuous(src,dst),src);
1290}
T cfMultiply(T src, T dst)
T cfDivisiveModuloContinuous(T src, T dst)

References cfDivisiveModuloContinuous(), and cfMultiply().

◆ cfModuloShift()

template<class T >
T cfModuloShift ( T src,
T dst )
inline

Definition at line 1224 of file KoCompositeOpFunctions.h.

1224 {
1225 using namespace Arithmetic;
1226 qreal fsrc = scale<qreal>(src);
1227 qreal fdst = scale<qreal>(dst);
1228
1229 if (fsrc == 1.0 && fdst == 0.0) {
1230 return scale<T>(0.0);
1231 }
1232
1233
1234 return scale<T>(mod((fdst+fsrc),1.0000000000));
1235}

◆ cfModuloShiftContinuous()

template<class T >
T cfModuloShiftContinuous ( T src,
T dst )
inline

Definition at line 1238 of file KoCompositeOpFunctions.h.

1238 {
1239 using namespace Arithmetic;
1240 //This blending mode do not behave like difference/equivalent with destination layer inverted if you use group layer on addition while the content of group layer contains several addition-mode layers, it works as expected on float images. So, no need to change this.
1241 qreal fsrc = scale<qreal>(src);
1242 qreal fdst = scale<qreal>(dst);
1243
1244 if (fsrc == 1.0 && fdst == 0.0) {
1245 return scale<T>(1.0);
1246 }
1247
1248 return scale<T>((int(ceil(fdst+fsrc)) % 2 != 0) || (fdst == zeroValue<T>()) ? cfModuloShift(fsrc,fdst) : inv(cfModuloShift(fsrc,fdst)));
1249}
T cfModuloShift(T src, T dst)

References cfModuloShift().

◆ cfMultiply()

template<class T >
T cfMultiply ( T src,
T dst )
inline

Definition at line 805 of file KoCompositeOpFunctions.h.

805{ return Arithmetic::mul(src, dst); }

References Arithmetic::mul().

◆ cfNand()

template<class T >
T cfNand ( T src,
T dst )
inline

Definition at line 1071 of file KoCompositeOpFunctions.h.

1071 {
1072 using namespace Arithmetic;
1073
1074 return or(src,dst);
1075}
KoColorSpaceMathsTraits< T >::compositetype or(T a, T b)

◆ cfNor()

template<class T >
T cfNor ( T src,
T dst )
inline

Definition at line 1064 of file KoCompositeOpFunctions.h.

1064 {
1065 using namespace Arithmetic;
1066
1067 return and(src,dst);
1068}
KoColorSpaceMathsTraits< T >::compositetype and(T a, T b)

◆ cfNotConverse()

template<class T >
T cfNotConverse ( T src,
T dst )
inline

Definition at line 1113 of file KoCompositeOpFunctions.h.

1113 {
1114 using namespace Arithmetic;
1115
1116 return cfAnd(src,inv(dst));
1117}
T cfAnd(T src, T dst)

References cfAnd().

◆ cfNotImplies()

template<class T >
T cfNotImplies ( T src,
T dst )
inline

Definition at line 1127 of file KoCompositeOpFunctions.h.

1127 {
1128 using namespace Arithmetic;
1129
1130 return cfAnd(inv(src),dst);
1131}

References cfAnd().

◆ cfOr()

template<class T >
T cfOr ( T src,
T dst )
inline

Definition at line 1099 of file KoCompositeOpFunctions.h.

1099 {
1100 using namespace Arithmetic;
1101
1102 return cfNand(inv(src),inv(dst));
1103}
T cfNand(T src, T dst)

References cfNand().

◆ cfOver()

template<class T >
T cfOver ( T src,
T dst )
inline

Definition at line 795 of file KoCompositeOpFunctions.h.

795{ Q_UNUSED(dst); return src; }

◆ cfPenumbraC()

template<class T >
T cfPenumbraC ( T src,
T dst )
inline

Definition at line 1016 of file KoCompositeOpFunctions.h.

1016 {
1017 using namespace Arithmetic;
1018
1019 return cfPenumbraD(dst,src);
1020}
T cfPenumbraD(T src, T dst)

References cfPenumbraD().

◆ cfPenumbraD()

template<class T >
T cfPenumbraD ( T src,
T dst )
inline

Definition at line 1005 of file KoCompositeOpFunctions.h.

1005 {
1006 using namespace Arithmetic;
1007
1008 if (dst == unitValue<T>()) {
1009 return unitValue<T>();
1010 }
1011
1012 return cfArcTangent(src,inv(dst));
1013}
T cfArcTangent(T src, T dst)

References cfArcTangent().

◆ cfPNormA()

template<class T >
T cfPNormA ( T src,
T dst )
inline

Definition at line 1134 of file KoCompositeOpFunctions.h.

1134 {
1135 using namespace Arithmetic;
1136 //This is also known as P-Norm mode with factor of 2.3333 See IMBLEND image blending mode samples, and please see imblend.m file found on Additional Blending Mode thread at Phabricator. 1/2.3333 is .42875...
1137
1138 return clamp<T>(pow(pow((float)dst, 2.3333333333333333) + pow((float)src, 2.3333333333333333), 0.428571428571434));
1139}

◆ cfPNormB()

template<class T >
T cfPNormB ( T src,
T dst )
inline

Definition at line 1142 of file KoCompositeOpFunctions.h.

1142 {
1143 using namespace Arithmetic;
1144 //This is also known as P-Norm mode with factor of 2.3333 See IMBLEND image blending mode samples, and please see imblend.m file found on Additional Blending Mode thread at Phabricator. 1/2.3333 is .42875...
1145
1146 return clamp<T>(pow(pow(dst,4)+pow(src,4),0.25));
1147}

◆ cfReflect()

template<class T >
T cfReflect ( T src,
T dst )
inline

Definition at line 864 of file KoCompositeOpFunctions.h.

864 {
865 using namespace Arithmetic;
866
867
868 return clamp<T>(cfGlow(dst,src));
869}
T cfGlow(T src, T dst)

References cfGlow().

◆ cfScreen()

template<class T >
T cfScreen ( T src,
T dst )
inline

Definition at line 843 of file KoCompositeOpFunctions.h.

843{ return Arithmetic::unionShapeOpacity(src, dst); }
T unionShapeOpacity(T a, T b)

References Arithmetic::unionShapeOpacity().

◆ cfShadeIFSIllusions()

template<class T >
T cfShadeIFSIllusions ( T src,
T dst )
inline

Definition at line 1176 of file KoCompositeOpFunctions.h.

1176 {
1177 using namespace Arithmetic;
1178 //Known as Shadow Blending mode found in IFS Illusions. Picked this name because it is the opposite of Tint (IFS Illusion Blending mode).
1179
1180 qreal fsrc = scale<qreal>(src);
1181 qreal fdst = scale<qreal>(dst);
1182
1183 return scale<T>(inv((inv(fdst)*fsrc)+sqrt(inv(fsrc))));
1184}

◆ cfSoftLightIFSIllusions()

template<class T >
T cfSoftLightIFSIllusions ( T src,
T dst )
inline

Definition at line 1031 of file KoCompositeOpFunctions.h.

1031 {
1032 using namespace Arithmetic;
1033
1034 qreal fsrc = scale<qreal>(src);
1035 qreal fdst = scale<qreal>(dst);
1036
1037 return scale<T>(pow(fdst,pow(2.0,(mul(2.0,.5f-fsrc)))));
1038}

◆ cfSoftLightPegtopDelphi()

template<class T >
T cfSoftLightPegtopDelphi ( T src,
T dst )
inline

Definition at line 1041 of file KoCompositeOpFunctions.h.

1041 {
1042 using namespace Arithmetic;
1043
1044 return clamp<T>(cfAddition(mul(dst,cfScreen(src,dst)),mul(mul(src,dst),inv(dst))));
1045}
T cfScreen(T src, T dst)
T cfAddition(T src, T dst)

References cfAddition(), and cfScreen().

◆ cfSubtract()

template<class T >
T cfSubtract ( T src,
T dst )
inline

Definition at line 412 of file KoCompositeOpFunctions.h.

412 {
413 using namespace Arithmetic;
414 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
415 return clamp<T>(composite_type(dst) - src);
416}

◆ cfSuperLight()

template<class T >
T cfSuperLight ( T src,
T dst )
inline

Definition at line 1150 of file KoCompositeOpFunctions.h.

1150 {
1151 using namespace Arithmetic;
1152 //4.0 can be adjusted to taste. 4.0 is picked for being the best in terms of contrast and details. See imblend.m file.
1153
1154 qreal fsrc = scale<qreal>(src);
1155 qreal fdst = scale<qreal>(dst);
1156
1157 if (fsrc < .5) {
1158 return scale<T>(inv(pow(pow(inv(fdst),2.875)+pow(inv(2.0*fsrc),2.875),1.0/2.875)));
1159 }
1160
1161 return scale<T>(pow(pow(fdst,2.875)+pow(2.0*fsrc-1.0,2.875),1.0/2.875));
1162}

◆ cfTintIFSIllusions()

template<class T >
T cfTintIFSIllusions ( T src,
T dst )
inline

Definition at line 1165 of file KoCompositeOpFunctions.h.

1165 {
1166 using namespace Arithmetic;
1167 //Known as Light Blending mode found in IFS Illusions. Picked this name because it results into a very strong tint, and has better naming convention.
1168
1169 qreal fsrc = scale<qreal>(src);
1170 qreal fdst = scale<qreal>(dst);
1171
1172 return scale<T>(fsrc*inv(fdst)+sqrt(fdst));
1173}

◆ cfXnor()

template<class T >
T cfXnor ( T src,
T dst )
inline

Definition at line 1085 of file KoCompositeOpFunctions.h.

1085 {
1086 using namespace Arithmetic;
1087
1088 return cfXor(src,inv(dst));
1089}
T cfXor(T src, T dst)

References cfXor().

◆ cfXor()

template<class T >
T cfXor ( T src,
T dst )
inline

Definition at line 1078 of file KoCompositeOpFunctions.h.

1078 {
1079 using namespace Arithmetic;
1080
1081 return xor(src,dst);
1082}
KoColorSpaceMathsTraits< T >::compositetype xor(T a, T b)