File indexing completed on 2025-01-05 03:58:43
0001 // SPDX-FileCopyrightText: 2010 Jens-Michael Hoffmann <jmho@c-xx.com> 0002 // 0003 // SPDX-License-Identifier: LGPL-2.1-or-later 0004 0005 #ifndef MARBLE_BLENDING_ALGORITHMS_H 0006 #define MARBLE_BLENDING_ALGORITHMS_H 0007 0008 #include <QtGlobal> 0009 0010 #include "Blending.h" 0011 0012 namespace Marble 0013 { 0014 0015 class OverpaintBlending: public Blending 0016 { 0017 public: 0018 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0019 }; 0020 0021 class IndependentChannelBlending: public Blending 0022 { 0023 public: 0024 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0025 private: 0026 // bottomColorIntensity: intensity of one color channel (of one pixel) of the bottom image 0027 // topColorIntensity: intensity of one color channel (of one pixel) of the top image 0028 // return: intensity of the color channel (of a given pixel) of the result image 0029 // all color intensity values are in the range 0..1 0030 virtual qreal blendChannel( qreal const bottomColorIntensity, 0031 qreal const topColorIntensity ) const = 0; 0032 }; 0033 0034 0035 // Neutral blendings 0036 0037 class AllanonBlending: public IndependentChannelBlending 0038 { 0039 qreal blendChannel( qreal const bottomColorIntensity, 0040 qreal const topColorIntensity ) const override; 0041 }; 0042 0043 class ArcusTangentBlending: public IndependentChannelBlending 0044 { 0045 qreal blendChannel( qreal const bottomColorIntensity, 0046 qreal const topColorIntensity ) const override; 0047 }; 0048 0049 class GeometricMeanBlending: public IndependentChannelBlending 0050 { 0051 qreal blendChannel( qreal const bottomColorIntensity, 0052 qreal const topColorIntensity ) const override; 0053 }; 0054 0055 class LinearLightBlending: public IndependentChannelBlending 0056 { 0057 qreal blendChannel( qreal const bottomColorIntensity, 0058 qreal const topColorIntensity ) const override; 0059 }; 0060 0061 class NoiseBlending: public Blending // or IndependentChannelBlending? 0062 { 0063 }; 0064 0065 class OverlayBlending: public IndependentChannelBlending 0066 { 0067 qreal blendChannel( qreal const bottomColorIntensity, 0068 qreal const topColorIntensity ) const override; 0069 }; 0070 0071 class ParallelBlending: public IndependentChannelBlending 0072 { 0073 qreal blendChannel( qreal const bottomColorIntensity, 0074 qreal const topColorIntensity ) const override; 0075 }; 0076 0077 class TextureBlending: public IndependentChannelBlending 0078 { 0079 qreal blendChannel( qreal const bottomColorIntensity, 0080 qreal const topColorIntensity ) const override; 0081 }; 0082 0083 0084 // Darkening blendings 0085 0086 class ColorBurnBlending: public IndependentChannelBlending 0087 { 0088 qreal blendChannel( qreal const bottomColorIntensity, 0089 qreal const topColorIntensity ) const override; 0090 }; 0091 0092 class DarkBlending: public IndependentChannelBlending 0093 { 0094 qreal blendChannel( qreal const bottomColorIntensity, 0095 qreal const topColorIntensity ) const override; 0096 }; 0097 0098 class DarkenBlending: public IndependentChannelBlending 0099 { 0100 qreal blendChannel( qreal const bottomColorIntensity, 0101 qreal const topColorIntensity ) const override; 0102 }; 0103 0104 class DivideBlending: public IndependentChannelBlending 0105 { 0106 qreal blendChannel( qreal const bottomColorIntensity, 0107 qreal const topColorIntensity ) const override; 0108 }; 0109 0110 class GammaDarkBlending: public IndependentChannelBlending 0111 { 0112 qreal blendChannel( qreal const bottomColorIntensity, 0113 qreal const topColorIntensity ) const override; 0114 }; 0115 0116 class LinearBurnBlending: public IndependentChannelBlending 0117 { 0118 qreal blendChannel( qreal const bottomColorIntensity, 0119 qreal const topColorIntensity ) const override; 0120 }; 0121 0122 class MultiplyBlending: public IndependentChannelBlending 0123 { 0124 qreal blendChannel( qreal const bottomColorIntensity, 0125 qreal const topColorIntensity ) const override; 0126 }; 0127 0128 class SubtractiveBlending: public IndependentChannelBlending 0129 { 0130 qreal blendChannel( qreal const bottomColorIntensity, 0131 qreal const topColorIntensity ) const override; 0132 }; 0133 0134 0135 // Lightening blendings 0136 0137 class AdditiveBlending: public IndependentChannelBlending 0138 { 0139 qreal blendChannel( qreal const bottomColorIntensity, 0140 qreal const topColorIntensity ) const override; 0141 }; 0142 0143 class ColorDodgeBlending: public IndependentChannelBlending 0144 { 0145 qreal blendChannel( qreal const bottomColorIntensity, 0146 qreal const topColorIntensity ) const override; 0147 }; 0148 0149 class GammaLightBlending: public IndependentChannelBlending 0150 { 0151 qreal blendChannel( qreal const bottomColorIntensity, 0152 qreal const topColorIntensity ) const override; 0153 }; 0154 0155 class HardLightBlending: public IndependentChannelBlending 0156 { 0157 qreal blendChannel( qreal const bottomColorIntensity, 0158 qreal const topColorIntensity ) const override; 0159 }; 0160 0161 class LightBlending: public IndependentChannelBlending 0162 { 0163 qreal blendChannel( qreal const bottomColorIntensity, 0164 qreal const topColorIntensity ) const override; 0165 }; 0166 0167 class LightenBlending: public IndependentChannelBlending 0168 { 0169 qreal blendChannel( qreal const bottomColorIntensity, 0170 qreal const topColorIntensity ) const override; 0171 }; 0172 0173 class PinLightBlending: public IndependentChannelBlending 0174 { 0175 qreal blendChannel( qreal const bottomColorIntensity, 0176 qreal const topColorIntensity ) const override; 0177 }; 0178 0179 class ScreenBlending: public IndependentChannelBlending 0180 { 0181 qreal blendChannel( qreal const bottomColorIntensity, 0182 qreal const topColorIntensity ) const override; 0183 }; 0184 0185 class SoftLightBlending: public IndependentChannelBlending 0186 { 0187 qreal blendChannel( qreal const bottomColorIntensity, 0188 qreal const topColorIntensity ) const override; 0189 }; 0190 0191 class VividLightBlending: public IndependentChannelBlending 0192 { 0193 qreal blendChannel( qreal const bottomColorIntensity, 0194 qreal const topColorIntensity ) const override; 0195 }; 0196 0197 0198 // Inverter blendings 0199 0200 class AdditiveSubtractiveBlending: public IndependentChannelBlending 0201 { 0202 qreal blendChannel( qreal const bottomColorIntensity, 0203 qreal const topColorIntensity ) const override; 0204 }; 0205 0206 class BleachBlending: public IndependentChannelBlending 0207 { 0208 qreal blendChannel( qreal const bottomColorIntensity, 0209 qreal const topColorIntensity ) const override; 0210 }; 0211 0212 class DifferenceBlending: public IndependentChannelBlending 0213 { 0214 qreal blendChannel( qreal const bottomColorIntensity, 0215 qreal const topColorIntensity ) const override; 0216 }; 0217 0218 class EquivalenceBlending: public IndependentChannelBlending 0219 { 0220 qreal blendChannel( qreal const bottomColorIntensity, 0221 qreal const topColorIntensity ) const override; 0222 }; 0223 0224 class HalfDifferenceBlending: public IndependentChannelBlending 0225 { 0226 qreal blendChannel( qreal const bottomColorIntensity, 0227 qreal const topColorIntensity ) const override; 0228 }; 0229 0230 0231 // Special purpose blendings 0232 0233 class CloudsBlending: public Blending 0234 { 0235 public: 0236 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0237 }; 0238 0239 class GrayscaleBlending: public Blending 0240 { 0241 public: 0242 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0243 }; 0244 0245 class InvertColorBlending: public Blending 0246 { 0247 public: 0248 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0249 }; 0250 0251 class InvertHueBlending: public Blending 0252 { 0253 public: 0254 void blend( QImage * const bottom, TextureTile const * const top ) const override; 0255 }; 0256 0257 } 0258 0259 #endif