ai_color_managers.h
Go to the documentation of this file.
1// Copyright 2021 Autodesk, Inc. All rights reserved.
2//
3// Use of this software is subject to the terms of the Autodesk license
4// agreement provided at the time of installation or download, or which
5// otherwise accompanies this software in either electronic or hard copy form.
6
12#pragma once
13#include "ai_api.h"
14#include "ai_bbox.h"
15#include "ai_nodes.h"
16
17#include <stddef.h>
18
20 AtChannelLayout(uint8_t ct, uint8_t t, size_t x, size_t y) : channel_type(ct), type(t), x_stride(x), y_stride(y) { }
21 uint8_t channel_type;
22 uint8_t type;
23 size_t x_stride;
24 size_t y_stride;
25};
26
36 bool (*ColorManagerTransform)(AtNode*, AtString, bool, bool, const AtBBox2*,
37 void*, const AtChannelLayout*, void*, const AtChannelLayout*);
38 void (*ColorManagerGetDefaults)(AtNode*, AtString&, AtString&);
39 bool (*ColorManagerGetChromaticities)(AtNode*, AtString, float*);
40 void (*ColorManagerGetCustomAttributes)(AtNode*, AtString, int&, const char**);
41 int (*ColorManagerGetNumColorSpaces)(AtNode*, AtString);
42 AtString (*ColorManagerGetColorSpaceNameByIndex)(AtNode*, int i, AtString);
43 int (*ColorManagerGetNumFamilies)(AtNode*);
44 AtString (*ColorManagerGetFamilyNameByIndex)(AtNode*, int);
45 bool (*ColorManagerColorSpaceIsLinear)(AtNode*, AtString);
46};
47
49#define AI_COLOR_MANAGER_NODE_EXPORT_METHODS(tag) \
50AI_INSTANCE_COMMON_METHODS \
51color_manager_transform; \
52color_manager_get_defaults; \
53color_manager_get_chromaticities; \
54color_manager_get_custom_attributes; \
55color_manager_get_num_color_spaces; \
56color_manager_get_color_space_name_by_index; \
57static AtColorManagerNodeMethods ai_color_manager_mtds = { \
58 ColorManagerTransform, \
59 ColorManagerGetDefaults, \
60 ColorManagerGetChromaticities, \
61 ColorManagerGetCustomAttributes, \
62 ColorManagerGetNumColorSpaces, \
63 ColorManagerGetColorSpaceNameByIndex, \
64 NULL, \
65 NULL, \
66 NULL, \
67}; \
68static AtNodeMethods ai_node_mtds = { \
69 &ai_common_mtds, \
70 &ai_color_manager_mtds \
71}; \
72const AtNodeMethods *tag = &ai_node_mtds;
73
88#define color_manager_transform \
89static bool ColorManagerTransform(AtNode* node, AtString color_space, \
90 bool is_output, bool dither, \
91 const AtBBox2* roi, \
92 void* src, const AtChannelLayout* src_layout, \
93 void* dst, const AtChannelLayout* dst_layout)
94
100#define color_manager_get_defaults \
101static void ColorManagerGetDefaults(AtNode* node, AtString &sRGB, AtString &linear)
102
107#define color_manager_get_chromaticities \
108static bool ColorManagerGetChromaticities(AtNode* node, AtString space, float *chromaticities)
109
112#define color_manager_get_custom_attributes \
113static void ColorManagerGetCustomAttributes(AtNode* node, AtString space, int &num, const char **attributes)
114
119#define color_manager_get_num_color_spaces \
120static int ColorManagerGetNumColorSpaces(AtNode *node, AtString family)
121
126#define color_manager_get_color_space_name_by_index \
127static AtString ColorManagerGetColorSpaceNameByIndex(AtNode *node, int i, AtString family)
128
133#define color_manager_get_num_families \
134static int ColorManagerGetNumFamilies(AtNode *node); \
135AI_OPTIONAL_METHOD_INSTALL(ai_color_manager_mtds, ColorManagerGetNumFamilies) \
136static int ColorManagerGetNumFamilies(AtNode *node)
137
142#define color_manager_get_family_name_by_index \
143static AtString ColorManagerGetFamilyNameByIndex(AtNode *node, int i); \
144AI_OPTIONAL_METHOD_INSTALL(ai_color_manager_mtds, ColorManagerGetFamilyNameByIndex) \
145static AtString ColorManagerGetFamilyNameByIndex(AtNode *node, int i)
146
151#define color_manager_color_space_is_linear \
152static bool ColorManagerColorSpaceIsLinear(AtNode *node, AtString cs); \
153AI_OPTIONAL_METHOD_INSTALL(ai_color_manager_mtds, ColorManagerColorSpaceIsLinear) \
154static bool ColorManagerColorSpaceIsLinear(AtNode *node, AtString cs)
155
156
157
158AI_API bool AiColorManagerTransform(AtNode* node, AtString name,
159 bool is_output = true, bool dither = false,
160 const AtBBox2* roi = NULL,
161 void* src = NULL, const AtChannelLayout* src_layout = NULL,
162 void* dst = NULL, const AtChannelLayout* dst_layout = NULL);
163AI_API void AiColorManagerGetDefaults(AtNode* node, AtString &sRGB, AtString &linear);
164AI_API bool AiColorManagerGetChromaticities(AtNode* node, AtString space, float *chromaticities);
165AI_API void AiColorManagerGetCustomAttributes(AtNode* node, AtString space, int &num, const char **attributes);
166AI_API int AiColorManagerGetNumColorSpaces(AtNode *node, AtString family = AtString());
168AI_API int AiColorManagerGetNumFamilies(AtNode *node);
171
DLL export prefix for API functions (necessary for multi-platform development)
Axis-aligned bounding box types and utilities.
AtNode struct and methods.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
AI_API bool AiColorManagerGetChromaticities(AtNode *node, AtString space, float *chromaticities)
Get the chromaticities for a color space.
Definition: ai_color_managers.cpp:233
AI_API int AiColorManagerGetNumColorSpaces(AtNode *node, AtString family=AtString())
Get how many color spaces are available (for a "family" if specified)
Definition: ai_color_managers.cpp:301
AI_API AtString AiColorManagerGetColorSpaceNameByIndex(AtNode *node, int i, AtString family=AtString())
Get the name of a color space by index (for a "family" if specified)
Definition: ai_color_managers.cpp:332
AI_API bool AiColorManagerColorSpaceIsLinear(AtNode *node, AtString cs)
Return if a given color space is linear according to the color manager.
Definition: ai_color_managers.cpp:415
AI_API AtString AiColorManagerGetFamilyNameByIndex(AtNode *node, int i)
Get the name of a color space family by index.
Definition: ai_color_managers.cpp:388
AI_API void AiColorManagerGetDefaults(AtNode *node, AtString &sRGB, AtString &linear)
Get the default linear color space used for rendering and for narrow image formats IO.
Definition: ai_color_managers.cpp:194
AI_API int AiColorManagerGetNumFamilies(AtNode *node)
Get how many color space families are available.
Definition: ai_color_managers.cpp:361
AI_API bool AiColorManagerTransform(AtNode *node, AtString name, bool is_output=true, bool dither=false, const AtBBox2 *roi=NULL, void *src=NULL, const AtChannelLayout *src_layout=NULL, void *dst=NULL, const AtChannelLayout *dst_layout=NULL)
Transform to or from the specified color space.
Definition: ai_color_managers.cpp:52
AI_API void AiColorManagerGetCustomAttributes(AtNode *node, AtString space, int &num, const char **attributes)
Get custom attributes to include in output file for the given color space, this includes ICC profile,...
Definition: ai_color_managers.cpp:268
2D axis-aligned bounding box (uses integers)
Definition: ai_bbox.h:169
Definition: ai_color_managers.h:19
Color Manager Node methods structure.
Definition: ai_color_managers.h:35
This represents a node in Arnold.

© 2022 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com