Blender V4.3
colorspace.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#ifndef __COLORSPACE_H__
6#define __COLORSPACE_H__
7
8#include "util/map.h"
9#include "util/param.h"
10
12
13extern ustring u_colorspace_auto;
14extern ustring u_colorspace_raw;
15extern ustring u_colorspace_srgb;
16
17class ColorSpaceProcessor;
18
20 public:
21 /* Convert used specified colorspace to a colorspace that we are able to
22 * convert to and from. If the colorspace is u_colorspace_auto, we auto
23 * detect a colospace. */
24 static ustring detect_known_colorspace(ustring colorspace,
25 const char *file_colorspace,
26 const char *file_format,
27 bool is_float);
28
29 /* Test if colorspace is for non-color data. */
30 static bool colorspace_is_data(ustring colorspace);
31
32 /* Convert pixels in the specified colorspace to scene linear color for
33 * rendering. Must be a colorspace returned from detect_known_colorspace. */
34 template<typename T>
35 static void to_scene_linear(
36 ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb);
37
38 /* Efficiently convert pixels to scene linear colorspace at render time,
39 * for OSL where the image texture cache contains original pixels. The
40 * handle is valid for the lifetime of the application. */
41 static ColorSpaceProcessor *get_processor(ustring colorspace);
42 static void to_scene_linear(ColorSpaceProcessor *processor, float *pixel, int channels);
43
44 /* Clear memory when the application exits. Invalidates all processors. */
45 static void free_memory();
46
47 /* Create a fallback color space configuration.
48 *
49 * This may be useful to allow regression test to create a configuration which is considered
50 * valid without knowing the actual configuration used by the final application. */
51 static void init_fallback_config();
52
53 private:
54 static void is_builtin_colorspace(ustring colorspace, bool &is_no_op, bool &is_srgb);
55};
56
58
59#endif /* __COLORSPACE_H__ */
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
static bool colorspace_is_data(ustring colorspace)
static ustring detect_known_colorspace(ustring colorspace, const char *file_colorspace, const char *file_format, bool is_float)
static void to_scene_linear(ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb)
static void free_memory()
static ColorSpaceProcessor * get_processor(ustring colorspace)
static void init_fallback_config()
CCL_NAMESPACE_BEGIN ustring u_colorspace_auto
ustring u_colorspace_raw
ustring u_colorspace_srgb
#define CCL_NAMESPACE_END
#define T