diff options
author | Robert Holcomb <bob_holcomb@hotmail.com> | 2007-04-13 08:22:32 +0400 |
---|---|---|
committer | Robert Holcomb <bob_holcomb@hotmail.com> | 2007-04-13 08:22:32 +0400 |
commit | 26735a66708885b1f461cde9f1c03307c9d91115 (patch) | |
tree | beaea5ccb912bd431af15cf9a596b8fcd609910f /source/blender/nodes | |
parent | f7738575c94eaf215a95a1169ff3ea16d96862e6 (diff) |
Added gamma, fixed typos in brightness
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/CMP_node.h | 1 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_brightness.c | 14 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_gamma.c | 91 |
3 files changed, 99 insertions, 7 deletions
diff --git a/source/blender/nodes/CMP_node.h b/source/blender/nodes/CMP_node.h index 77e70a3c126..ea15d4dbe73 100644 --- a/source/blender/nodes/CMP_node.h +++ b/source/blender/nodes/CMP_node.h @@ -94,6 +94,7 @@ extern bNodeType cmp_node_displace; extern bNodeType cmp_node_mapuv; extern bNodeType cmp_node_brightcontrast; +extern bNodeType cmp_node_gamma; #endif diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c index bb411a47d34..c87307434b5 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c @@ -33,13 +33,13 @@ /* **************** Brigh and contrsast ******************** */ -static bNodeSocketType cmp_node_brightcontrsast_in[]= { +static bNodeSocketType cmp_node_brightcontrast_in[]= { { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_VALUE, 1, "bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f}, { SOCK_VALUE, 1, "contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f}, { -1, 0, "" } }; -static bNodeSocketType cmp_node_brightcontrsast_out[]= { +static bNodeSocketType cmp_node_brightcontrast_out[]= { { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, { -1, 0, "" } }; @@ -77,7 +77,7 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in) } } -static void node_composit_exec_brightcontrsast(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; @@ -94,16 +94,16 @@ static void node_composit_exec_brightcontrsast(void *data, bNode *node, bNodeSta } } -bNodeType cmp_node_brighcontrast= { +bNodeType cmp_node_brightcontrast= { /* *next,*prev */ NULL, NULL, /* type code */ CMP_NODE_BRIGHTCONTRAST, /* name */ "Bright/Contrast", /* width+range */ 140, 100, 320, /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_brightcontrsast_in, - /* output sock */ cmp_node_brightcontrsast_out, + /* input sock */ cmp_node_brightcontrast_in, + /* output sock */ cmp_node_brightcontrast_out, /* storage */ "", - /* execfunc */ node_composit_exec_brightcontrsast, + /* execfunc */ node_composit_exec_brightcontrast, /* butfunc */ NULL, /* initfunc */ NULL, /* freestoragefunc */ NULL, diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c new file mode 100644 index 00000000000..5d0ab729e08 --- /dev/null +++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c @@ -0,0 +1,91 @@ +/** +* $Id$ +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +* The Original Code is Copyright (C) 2006 Blender Foundation. +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): none yet. +* +* ***** END GPL LICENSE BLOCK ***** + +*/ + +#include "../CMP_util.h" + +/* **************** Gamma Tools ******************** */ + +static bNodeSocketType cmp_node_gamma_in[]= { + { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, + { SOCK_VALUE, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 2.0f}, + { -1, 0, "" } +}; +static bNodeSocketType cmp_node_gamma_out[]= { + { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, + { -1, 0, "" } +}; + +static void do_gamma(bNode *node, float *out, float *in, float *fac) +{ + int i=0; + for(i=0; i<3; i++) { + out[i] = pow(in[i],fac[0]); + } + out[3] = in[3]; +} +static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +{ + /* stack order in: Fac, Image */ + /* stack order out: Image */ + if(out[0]->hasoutput==0) return; + + /* input no image? then only color operation */ + if(in[0]->data==NULL) { + do_gamma(node, out[0]->vec, in[0]->vec, in[1]->vec); + } + else { + /* make output size of input image */ + CompBuf *cbuf= in[0]->data; + CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs + + composit2_pixel_processor(node, stackbuf, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_gamma, CB_RGBA, CB_VAL); + + out[0]->data= stackbuf; + } +} + +bNodeType cmp_node_gamma= { + /* *next,*prev */ NULL, NULL, + /* type code */ CMP_NODE_GAMMA, + /* name */ "Gamma", + /* width+range */ 140, 100, 320, + /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, + /* input sock */ cmp_node_gamma_in, + /* output sock */ cmp_node_gamma_out, + /* storage */ "", + /* execfunc */ node_composit_exec_gamma, + /* butfunc */ NULL, + /* initfunc */ NULL, + /* freestoragefunc */ NULL, + /* copysotragefunc */ NULL, + /* id */ NULL +}; + + |