Marble

BlendingFactory.cpp
1// SPDX-FileCopyrightText: 2010 Jens-Michael Hoffmann <jmho@c-xx.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#include "BlendingFactory.h"
6
7#include <QDebug>
8
9#include "BlendingAlgorithms.h"
10#include "blendings/SunLightBlending.h"
11
12namespace Marble
13{
14
15void BlendingFactory::setLevelZeroLayout(int levelZeroColumns, int levelZeroRows)
16{
17 m_sunLightBlending->setLevelZeroLayout(levelZeroColumns, levelZeroRows);
18}
19
20Blending const *BlendingFactory::findBlending(QString const &name) const
21{
22 if (name.isEmpty())
23 return nullptr;
24
25 Blending const *const result = m_blendings.value(name, nullptr);
26 if (!result)
27 qWarning() << "Unknown blending" << name << "specified in .dgml file. Please fix the .dgml file.";
28 return result;
29}
30
31BlendingFactory::BlendingFactory(const SunLocator *sunLocator)
32 : m_sunLightBlending(new SunLightBlending(sunLocator))
33{
34 m_blendings.insert(QStringLiteral("OverpaintBlending"), new OverpaintBlending);
35
36 // Neutral blendings
37 m_blendings.insert(QStringLiteral("AllanonBlending"), new AllanonBlending);
38 m_blendings.insert(QStringLiteral("ArcusTangentBlending"), new ArcusTangentBlending);
39 m_blendings.insert(QStringLiteral("GeometricMeanBlending"), new GeometricMeanBlending);
40 m_blendings.insert(QStringLiteral("LinearLightBlending"), new LinearLightBlending);
41 // m_blendings.insert( "NoiseBlending", new NoiseBlending );
42 m_blendings.insert(QStringLiteral("OverlayBlending"), new OverlayBlending);
43 // m_blendings.insert( "ParallelBlending"), new ParallelBlending );
44 // m_blendings.insert( "TextureBlending"), new TextureBlending );
45
46 // Darkening blendings
47 m_blendings.insert(QStringLiteral("AlphaBlending"), new OverpaintBlending); // for backwards compatibility
48 m_blendings.insert(QStringLiteral("ColorBurnBlending"), new ColorBurnBlending);
49 m_blendings.insert(QStringLiteral("DarkBlending"), new DarkBlending);
50 m_blendings.insert(QStringLiteral("DarkenBlending"), new DarkenBlending);
51 m_blendings.insert(QStringLiteral("DivideBlending"), new DivideBlending);
52 m_blendings.insert(QStringLiteral("GammaDarkBlending"), new GammaDarkBlending);
53 m_blendings.insert(QStringLiteral("LinearBurnBlending"), new LinearBurnBlending);
54 m_blendings.insert(QStringLiteral("MultiplyBlending"), new MultiplyBlending);
55 m_blendings.insert(QStringLiteral("SubtractiveBlending"), new SubtractiveBlending);
56
57 // Lightening blendings
58 m_blendings.insert(QStringLiteral("AdditiveBlending"), new AdditiveBlending);
59 m_blendings.insert(QStringLiteral("ColorDodgeBlending"), new ColorDodgeBlending);
60 m_blendings.insert(QStringLiteral("GammaLightBlending"), new GammaLightBlending);
61 m_blendings.insert(QStringLiteral("HardLightBlending"), new HardLightBlending);
62 m_blendings.insert(QStringLiteral("LightBlending"), new LightBlending);
63 m_blendings.insert(QStringLiteral("LightenBlending"), new LightenBlending);
64 m_blendings.insert(QStringLiteral("PinLightBlending"), new PinLightBlending);
65 m_blendings.insert(QStringLiteral("ScreenBlending"), new ScreenBlending);
66 m_blendings.insert(QStringLiteral("SoftLightBlending"), new SoftLightBlending);
67 m_blendings.insert(QStringLiteral("VividLightBlending"), new VividLightBlending);
68
69 // Inverter blendings
70 // m_blendings.insert( "AdditiveSubtractiveBlending", new AdditiveSubtractiveBlending );
71 m_blendings.insert(QStringLiteral("BleachBlending"), new BleachBlending);
72 m_blendings.insert(QStringLiteral("DifferenceBlending"), new DifferenceBlending);
73 m_blendings.insert(QStringLiteral("EquivalenceBlending"), new EquivalenceBlending);
74 m_blendings.insert(QStringLiteral("HalfDifferenceBlending"), new HalfDifferenceBlending);
75
76 // Special purpose blendings
77 m_blendings.insert(QStringLiteral("CloudsBlending"), new CloudsBlending);
78 m_blendings.insert(QStringLiteral("SunLightBlending"), m_sunLightBlending);
79 m_blendings.insert(QStringLiteral("GrayscaleBlending"), new GrayscaleBlending);
80 m_blendings.insert(QStringLiteral("InvertColorBlending"), new InvertColorBlending);
81 m_blendings.insert(QStringLiteral("InvertHueBlending"), new InvertHueBlending);
82}
83
84BlendingFactory::~BlendingFactory()
85{
86 m_blendings.remove(QStringLiteral("SunLightBlending"));
87 delete m_sunLightBlending;
88 qDeleteAll(m_blendings);
89}
90
91}
QString name(StandardAction id)
Binds a QML item to a specific geodetic location in screen coordinates.
T value(const Key &key) const const
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.