All pastes #246535 Raw Edit

Anonymous

public text v1 · immutable
#246535 ·published 2006-11-12 09:10 UTC
rendered paste body
/* **************** To Size  ******************** */

static bNodeSocketType cmp_node_tosize_in[]= {
	{	SOCK_RGBA, 1, "Image",			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
	{	SOCK_RGBA, 1, "Image",			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
	{	-1, 0, ""	}
};
static bNodeSocketType cmp_node_tosize_out[]= {
	{	SOCK_RGBA, 0, "Image",			0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
	{	-1, 0, ""	}
};

static void node_composit_exec_tosize(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
	if(in[0]->data && in[1]->data) {
		CompBuf *cbuf= in[0]->data;
		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs
				
		//need to figure out a nice way to set last X and Y to such values that they are "Fac:1.0" just as in alphaOver node (in[0] in that case)
		composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, X, Y, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL);
		out[0]->data= stackbuf;
	}
}

static bNodeType cmp_node_tosize= {
	/* type code   */	CMP_NODE_TOSIZE,
	/* name        */	"To Size",
	/* width+range */	140, 100, 320,
	/* class+opts  */	NODE_CLASS_CONVERTOR, NODE_OPTIONS,
	/* input sock  */	cmp_node_tosize_in,
	/* output sock */	cmp_node_tosize_out,
	/* storage     */	"",
	/* execfunc    */	node_composit_exec_tosize
};