Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWaylandAPIImageDescriptionCreatorParams.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
12
17
19 KisWaylandAPIColorManager *colorManager)
20 : QtWayland::wp_image_description_creator_params_v1(params)
21 , m_colorManager(colorManager)
22{
23}
25{
26 // object() is null if the information creation has succeeded
27 if (object()) {
28 wp_image_description_creator_params_v1_destroy(object());
29 }
30}
31
33{
34 if (data.tfNamed) {
35 set_tf_named(static_cast<uint32_t>(*data.tfNamed));
36 } else if (data.tfGamma) {
37 Q_ASSERT(m_colorManager->isFeatureSupported(KisWaylandAPIColorManager::feature_set_tf_power));
38 set_tf_power(*data.tfGamma);
39 }
40
41 if (data.namedContainer) {
42 set_primaries_named(static_cast<uint32_t>(*data.namedContainer));
43 } else {
44 Q_ASSERT(m_colorManager->isFeatureSupported(KisWaylandAPIColorManager::feature_set_primaries));
45 set_primaries(std::rint(data.container->red.x * 1'000'000.00),
46 std::rint(data.container->red.y * 1'000'000.00),
47 std::rint(data.container->green.x * 1'000'000.00),
48 std::rint(data.container->green.y * 1'000'000.00),
49 std::rint(data.container->blue.x * 1'000'000.00),
50 std::rint(data.container->blue.y * 1'000'000.00),
51 std::rint(data.container->white.x * 1'000'000.00),
52 std::rint(data.container->white.y * 1'000'000.00));
53 }
54
55 if (data.target) {
56 Q_ASSERT(m_colorManager->isFeatureSupported(KisWaylandAPIColorManager::feature_set_mastering_display_primaries));
57 set_mastering_display_primaries(std::rint(data.target->red.x * 1'000'000.00),
58 std::rint(data.target->red.y * 1'000'000.00),
59 std::rint(data.target->green.x * 1'000'000.00),
60 std::rint(data.target->green.y * 1'000'000.00),
61 std::rint(data.target->blue.x * 1'000'000.00),
62 std::rint(data.target->blue.y * 1'000'000.00),
63 std::rint(data.target->white.x * 1'000'000.00),
64 std::rint(data.target->white.y * 1'000'000.00));
65 }
66
67 if (data.luminances) {
68 Q_ASSERT(m_colorManager->isFeatureSupported(KisWaylandAPIColorManager::feature_set_luminances));
69 set_luminances(data.luminances->minLuminance,
70 data.luminances->maxLuminance,
71 data.luminances->referenceLuminance);
72 }
73
74 if (data.masteringLuminance) {
75 Q_ASSERT(m_colorManager->isFeatureSupported(KisWaylandAPIColorManager::feature_extended_target_volume));
76 set_mastering_luminance(data.masteringLuminance->minLuminance, data.masteringLuminance->maxLuminance);
77 }
78
79 if (data.targetMaxCLL) {
80 set_max_cll(*data.targetMaxCLL);
81 }
82
83 if (data.targetMaxFALL) {
84 set_max_fall(*data.targetMaxFALL);
85 }
86
87 if (data.iccFileIsPresent) {
88 // We do not support ICC files yet
89 qWarning() << "ICC file is not supported yet.";
90 }
91
92 auto result = std::make_unique<KisWaylandAPIImageDescriptionNoInfo>(create());
93
94 init(nullptr);
95
96 return result;
97}
98
99#include <moc_KisWaylandAPIImageDescriptionCreatorParams.cpp>
bool isFeatureSupported(feature f) const
std::unique_ptr< KisWaylandAPIImageDescriptionNoInfo > createImageDescription(const KisSurfaceColorimetry::WaylandSurfaceDescription &data)
KisWaylandAPIImageDescriptionCreatorParams(KisWaylandAPIColorManager *colorManager)
std::optional< KisSurfaceColorimetry::Luminance > luminances
std::optional< KisSurfaceColorimetry::MasteringLuminance > masteringLuminance