Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c100
1 files changed, 49 insertions, 51 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
index cdd360dc0fe..b32c531d8f9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
@@ -74,34 +74,34 @@ static void do_channel_matte(bNode *node, float *out, float *in)
float alpha=0.0;
switch(c->algorithm) {
- case 0: { /* Alpha=key_channel-limit channel */
- int key_channel=node->custom2-1;
- int limit_channel=c->channel-1;
- alpha=in[key_channel]-in[limit_channel];
- break;
- }
- case 1: { /* Alpha=G-MAX(R, B) */
- switch(node->custom2) {
+ case 0: { /* Alpha=key_channel-limit channel */
+ int key_channel=node->custom2-1;
+ int limit_channel=c->channel-1;
+ alpha=in[key_channel]-in[limit_channel];
+ break;
+ }
+ case 1: { /* Alpha=G-MAX(R, B) */
+ switch(node->custom2) {
case 1: {
- alpha=in[0]-MAX2(in[1],in[2]);
- break;
- }
+ alpha=in[0]-MAX2(in[1],in[2]);
+ break;
+ }
case 2: {
- alpha=in[1]-MAX2(in[0],in[2]);
- break;
- }
+ alpha=in[1]-MAX2(in[0],in[2]);
+ break;
+ }
case 3: {
- alpha=in[2]-MAX2(in[0],in[1]);
- break;
- }
+ alpha=in[2]-MAX2(in[0],in[1]);
+ break;
+ }
default:
break;
- }
- }
- default:
- break;
- }
-
+ }
+ }
+ default:
+ break;
+ }
+
/*flip because 0.0 is transparent, not 1.0*/
alpha=1-alpha;
@@ -124,7 +124,6 @@ static void do_channel_matte(bNode *node, float *out, float *in)
else {
out[3]=in[3];
}
-
}
static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
@@ -132,7 +131,7 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
CompBuf *cbuf;
CompBuf *outbuf;
- if(in[0]->hasinput==0) return;
+ if(in[0]->hasinput==0) return;
if(in[0]->data==NULL) return;
if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
@@ -142,24 +141,24 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
/*convert to colorspace*/
switch(node->custom1) {
- case CMP_NODE_CHANNEL_MATTE_CS_RGB:
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
- composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA);
- break;
- default:
- break;
+ case CMP_NODE_CHANNEL_MATTE_CS_RGB:
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_hsva, CB_RGBA);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_rgba_to_yuva, CB_RGBA);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
+ composit1_pixel_processor(node, outbuf, cbuf, in[1]->vec, do_normalized_rgba_to_ycca2, CB_RGBA);
+ break;
+ default:
+ break;
}
/*use the selected channel information to do the key */
composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_channel_matte, CB_RGBA);
-
+
/*convert back to RGB colorspace in place*/
switch(node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB: /*RGB*/
@@ -189,17 +188,17 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
static void node_composit_init_channel_matte(bNode *node)
{
- NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
- node->storage=c;
- c->t1= 1.0f;
- c->t2= 0.0f;
- c->t3= 0.0f;
- c->fsize= 0.0f;
- c->fstrength= 0.0f;
- c->algorithm=1; /*max channel limiting */
- c->channel=1; /* limit by red */
- node->custom1= 1; /* RGB channel */
- node->custom2= 2; /* Green Channel */
+ NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
+ node->storage=c;
+ c->t1= 1.0f;
+ c->t2= 0.0f;
+ c->t3= 0.0f;
+ c->fsize= 0.0f;
+ c->fstrength= 0.0f;
+ c->algorithm=1; /*max channel limiting */
+ c->channel=1; /* limit by red */
+ node->custom1= 1; /* RGB channel */
+ node->custom2= 2; /* Green Channel */
}
void register_node_type_cmp_channel_matte(ListBase *lb)
@@ -215,4 +214,3 @@ void register_node_type_cmp_channel_matte(ListBase *lb)
nodeRegisterType(lb, &ntype);
}
-