2
* $Id: CMP_flip.c 12931 2007-12-17 18:20:48Z theeth $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2006 Blender Foundation.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#include "../CMP_util.h"
32
/* **************** Flip ******************** */
33
static bNodeSocketType cmp_node_flip_in[]= {
34
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
38
static bNodeSocketType cmp_node_flip_out[]= {
39
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
43
static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
46
CompBuf *cbuf= in[0]->data;
47
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* note, this returns zero'd image */
48
int i, src_pix, src_width, src_height, srcydelt, outydelt, x, y;
55
outfp= stackbuf->rect;
56
srcydelt= src_width*src_pix;
59
if(node->custom1) { /*set up output pointer for y flip*/
60
outfp+= (src_height-1)*outydelt;
64
for(y=0; y<src_height; y++) {
65
if(node->custom1 == 1) { /* no x flip so just copy line*/
66
memcpy(outfp, srcfp, sizeof(float) * src_pix * src_width);
70
outfp += (src_width-1)*src_pix;
71
for(x=0; x<src_width; x++) {
72
for(i=0; i<src_pix; i++) {
83
out[0]->data= stackbuf;
88
bNodeType cmp_node_flip= {
89
/* *next,*prev */ NULL, NULL,
90
/* type code */ CMP_NODE_FLIP,
92
/* width+range */ 140, 100, 320,
93
/* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
94
/* input sock */ cmp_node_flip_in,
95
/* output sock */ cmp_node_flip_out,
97
/* execfunc */ node_composit_exec_flip,
100
/* freestoragefunc */ NULL,
101
/* copystoragefunc */ NULL,