diff options
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r-- | source/blender/compositor/intern/COM_Converter.cc | 4 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_MemoryBuffer.cc | 17 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_MemoryBuffer.h | 7 |
3 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index 0af4ff7d98d..1b98a04cf96 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -46,6 +46,7 @@ #include "COM_CombineColorNode.h" #include "COM_CompositorNode.h" #include "COM_ConvertAlphaNode.h" +#include "COM_ConvertColorSpaceNode.h" #include "COM_ConvertOperation.h" #include "COM_Converter.h" #include "COM_CornerPinNode.h" @@ -426,6 +427,9 @@ Node *COM_convert_bnode(bNode *b_node) case CMP_NODE_POSTERIZE: node = new PosterizeNode(b_node); break; + case CMP_NODE_CONVERT_COLOR_SPACE: + node = new ConvertColorSpaceNode(b_node); + break; } return node; } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index ae925f796ee..dcc279e3b88 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -289,6 +289,23 @@ void MemoryBuffer::copy_from(const uchar *src, } } +void MemoryBuffer::apply_processor(ColormanageProcessor &processor, const rcti area) +{ + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + float *out = get_elem(area.xmin, area.ymin); + /* If area allows continuous memory do conversion in one step. Otherwise per row. */ + if (get_width() == width) { + IMB_colormanagement_processor_apply(&processor, out, width, height, get_num_channels(), false); + } + else { + for (int y = 0; y < height; y++) { + IMB_colormanagement_processor_apply(&processor, out, width, 1, get_num_channels(), false); + out += row_stride; + } + } +} + static void colorspace_to_scene_linear(MemoryBuffer *buf, const rcti &area, ColorSpace *colorspace) { const int width = BLI_rcti_size_x(&area); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index dd18a7403da..1765fb93035 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -26,6 +26,8 @@ #include "BLI_math_interp.h" #include "BLI_rect.h" +#include "IMB_colormanagement.h" + struct ImBuf; namespace blender::compositor { @@ -578,6 +580,11 @@ class MemoryBuffer { return state_ == MemoryBufferState::Temporary; } + /** + * \brief Apply a color processor on the given area. + */ + void apply_processor(ColormanageProcessor &processor, const rcti area); + void copy_from(const MemoryBuffer *src, const rcti &area); void copy_from(const MemoryBuffer *src, const rcti &area, int to_x, int to_y); void copy_from(const MemoryBuffer *src, |