From 011e0a93dde724650a6ec6315110c4d6bc615913 Mon Sep 17 00:00:00 2001 From: Juho Vepsalainen Date: Mon, 7 Jan 2008 13:55:48 +0000 Subject: Black and White level inputs to RGB Curves compositing node This commit adds possibility to define black and white level of the mapping curve of the RGB Curves node. This functionality is exactly the same found in the Curves tool of the UV/Image Editor. It can be used to extract wanted color ranges out of the input easily. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Björn C. Schaefer for contribution! --- source/blender/nodes/intern/CMP_nodes/CMP_curves.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index 17d9821a5ef..01af0e1db1d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -22,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Björn C. Schaefer * * ***** END GPL LICENSE BLOCK ***** */ @@ -123,6 +123,8 @@ bNodeType cmp_node_curve_vec= { static bNodeSocketType cmp_node_curve_rgb_in[]= { { SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f}, { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f}, + { SOCK_RGBA, 1, "Black Level", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f}, + { SOCK_RGBA, 1, "White Level", 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f}, { -1, 0, "" } }; @@ -157,7 +159,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac) static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - /* stack order input: fac, image */ + /* stack order input: fac, image, black level, white level */ /* stack order output: image */ if(out[0]->hasoutput==0) @@ -172,6 +174,8 @@ static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **i CompBuf *cbuf= in[1]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */ + curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); + if(in[0]->vec[0] == 1.0) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else -- cgit v1.2.3