~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/nodes/intern/CMP_util.h

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * $Id: CMP_util.h,v 1.5 2007/04/04 13:58:11 jesterking Exp $
 
3
 *
 
4
 * ***** BEGIN GPL LICENSE BLOCK *****
 
5
 *
 
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. 
 
10
 *
 
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.
 
15
 *
 
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.
 
19
 *
 
20
 * The Original Code is Copyright (C) 2006 Blender Foundation.
 
21
 * All rights reserved.
 
22
 *
 
23
 * The Original Code is: all of this file.
 
24
 *
 
25
 * Contributor(s): none yet.
 
26
 *
 
27
 * ***** END GPL LICENSE BLOCK *****
 
28
 */
 
29
 
 
30
#ifndef CMP_NODE_UTILS_H_
 
31
#define CMP_NODE_UTILS_H_
 
32
 
 
33
#include <stdlib.h>
 
34
#include <string.h>
 
35
#include <math.h>
 
36
 
 
37
#include "MEM_guardedalloc.h"
 
38
 
 
39
#include "DNA_camera_types.h" /* qdn: defocus node, need camera info */
 
40
#include "DNA_action_types.h"
 
41
#include "DNA_color_types.h"
 
42
#include "DNA_ipo_types.h"
 
43
#include "DNA_ID.h"
 
44
#include "DNA_image_types.h"
 
45
#include "DNA_material_types.h"
 
46
#include "DNA_node_types.h"
 
47
#include "DNA_object_types.h"
 
48
#include "DNA_scene_types.h"
 
49
#include "DNA_space_types.h"
 
50
#include "DNA_screen_types.h"
 
51
#include "DNA_texture_types.h"
 
52
#include "DNA_userdef_types.h"
 
53
 
 
54
#include "BKE_blender.h"
 
55
#include "BKE_colortools.h"
 
56
#include "BKE_global.h"
 
57
#include "BKE_image.h"
 
58
#include "BKE_main.h"
 
59
#include "BKE_material.h"
 
60
#include "BKE_texture.h"
 
61
#include "BKE_utildefines.h"
 
62
#include "BKE_library.h"
 
63
 
 
64
#include "../CMP_node.h"
 
65
#include "node_util.h"
 
66
 
 
67
#include "BIF_gl.h"
 
68
#include "BIF_glutil.h"
 
69
#include "BIF_interface.h"
 
70
#include "BIF_interface_icons.h"
 
71
#include "BIF_language.h"
 
72
#include "BIF_mywindow.h"
 
73
#include "BIF_previewrender.h"
 
74
#include "BIF_resources.h"
 
75
#include "BIF_screen.h"
 
76
#include "BIF_space.h"
 
77
 
 
78
#include "BLI_arithb.h"
 
79
#include "BLI_blenlib.h"
 
80
#include "BLI_rand.h"
 
81
#include "BLI_threads.h"
 
82
 
 
83
#include "IMB_imbuf_types.h"
 
84
#include "IMB_imbuf.h"
 
85
 
 
86
#include "BSE_drawipo.h"
 
87
#include "BSE_node.h"
 
88
#include "BSE_view.h"
 
89
 
 
90
#include "RE_pipeline.h"
 
91
#include "RE_shader_ext.h"
 
92
#include "RE_render_ext.h"
 
93
 
 
94
#include "butspace.h"
 
95
#include "blendef.h"
 
96
#include "mydevice.h"
 
97
 
 
98
/* *************************** operations support *************************** */
 
99
 
 
100
/* general signal that's in output sockets, and goes over the wires */
 
101
typedef struct CompBuf {
 
102
        float *rect;
 
103
        int x, y, xrad, yrad;
 
104
        short type, malloc;
 
105
        rcti disprect;          /* cropped part of image */
 
106
        int xof, yof;           /* relative to center of target image */
 
107
        
 
108
        void (*rect_procedural)(struct CompBuf *, float *, float, float);
 
109
        bNode *node;            /* only in use for procedural bufs */
 
110
        
 
111
        struct CompBuf *next, *prev;    /* for pass-on, works nicer than reference counting */
 
112
} CompBuf;
 
113
 
 
114
/* defines also used for pixel size */
 
115
#define CB_RGBA         4
 
116
#define CB_VEC4         4
 
117
#define CB_VEC3         3
 
118
#define CB_VEC2         2
 
119
#define CB_VAL          1
 
120
 
 
121
/* defines for RGBA channels */
 
122
#define CHAN_R  0
 
123
#define CHAN_G  1
 
124
#define CHAN_B  2
 
125
#define CHAN_A  3
 
126
 
 
127
 
 
128
 
 
129
CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc);
 
130
CompBuf *dupalloc_compbuf(CompBuf *cbuf);
 
131
CompBuf *pass_on_compbuf(CompBuf *cbuf);
 
132
void free_compbuf(CompBuf *cbuf);
 
133
void print_compbuf(char *str, CompBuf *cbuf);
 
134
 
 
135
CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type);
 
136
CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy);
 
137
CompBuf *typecheck_compbuf(CompBuf *inbuf, int type);
 
138
float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, int yrad);
 
139
 
 
140
/* **************************************************** */
 
141
 
 
142
/* Pixel-to-Pixel operation, 1 Image in, 1 out */
 
143
void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col,
 
144
                                                                          void (*func)(bNode *, float *, float *), 
 
145
                                                                          int src_type);
 
146
/* Pixel-to-Pixel operation, 2 Images in, 1 out */
 
147
void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, float *src_col,
 
148
                                                                          CompBuf *fac_buf, float *fac, void (*func)(bNode *, float *, float *, float *), 
 
149
                                                                          int src_type, int fac_type);
 
150
 
 
151
/* Pixel-to-Pixel operation, 3 Images in, 1 out */
 
152
void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, float *src1_col, CompBuf *src2_buf, float *src2_col, 
 
153
                                                                          CompBuf *fac_buf, float *fac, void (*func)(bNode *, float *, float *, float *, float *), 
 
154
                                                                          int src1_type, int src2_type, int fac_type);
 
155
 
 
156
/* Pixel-to-Pixel operation, 4 Images in, 1 out */
 
157
void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, float *src1_col, CompBuf *fac1_buf, float *fac1, 
 
158
                                                                          CompBuf *src2_buf, float *src2_col, CompBuf *fac2_buf, float *fac2, 
 
159
                                                                          void (*func)(bNode *, float *, float *, float *, float *, float *), 
 
160
                                                                          int src1_type, int fac1_type, int src2_type, int fac2_type);
 
161
 
 
162
CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel);
 
163
void generate_preview(bNode *node, CompBuf *stackbuf);
 
164
 
 
165
void do_copy_rgba(bNode *node, float *out, float *in);
 
166
void do_copy_rgb(bNode *node, float *out, float *in);
 
167
void do_copy_value(bNode *node, float *out, float *in);
 
168
void do_copy_a_rgba(bNode *node, float *out, float *in, float *fac);
 
169
 
 
170
void do_rgba_to_yuva(bNode *node, float *out, float *in);
 
171
void do_rgba_to_hsva(bNode *node, float *out, float *in);
 
172
void do_rgba_to_ycca(bNode *node, float *out, float *in);
 
173
void do_yuva_to_rgba(bNode *node, float *out, float *in);
 
174
void do_hsva_to_rgba(bNode *node, float *out, float *in);
 
175
void do_ycca_to_rgba(bNode *node, float *out, float *in);
 
176
 
 
177
void gamma_correct_compbuf(CompBuf *img, int inversed);
 
178
 
 
179
extern void node_ID_title_cb(void *node_v, void *unused_v);
 
180
 
 
181
#endif