Shader Nodes: Add Interpolation modes to Map Range node
[blender.git] / source / blender / editors / include / ED_image.h
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) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19
20 /** \file
21  * \ingroup editors
22  */
23
24 #ifndef __ED_IMAGE_H__
25 #define __ED_IMAGE_H__
26
27 struct ARegion;
28 struct ImBuf;
29 struct Image;
30 struct ImageUser;
31 struct ReportList;
32 struct Scene;
33 struct SpaceImage;
34 struct ViewLayer;
35 struct bContext;
36 struct wmWindowManager;
37
38 /* image_edit.c, exported for transform */
39 struct Image *ED_space_image(struct SpaceImage *sima);
40 void ED_space_image_set(struct Main *bmain,
41                         struct SpaceImage *sima,
42                         struct Object *obedit,
43                         struct Image *ima,
44                         bool automatic);
45 void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima);
46 struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
47 void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
48
49 bool ED_space_image_color_sample(struct SpaceImage *sima,
50                                  struct ARegion *ar,
51                                  int mval[2],
52                                  float r_col[3]);
53 struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock);
54 void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock);
55 bool ED_space_image_has_buffer(struct SpaceImage *sima);
56
57 void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
58 void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
59 void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
60 void ED_space_image_get_zoom(struct SpaceImage *sima,
61                              struct ARegion *ar,
62                              float *zoomx,
63                              float *zoomy);
64 void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
65
66 void ED_space_image_scopes_update(const struct bContext *C,
67                                   struct SpaceImage *sima,
68                                   struct ImBuf *ibuf,
69                                   bool use_view_settings);
70
71 void ED_space_image_paint_update(struct Main *bmain,
72                                  struct wmWindowManager *wm,
73                                  struct Scene *scene);
74
75 void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy);
76 void ED_image_mouse_pos(struct SpaceImage *sima,
77                         struct ARegion *ar,
78                         const int mval[2],
79                         float co[2]);
80 void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
81 void ED_image_point_pos(
82     struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
83 void ED_image_point_pos__reverse(struct SpaceImage *sima,
84                                  struct ARegion *ar,
85                                  const float co[2],
86                                  float r_co[2]);
87 bool ED_image_slot_cycle(struct Image *image, int direction);
88
89 bool ED_space_image_show_render(struct SpaceImage *sima);
90 bool ED_space_image_show_paint(struct SpaceImage *sima);
91 bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
92
93 bool ED_space_image_paint_curve(const struct bContext *C);
94
95 bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer);
96 bool ED_space_image_maskedit_poll(struct bContext *C);
97 bool ED_space_image_maskedit_mask_poll(struct bContext *C);
98 bool ED_space_image_cursor_poll(struct bContext *C);
99
100 void ED_image_draw_info(struct Scene *scene,
101                         struct ARegion *ar,
102                         bool color_manage,
103                         bool use_default_view,
104                         int channels,
105                         int x,
106                         int y,
107                         const unsigned char cp[4],
108                         const float fp[4],
109                         const float linearcol[4],
110                         int *zp,
111                         float *zpf);
112
113 bool ED_space_image_show_cache(struct SpaceImage *sima);
114
115 bool ED_image_should_save_modified(const struct bContext *C);
116 int ED_image_save_all_modified_info(const struct bContext *C, struct ReportList *reports);
117 bool ED_image_save_all_modified(const struct bContext *C, struct ReportList *reports);
118
119 #endif /* __ED_IMAGE_H__ */