Blender  V3.3
colorspace.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __COLORSPACE_H__
5 #define __COLORSPACE_H__
6 
7 #include "util/map.h"
8 #include "util/param.h"
9 
11 
12 extern ustring u_colorspace_auto;
13 extern ustring u_colorspace_raw;
14 extern ustring u_colorspace_srgb;
15 
16 class ColorSpaceProcessor;
17 
19  public:
20  /* Convert used specified colorspace to a colorspace that we are able to
21  * convert to and from. If the colorspace is u_colorspace_auto, we auto
22  * detect a colospace. */
23  static ustring detect_known_colorspace(ustring colorspace,
24  const char *file_format,
25  bool is_float);
26 
27  /* Test if colorspace is for non-color data. */
28  static bool colorspace_is_data(ustring colorspace);
29 
30  /* Convert pixels in the specified colorspace to scene linear color for
31  * rendering. Must be a colorspace returned from detect_known_colorspace. */
32  template<typename T>
33  static void to_scene_linear(
34  ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb);
35 
36  /* Efficiently convert pixels to scene linear colorspace at render time,
37  * for OSL where the image texture cache contains original pixels. The
38  * handle is valid for the lifetime of the application. */
39  static ColorSpaceProcessor *get_processor(ustring colorspace);
40  static void to_scene_linear(ColorSpaceProcessor *processor, float *pixel, int channels);
41 
42  /* Clear memory when the application exits. Invalidates all processors. */
43  static void free_memory();
44 
45  private:
46  static void is_builtin_colorspace(ustring colorspace, bool &is_no_op, bool &is_srgb);
47 };
48 
50 
51 #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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input 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 a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
static bool colorspace_is_data(ustring colorspace)
Definition: colorspace.cpp:72
static void to_scene_linear(ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb)
Definition: colorspace.cpp:350
static void free_memory()
Definition: colorspace.cpp:434
static ColorSpaceProcessor * get_processor(ustring colorspace)
Definition: colorspace.cpp:34
static ustring detect_known_colorspace(ustring colorspace, const char *file_format, bool is_float)
Definition: colorspace.cpp:97
ustring u_colorspace_raw
ustring u_colorspace_srgb
CCL_NAMESPACE_BEGIN ustring u_colorspace_auto
Definition: colorspace.cpp:22
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_gpu_kernel_postfix ccl_global float int num_pixels
#define T