Blender V5.0
OCIO_config.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 <memory>
8
11#include "BLI_string_ref.hh"
12
13namespace blender::ocio {
14
15class ColorSpace;
16class Display;
17class Look;
18class CPUProcessor;
19class GPUShaderBinder;
20
22 /* Convert from a colorspace to a display, using the view transform and look. */
27 /* Artistic controls. */
28 float scale = 1.0f;
29 float exponent = 1.0f;
30 float temperature = 6500.0f;
31 float tint = 10.0f;
32 bool use_white_balance = false;
33 /* Writing to a HDR windows buffer. */
34 bool use_hdr_buffer = false;
35 /* Chosen display is HDR. */
36 bool use_hdr_display = false;
37 /* Display transform is being used for image output. */
38 bool is_image_output = false;
39 /* Rather than outputting colors for the specified display, output extended
40 * sRGB colors emulating the specified display. */
42 /* Invert the entire transform. */
43 bool inverse = false;
44};
45
46class Config {
47 public:
48 /* -------------------------------------------------------------------- */
51
52 virtual ~Config() = default;
53
58 static std::unique_ptr<Config> create_from_environment();
59
64 static std::unique_ptr<Config> create_from_file(StringRefNull filename);
65
75 static std::unique_ptr<Config> create_fallback();
76
78
79 /* -------------------------------------------------------------------- */
82
86 virtual float3 get_default_luma_coefs() const = 0;
87
93
98 virtual const char *get_color_space_from_filepath(const char *filepath) const = 0;
99
101
102 /* -------------------------------------------------------------------- */
105
111 virtual const ColorSpace *get_color_space(StringRefNull name) const = 0;
112
116 virtual int get_num_color_spaces() const = 0;
117
122 virtual const ColorSpace *get_color_space_by_index(int index) const = 0;
123
130 virtual const ColorSpace *get_sorted_color_space_by_index(int index) const = 0;
131
136 virtual const ColorSpace *get_color_space_by_interop_id(StringRefNull interop_id) const = 0;
137
143
145
146 /* -------------------------------------------------------------------- */
149
151
153
154 /* -------------------------------------------------------------------- */
157
161 virtual const Display *get_default_display() const = 0;
162
168
172 virtual int get_num_displays() const = 0;
173
178 virtual const Display *get_display_by_index(int index) const = 0;
179
181
182 /* -------------------------------------------------------------------- */
185
191 StringRefNull view) const = 0;
192
194
195 /* -------------------------------------------------------------------- */
198
203 virtual const Look *get_look_by_name(StringRefNull name) const = 0;
204
208 virtual int get_num_looks() const = 0;
209
214 virtual const Look *get_look_by_index(int index) const = 0;
215
217
218 /* -------------------------------------------------------------------- */
221
226 virtual std::shared_ptr<const CPUProcessor> get_display_cpu_processor(
227 const DisplayParameters &display_parameters) const = 0;
228
232 virtual std::shared_ptr<const CPUProcessor> get_cpu_processor(
233 StringRefNull from_colorspace, StringRefNull to_colorspace) const = 0;
234
236
237 /* -------------------------------------------------------------------- */
240
244 virtual const GPUShaderBinder &get_gpu_shader_binder() const = 0;
245
247};
248
249} // namespace blender::ocio
static AppView * view
virtual const Look * get_look_by_name(StringRefNull name) const =0
virtual float3 get_default_luma_coefs() const =0
virtual const Look * get_look_by_index(int index) const =0
virtual void set_scene_linear_role(StringRefNull name)=0
virtual const ColorSpace * get_sorted_color_space_by_index(int index) const =0
virtual int get_num_looks() const =0
virtual const ColorSpace * get_color_space_for_hdr_image(StringRefNull name) const =0
static std::unique_ptr< Config > create_fallback()
Definition config.cc:35
virtual const Display * get_display_by_index(int index) const =0
virtual ~Config()=default
virtual const GPUShaderBinder & get_gpu_shader_binder() const =0
virtual const ColorSpace * get_color_space_by_index(int index) const =0
virtual const ColorSpace * get_display_view_color_space(StringRefNull display, StringRefNull view) const =0
virtual const Display * get_display_by_name(StringRefNull name) const =0
virtual const ColorSpace * get_color_space_by_interop_id(StringRefNull interop_id) const =0
virtual const char * get_color_space_from_filepath(const char *filepath) const =0
virtual int get_num_color_spaces() const =0
virtual std::shared_ptr< const CPUProcessor > get_cpu_processor(StringRefNull from_colorspace, StringRefNull to_colorspace) const =0
virtual const Display * get_default_display() const =0
virtual const ColorSpace * get_color_space(StringRefNull name) const =0
static std::unique_ptr< Config > create_from_environment()
Definition config.cc:15
virtual int get_num_displays() const =0
virtual float3x3 get_xyz_to_scene_linear_matrix() const =0
virtual std::shared_ptr< const CPUProcessor > get_display_cpu_processor(const DisplayParameters &display_parameters) const =0
static std::unique_ptr< Config > create_from_file(StringRefNull filename)
Definition config.cc:24
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
const char * name