~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/BKE_mask.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software Foundation,
 
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * The Original Code is Copyright (C) 2012 Blender Foundation.
 
19
 * All rights reserved.
 
20
 *
 
21
 * Contributor(s): Blender Foundation,
 
22
 *                 Sergey Sharybin,
 
23
 *                 Campbell Barton
 
24
 *
 
25
 * ***** END GPL LICENSE BLOCK *****
 
26
 */
 
27
 
 
28
#ifndef __BKE_MASK_H__
 
29
#define __BKE_MASK_H__
 
30
 
 
31
struct ImageUser;
 
32
struct Image;
 
33
struct ListBase;
 
34
struct Main;
 
35
struct Mask;
 
36
struct MaskParent;
 
37
struct MaskLayer;
 
38
struct MaskLayerShape;
 
39
struct MaskSpline;
 
40
struct MaskSplinePoint;
 
41
struct MaskSplinePointUW;
 
42
struct MovieClip;
 
43
struct MovieClipUser;
 
44
struct Scene;
 
45
 
 
46
struct MaskSplinePoint *BKE_mask_spline_point_array(struct MaskSpline *spline);
 
47
struct MaskSplinePoint *BKE_mask_spline_point_array_from_point(struct MaskSpline *spline, struct MaskSplinePoint *point_ref);
 
48
 
 
49
/* mask layers */
 
50
struct MaskLayer *BKE_mask_layer_new(struct Mask *mask, const char *name);
 
51
struct MaskLayer *BKE_mask_layer_active(struct Mask *mask);
 
52
void BKE_mask_layer_active_set(struct Mask *mask, struct MaskLayer *masklay);
 
53
void BKE_mask_layer_remove(struct Mask *mask, struct MaskLayer *masklay);
 
54
 
 
55
void BKE_mask_layer_free_shapes(struct MaskLayer *masklay);
 
56
void BKE_mask_layer_free(struct MaskLayer *masklay);
 
57
void BKE_mask_layer_free_list(struct ListBase *masklayers);
 
58
void BKE_mask_spline_free(struct MaskSpline *spline);
 
59
struct MaskSpline *BKE_mask_spline_copy(struct MaskSpline *spline);
 
60
void BKE_mask_point_free(struct MaskSplinePoint *point);
 
61
 
 
62
void BKE_mask_layer_unique_name(struct Mask *mask, struct MaskLayer *masklay);
 
63
 
 
64
struct MaskLayer *BKE_mask_layer_copy(struct MaskLayer *layer);
 
65
void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, struct ListBase *masklayers);
 
66
 
 
67
/* splines */
 
68
struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
 
69
void BKE_mask_point_direction_switch(struct MaskSplinePoint *point);
 
70
void BKE_mask_spline_direction_switch(struct MaskLayer *masklay, struct MaskSpline *spline);
 
71
 
 
72
struct BezTriple *BKE_mask_spline_point_next_bezt(struct MaskSpline *spline, struct MaskSplinePoint *points_array,
 
73
                                                  struct MaskSplinePoint *point);
 
74
 
 
75
typedef enum {
 
76
        MASK_PROJ_NEG = -1,
 
77
        MASK_PROJ_ANY = 0,
 
78
        MASK_PROJ_POS = 1
 
79
} eMaskSign;
 
80
float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
81
                                 float start_u, const float co[2], const eMaskSign sign);
 
82
 
 
83
/* point */
 
84
int BKE_mask_point_has_handle(struct MaskSplinePoint *point);
 
85
void BKE_mask_point_handle(struct MaskSplinePoint *point, float handle[2]);
 
86
void BKE_mask_point_set_handle(struct MaskSplinePoint *point, float loc[2], int keep_direction,
 
87
                               float orig_handle[2], float orig_vec[3][3]);
 
88
 
 
89
void BKE_mask_point_segment_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float u, float co[2]);
 
90
void BKE_mask_point_normal(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
91
                           float u, float n[2]);
 
92
float BKE_mask_point_weight_scalar(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
 
93
float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
 
94
struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw);
 
95
void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w);
 
96
 
 
97
void BKE_mask_point_select_set(struct MaskSplinePoint *point, const short do_select);
 
98
void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const short do_select);
 
99
 
 
100
/* general */
 
101
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
 
102
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
 
103
struct Mask *BKE_mask_copy(struct Mask *mask);
 
104
 
 
105
void BKE_mask_free_nolib(struct Mask *mask);
 
106
void BKE_mask_free(struct Main *bmain, struct Mask *mask);
 
107
 
 
108
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
 
109
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
 
110
void BKE_mask_coord_from_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
 
111
void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame_size[2]);
 
112
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
 
113
void BKE_mask_coord_to_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
 
114
 
 
115
/* parenting */
 
116
 
 
117
void BKE_mask_update_display(struct Mask *mask, float ctime);
 
118
 
 
119
void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
 
120
void BKE_mask_evaluate(struct Mask *mask, const float ctime, const int do_newframe);
 
121
void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const int do_newframe);
 
122
void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe);
 
123
void BKE_mask_parent_init(struct MaskParent *parent);
 
124
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
 
125
void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]);
 
126
void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoint *point);
 
127
void BKE_mask_calc_handle_point_auto(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
128
                                     const short do_recalc_length);
 
129
void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
130
                                        struct MaskSplinePoint **r_point_prev, struct MaskSplinePoint **r_point_next);
 
131
void BKE_mask_layer_calc_handles(struct MaskLayer *masklay);
 
132
void BKE_mask_layer_calc_handles_deform(struct MaskLayer *masklay);
 
133
void BKE_mask_calc_handles(struct Mask *mask);
 
134
void BKE_mask_update_deform(struct Mask *mask);
 
135
void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
 
136
 
 
137
/* animation */
 
138
int  BKE_mask_layer_shape_totvert(struct MaskLayer *masklay);
 
139
void BKE_mask_layer_shape_from_mask(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
 
140
void BKE_mask_layer_shape_to_mask(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
 
141
void BKE_mask_layer_shape_to_mask_interp(struct MaskLayer *masklay,
 
142
                                         struct MaskLayerShape *masklay_shape_a,
 
143
                                         struct MaskLayerShape *masklay_shape_b,
 
144
                                         const float fac);
 
145
struct MaskLayerShape *BKE_mask_layer_shape_find_frame(struct MaskLayer *masklay, const int frame);
 
146
int BKE_mask_layer_shape_find_frame_range(struct MaskLayer *masklay, const float frame,
 
147
                                          struct MaskLayerShape **r_masklay_shape_a,
 
148
                                          struct MaskLayerShape **r_masklay_shape_b);
 
149
struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, const int frame);
 
150
void BKE_mask_layer_shape_free(struct MaskLayerShape *masklay_shape);
 
151
struct MaskLayerShape *BKE_mask_layer_shape_varify_frame(struct MaskLayer *masklay, const int frame);
 
152
struct MaskLayerShape *BKE_mask_layer_shape_duplicate(struct MaskLayerShape *masklay_shape);
 
153
void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
 
154
void BKE_mask_layer_shape_sort(struct MaskLayer *masklay);
 
155
 
 
156
int BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index,
 
157
                                            struct MaskSpline **r_masklay_shape, int *r_index);
 
158
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline);
 
159
 
 
160
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
 
161
                                       int do_init, int do_init_interpolate);
 
162
 
 
163
void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count);
 
164
 
 
165
int BKE_mask_get_duration(struct Mask *mask);
 
166
 
 
167
#define MASKPOINT_ISSEL_ANY(p)          ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f3) & SELECT)
 
168
#define MASKPOINT_ISSEL_KNOT(p)         ( (p)->bezt.f2 & SELECT)
 
169
#define MASKPOINT_ISSEL_HANDLE_ONLY(p)  ( (((p)->bezt.f1 | (p)->bezt.f3) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
 
170
#define MASKPOINT_ISSEL_HANDLE(p)       ( (((p)->bezt.f1 | (p)->bezt.f3) & SELECT) )
 
171
 
 
172
#define MASKPOINT_SEL_ALL(p)    { (p)->bezt.f1 |=  SELECT; (p)->bezt.f2 |=  SELECT; (p)->bezt.f3 |=  SELECT; } (void)0
 
173
#define MASKPOINT_DESEL_ALL(p)  { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f2 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
 
174
#define MASKPOINT_INVSEL_ALL(p) { (p)->bezt.f1 ^=  SELECT; (p)->bezt.f2 ^=  SELECT; (p)->bezt.f3 ^=  SELECT; } (void)0
 
175
 
 
176
#define MASKPOINT_SEL_HANDLE(p)     { (p)->bezt.f1 |=  SELECT; (p)->bezt.f3 |=  SELECT; } (void)0
 
177
#define MASKPOINT_DESEL_HANDLE(p)   { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
 
178
 
 
179
#define MASK_RESOL_MAX 128
 
180
 
 
181
 
 
182
/* mask_evaluate.c */
 
183
unsigned int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height);
 
184
unsigned int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height);
 
185
int          BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const unsigned int resol);
 
186
 
 
187
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
 
188
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
 
189
 
 
190
float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, int *tot_diff_point,
 
191
                                                         const unsigned int resol))[2];
 
192
void    BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float (*feather_points)[2], const int tot_feather_point);
 
193
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
 
194
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point,
 
195
                                                                         const unsigned int resol, const int do_feather_isect))[2];
 
196
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height,
 
197
                                                                      int *tot_feather_point, const int do_feather_isect))[2];
 
198
/* *** mask point functions which involve evaluation *** */
 
199
float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
 
200
 
 
201
float *BKE_mask_point_segment_diff(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
202
                                   unsigned int *tot_diff_point);
 
203
float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
204
                                           unsigned int *tot_feather_point);
 
205
 
 
206
float *BKE_mask_point_segment_diff_with_resolution(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
207
                                                   int width, int height,
 
208
                                                   unsigned int *tot_diff_point);
 
209
 
 
210
float *BKE_mask_point_segment_feather_diff_with_resolution(struct MaskSpline *spline, struct MaskSplinePoint *point,
 
211
                                                           int width, int height,
 
212
                                                           unsigned int *tot_feather_point);
 
213
 
 
214
/* mask_rasterize.c */
 
215
struct MaskRasterHandle;
 
216
typedef struct MaskRasterHandle MaskRasterHandle;
 
217
 
 
218
MaskRasterHandle *BKE_maskrasterize_handle_new(void);
 
219
void              BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle);
 
220
void              BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
 
221
                                                const int width, const int height,
 
222
                                                const short do_aspect_correct, const short do_mask_aa,
 
223
                                                const short do_feather);
 
224
float             BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
 
225
 
 
226
void              BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
 
227
                                           const unsigned int width, const unsigned int height,
 
228
                                           float *buffer);
 
229
 
 
230
#endif /* __BKE_MASK_H__ */