Perceptual Color

rgbcolorspacefactory.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef RGBCOLORSPACEFACTORY_H
5#define RGBCOLORSPACEFACTORY_H
6
7#include "importexport.h"
8#include <qglobal.h>
9#include <qsharedpointer.h>
10#include <qstring.h>
11
12#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
13#include <qcontainerfwd.h>
14#else
15#include <qstringlist.h>
16#endif
17
18namespace PerceptualColor
19{
20class RgbColorSpace;
21
22/** @brief Factory for color space objects.
23 *
24 * These color space objects are needed in the constructors of various classes
25 * of this library.
26 *
27 * Creating color space objects can be slow. But once created, they can be
28 * used simultaneously on various widgets. Thanks to the QSharedPointer, you
29 * can easily create a color space object, pass it to the widget constructors
30 * you like, and then forget about it – it will be deleted automatically when
31 * the last widget that used it has been deleted. And passing the shared
32 * pointer to widget constructors is fast! Usage example:
33 *
34 * @snippet testrgbcolorspacefactory.cpp Create */
36{
37public:
38 // No Q_INVOKABLE here because the class does not inherit QObject:
39 [[nodiscard]] static QSharedPointer<PerceptualColor::RgbColorSpace> createSrgb();
40 [[nodiscard]] static QSharedPointer<PerceptualColor::RgbColorSpace> createFromFile(const QString &fileName);
41 [[nodiscard]] static QStringList colorProfileDirectories();
42
43private:
44 /** @internal
45 *
46 * @brief Private default constructor.
47 *
48 * This class should have no instances, therefore the constructor
49 * is private. */
50 RgbColorSpaceFactory() = default;
51
52 /** @internal
53 *
54 * @brief Only for unit tests. */
55 friend class TestRgbColorSpaceFactory;
56};
57
58} // namespace PerceptualColor
59
60#endif // RGBCOLORSPACEFACTORY_H
Factory for color space objects.
This file provides support for C++ symbol import and export.
#define PERCEPTUALCOLOR_IMPORTEXPORT
A macro that either exports dynamic library symbols or imports dynamic library symbols or does nothin...
The namespace of this library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:36 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.