Blender V5.0
fallback_colorspace.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <string>
8
9#include "OCIO_colorspace.hh"
10
12
13namespace blender::ocio {
14
16 std::string name_;
17
18 public:
19 enum class Type {
23 };
24
25 FallbackColorSpace(const int index, const StringRefNull name, const Type type) : type_(type)
26 {
27 this->index = index;
28 name_ = name;
29 }
30
31 StringRefNull name() const override
32 {
33 return name_;
34 }
35 StringRefNull description() const override
36 {
37 return "";
38 }
39 StringRefNull interop_id() const override
40 {
41 switch (type_) {
42 case Type::LINEAR:
43 return "lin_rec709_scene";
44 case Type::SRGB:
45 return "srgb_rec709_display";
46 case Type::DATA:
47 return "data";
48 }
49
50 return "";
51 }
52
53 bool is_invertible() const override
54 {
55 return true;
56 }
57
58 bool is_scene_linear() const override
59 {
60 return type_ == Type::LINEAR;
61 }
62 bool is_srgb() const override
63 {
64 return type_ == Type::SRGB;
65 }
66
67 bool is_data() const override
68 {
69 return type_ == Type::DATA;
70 }
71
72 bool is_display_referred() const override
73 {
74 return type_ == Type::SRGB;
75 }
76
78 {
79 if (type_ == Type::SRGB) {
81 return &processor;
82 }
83
84 static FallbackNOOPCPUProcessor processor;
85 return &processor;
86 }
87
89 {
90 if (type_ == Type::SRGB) {
92 return &processor;
93 }
94
95 static FallbackNOOPCPUProcessor processor;
96 return &processor;
97 }
98
99 private:
100 Type type_;
101};
102
103} // namespace blender::ocio
StringRefNull description() const override
FallbackColorSpace(const int index, const StringRefNull name, const Type type)
CPUProcessor * get_from_scene_linear_cpu_processor() const override
StringRefNull name() const override
const CPUProcessor * get_to_scene_linear_cpu_processor() const override
StringRefNull interop_id() const override
#define DATA(_y, _x)
FallbackCustomCPUProcessor< linearrgb_to_srgb_v3_v3 > FallbackLinearRGBToSRGBCPUProcessor
FallbackCustomCPUProcessor< srgb_to_linearrgb_v3_v3 > FallbackSRGBToLinearRGBCPUProcessor