static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; if(in[0]->data) { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* note, this returns zero'd image */ float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx; int x, y, yo; rad= (M_PI*in[1]->vec[0])/180.0f; s= sin(rad); c= cos(rad); centx= cbuf->x/2; centy= cbuf->y/2; minx= -centx; maxx= -centx + (float)cbuf->x; miny= -centy; maxy= -centy + (float)cbuf->y; for(y=miny; ycustom1==0){ bilinear_interpolation((ImBuf *)cbuf, (ImBuf *) stackbuf, u, v, x, y); } else if(node->custom1==1){ neareast_interpolation((ImBuf *)cbuf, (ImBuf *) stackbuf, u, v, x, y); } else{ bicubic_interpolation((ImBuf *)cbuf, (ImBuf *) stackbuf, u, v, x, y); } } } /* rotate offset vector too, but why negative rad, ehh?? Has to be replaced with [3][3] matrix once (ton) */ s= sin(-rad); c= cos(-rad); centx= (float)cbuf->xof; centy= (float)cbuf->yof; stackbuf->xof= (int)( c*centx + s*centy); stackbuf->yof= (int)(-s*centx + c*centy); /* pass on output and free */ out[0]->data= stackbuf; if(cbuf!=in[0]->data) free_compbuf(cbuf); } }