1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2012 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup editors
22  */
23 
24 #pragma once
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct Depsgraph;
31 struct KeyframeEditData;
32 struct MaskLayer;
33 struct MaskLayerShape;
34 struct bContext;
35 struct wmKeyConfig;
36 
37 /* mask_edit.c */
38 void ED_mask_deselect_all(const struct bContext *C);
39 
40 void ED_operatortypes_mask(void);
41 void ED_keymap_mask(struct wmKeyConfig *keyconf);
42 void ED_operatormacros_mask(void);
43 
44 /* mask_query.c */
45 void ED_mask_get_size(struct ScrArea *area, int *width, int *height);
46 void ED_mask_zoom(struct ScrArea *area, struct ARegion *region, float *zoomx, float *zoomy);
47 void ED_mask_get_aspect(struct ScrArea *area, struct ARegion *region, float *aspx, float *aspy);
48 
49 void ED_mask_pixelspace_factor(struct ScrArea *area,
50                                struct ARegion *region,
51                                float *scalex,
52                                float *scaley);
53 void ED_mask_mouse_pos(struct ScrArea *area,
54                        struct ARegion *region,
55                        const int mval[2],
56                        float co[2]);
57 
58 void ED_mask_point_pos(
59     struct ScrArea *area, struct ARegion *region, float x, float y, float *xr, float *yr);
60 void ED_mask_point_pos__reverse(
61     struct ScrArea *area, struct ARegion *region, float x, float y, float *xr, float *yr);
62 
63 void ED_mask_cursor_location_get(struct ScrArea *area, float cursor[2]);
64 bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2]);
65 
66 /* mask_draw.c */
67 void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type);
68 void ED_mask_draw_region(struct Depsgraph *depsgraph,
69                          struct Mask *mask,
70                          struct ARegion *region,
71                          const char draw_flag,
72                          const char draw_type,
73                          const char overlay_mode,
74                          const int width_i,
75                          const int height_i,
76                          const float aspx,
77                          const float aspy,
78                          const bool do_scale_applied,
79                          const bool do_draw_cb,
80                          float stabmat[4][4],
81                          const struct bContext *C);
82 
83 void ED_mask_draw_frames(
84     struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra);
85 
86 /* mask_shapekey.c */
87 void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, const int frame);
88 bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame);
89 bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame);
90 
91 /* ----------- Mask AnimEdit API ------------------ */
92 bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer,
93                                 struct Scene *scene,
94                                 bool (*mask_layer_shape_cb)(struct MaskLayerShape *,
95                                                             struct Scene *));
96 void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel);
97 
98 bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer);
99 void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode);
100 void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer,
101                                     float min,
102                                     float max,
103                                     short select_mode);
104 void ED_masklayer_frames_select_region(struct KeyframeEditData *ked,
105                                        struct MaskLayer *mask_layer,
106                                        short tool,
107                                        short select_mode);
108 void ED_mask_select_frames(struct MaskLayer *mask_layer, short select_mode);
109 void ED_mask_select_frame(struct MaskLayer *mask_layer, int selx, short select_mode);
110 
111 bool ED_masklayer_frames_delete(struct MaskLayer *mask_layer);
112 void ED_masklayer_frames_duplicate(struct MaskLayer *mask_layer);
113 
114 void ED_masklayer_snap_frames(struct MaskLayer *mask_layer, struct Scene *scene, short mode);
115 
116 #if 0
117 void free_gpcopybuf(void);
118 void copy_gpdata(void);
119 void paste_gpdata(void);
120 
121 void mirror_masklayer_frames(struct MaskLayer *mask_layer, short mode);
122 #endif
123 
124 #ifdef __cplusplus
125 }
126 #endif
127