Blender  V3.3
ed_util_imbuf.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "BLI_rect.h"
11 
12 #include "BKE_colortools.h"
13 #include "BKE_context.h"
14 #include "BKE_image.h"
15 #include "BKE_main.h"
16 #include "BKE_screen.h"
17 
18 #include "ED_image.h"
19 #include "ED_screen.h"
20 #include "ED_space_api.h"
21 
22 #include "GPU_immediate.h"
23 #include "GPU_state.h"
24 
25 #include "IMB_colormanagement.h"
26 #include "IMB_imbuf.h"
27 #include "IMB_imbuf_types.h"
28 
29 #include "SEQ_render.h"
30 #include "SEQ_sequencer.h"
31 
32 #include "UI_view2d.h"
33 
34 #include "WM_api.h"
35 #include "WM_types.h"
36 
37 #include "sequencer_intern.h"
38 
39 /* Own define. */
40 #include "ED_util_imbuf.h"
41 
42 /* -------------------------------------------------------------------- */
46 typedef struct ImageSampleInfo {
48  void *draw_handle;
49  int x, y;
50  int channels;
51 
52  int width, height;
54 
55  unsigned char col[4];
56  float colf[4];
57  float linearcol[4];
58  int z;
59  float zf;
60 
61  unsigned char *colp;
62  const float *colfp;
63  int *zp;
64  float *zfp;
65 
66  bool draw;
70 
73 /* -------------------------------------------------------------------- */
77 static void image_sample_pixel_color_ubyte(const ImBuf *ibuf,
78  const int coord[2],
79  uchar r_col[4],
80  float r_col_linear[4])
81 {
82  const uchar *cp = (unsigned char *)(ibuf->rect + coord[1] * ibuf->x + coord[0]);
83  copy_v4_v4_uchar(r_col, cp);
84  rgba_uchar_to_float(r_col_linear, r_col);
86 }
87 
88 static void image_sample_pixel_color_float(ImBuf *ibuf, const int coord[2], float r_col[4])
89 {
90  const float *cp = ibuf->rect_float + (ibuf->channels) * (coord[1] * ibuf->x + coord[0]);
91  copy_v4_v4(r_col, cp);
92 }
93 
96 /* -------------------------------------------------------------------- */
100 static void image_sample_rect_color_ubyte(const ImBuf *ibuf,
101  const rcti *rect,
102  uchar r_col[4],
103  float r_col_linear[4])
104 {
105  uint col_accum_ub[4] = {0, 0, 0, 0};
106  zero_v4(r_col_linear);
107  int col_tot = 0;
108  int coord[2];
109  for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
110  for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
111  float col_temp_fl[4];
112  uchar col_temp_ub[4];
113  image_sample_pixel_color_ubyte(ibuf, coord, col_temp_ub, col_temp_fl);
114  add_v4_v4(r_col_linear, col_temp_fl);
115  col_accum_ub[0] += (uint)col_temp_ub[0];
116  col_accum_ub[1] += (uint)col_temp_ub[1];
117  col_accum_ub[2] += (uint)col_temp_ub[2];
118  col_accum_ub[3] += (uint)col_temp_ub[3];
119  col_tot += 1;
120  }
121  }
122  mul_v4_fl(r_col_linear, 1.0 / (float)col_tot);
123 
124  r_col[0] = MIN2(col_accum_ub[0] / col_tot, 255);
125  r_col[1] = MIN2(col_accum_ub[1] / col_tot, 255);
126  r_col[2] = MIN2(col_accum_ub[2] / col_tot, 255);
127  r_col[3] = MIN2(col_accum_ub[3] / col_tot, 255);
128 }
129 
130 static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r_col[4])
131 {
132  zero_v4(r_col);
133  int col_tot = 0;
134  int coord[2];
135  for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
136  for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
137  float col_temp_fl[4];
138  image_sample_pixel_color_float(ibuf, coord, col_temp_fl);
139  add_v4_v4(r_col, col_temp_fl);
140  col_tot += 1;
141  }
142  }
143  mul_v4_fl(r_col, 1.0 / (float)col_tot);
144 }
145 
148 /* -------------------------------------------------------------------- */
152 static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
153 {
155  ARegion *region = CTX_wm_region(C);
156  Image *image = ED_space_image(sima);
157 
158  float uv[2];
159  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &uv[0], &uv[1]);
160  int tile = BKE_image_get_tile_from_pos(sima->image, uv, uv, NULL);
161 
162  void *lock;
163  ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, tile);
164  ImageSampleInfo *info = op->customdata;
166  CurveMapping *curve_mapping = scene->view_settings.curve_mapping;
167 
168  if (ibuf == NULL) {
169  ED_space_image_release_buffer(sima, ibuf, lock);
170  info->draw = false;
171  return;
172  }
173 
174  if (uv[0] >= 0.0f && uv[1] >= 0.0f && uv[0] < 1.0f && uv[1] < 1.0f) {
175  int x = (int)(uv[0] * ibuf->x), y = (int)(uv[1] * ibuf->y);
176 
177  CLAMP(x, 0, ibuf->x - 1);
178  CLAMP(y, 0, ibuf->y - 1);
179 
180  info->width = ibuf->x;
181  info->height = ibuf->y;
182  info->x = x;
183  info->y = y;
184 
185  info->draw = true;
186  info->channels = ibuf->channels;
187 
188  info->colp = NULL;
189  info->colfp = NULL;
190  info->zp = NULL;
191  info->zfp = NULL;
192 
193  info->use_default_view = (image->flag & IMA_VIEW_AS_RENDER) ? false : true;
194 
195  rcti sample_rect;
196  sample_rect.xmin = max_ii(0, x - info->sample_size / 2);
197  sample_rect.ymin = max_ii(0, y - info->sample_size / 2);
198  sample_rect.xmax = min_ii(ibuf->x, sample_rect.xmin + info->sample_size) - 1;
199  sample_rect.ymax = min_ii(ibuf->y, sample_rect.ymin + info->sample_size) - 1;
200 
201  if (ibuf->rect) {
202  image_sample_rect_color_ubyte(ibuf, &sample_rect, info->col, info->linearcol);
203  rgba_uchar_to_float(info->colf, info->col);
204 
205  info->colp = info->col;
206  info->colfp = info->colf;
207  info->color_manage = true;
208  }
209  if (ibuf->rect_float) {
210  image_sample_rect_color_float(ibuf, &sample_rect, info->colf);
211 
212  if (ibuf->channels == 4) {
213  /* pass */
214  }
215  else if (ibuf->channels == 3) {
216  info->colf[3] = 1.0f;
217  }
218  else {
219  info->colf[1] = info->colf[0];
220  info->colf[2] = info->colf[0];
221  info->colf[3] = 1.0f;
222  }
223  info->colfp = info->colf;
224 
225  copy_v4_v4(info->linearcol, info->colf);
226 
227  info->color_manage = true;
228  }
229 
230  if (ibuf->zbuf) {
231  /* TODO: blend depth (not urgent). */
232  info->z = ibuf->zbuf[y * ibuf->x + x];
233  info->zp = &info->z;
234  if (ibuf->zbuf == (int *)ibuf->rect) {
235  info->colp = NULL;
236  }
237  }
238  if (ibuf->zbuf_float) {
239  /* TODO: blend depth (not urgent). */
240  info->zf = ibuf->zbuf_float[y * ibuf->x + x];
241  info->zfp = &info->zf;
242  if (ibuf->zbuf_float == ibuf->rect_float) {
243  info->colfp = NULL;
244  }
245  }
246 
247  if (curve_mapping && ibuf->channels == 4) {
248  /* we reuse this callback for set curves point operators */
249  if (RNA_struct_find_property(op->ptr, "point")) {
250  int point = RNA_enum_get(op->ptr, "point");
251 
252  if (point == 1) {
253  BKE_curvemapping_set_black_white(curve_mapping, NULL, info->linearcol);
254  }
255  else if (point == 0) {
256  BKE_curvemapping_set_black_white(curve_mapping, info->linearcol, NULL);
257  }
259  }
260  }
261 
262  /* XXX node curve integration. */
263 #if 0
264  {
265  ScrArea *area, *cur = curarea;
266 
267  node_curvemap_sample(fp); /* sends global to node editor */
268  for (area = G.curscreen->areabase.first; area; area = area->next) {
269  if (area->spacetype == SPACE_NODE) {
270  areawinset(area->win);
271  scrarea_do_windraw(area);
272  }
273  }
274  node_curvemap_sample(NULL); /* clears global in node editor */
275  curarea = cur;
276  }
277 #endif
278  }
279  else {
280  info->draw = 0;
281  }
282 
283  ED_space_image_release_buffer(sima, ibuf, lock);
285 }
286 
287 static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
288 {
289  Main *bmain = CTX_data_main(C);
292  SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
293  ARegion *region = CTX_wm_region(C);
294  ImBuf *ibuf = sequencer_ibuf_get(bmain, region, depsgraph, scene, sseq, scene->r.cfra, 0, NULL);
295  ImageSampleInfo *info = op->customdata;
296  float fx, fy;
297 
298  if (ibuf == NULL) {
299  info->draw = 0;
300  return;
301  }
302 
303  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fx, &fy);
304 
305  fx /= scene->r.xasp / scene->r.yasp;
306 
307  fx += (float)scene->r.xsch / 2.0f;
308  fy += (float)scene->r.ysch / 2.0f;
309  fx *= (float)ibuf->x / (float)scene->r.xsch;
310  fy *= (float)ibuf->y / (float)scene->r.ysch;
311 
312  if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
313  const float *fp;
314  unsigned char *cp;
315  int x = (int)fx, y = (int)fy;
316 
317  info->x = x;
318  info->y = y;
319  info->draw = 1;
320  info->channels = ibuf->channels;
321 
322  info->colp = NULL;
323  info->colfp = NULL;
324 
325  if (ibuf->rect) {
326  cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
327 
328  info->col[0] = cp[0];
329  info->col[1] = cp[1];
330  info->col[2] = cp[2];
331  info->col[3] = cp[3];
332  info->colp = info->col;
333 
334  info->colf[0] = (float)cp[0] / 255.0f;
335  info->colf[1] = (float)cp[1] / 255.0f;
336  info->colf[2] = (float)cp[2] / 255.0f;
337  info->colf[3] = (float)cp[3] / 255.0f;
338  info->colfp = info->colf;
339 
340  copy_v4_v4(info->linearcol, info->colf);
342  info->linearcol, false, ibuf->rect_colorspace);
343 
344  info->color_manage = true;
345  }
346  if (ibuf->rect_float) {
347  fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
348 
349  info->colf[0] = fp[0];
350  info->colf[1] = fp[1];
351  info->colf[2] = fp[2];
352  info->colf[3] = fp[3];
353  info->colfp = info->colf;
354 
355  /* sequencer's image buffers are in non-linear space, need to make them linear */
356  copy_v4_v4(info->linearcol, info->colf);
358 
359  info->color_manage = true;
360  }
361  }
362  else {
363  info->draw = 0;
364  }
365 
366  IMB_freeImBuf(ibuf);
368 }
369 
370 static void ed_imbuf_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
371 {
373  if (area == NULL) {
374  return;
375  }
376 
377  switch (area->spacetype) {
378  case SPACE_IMAGE: {
379  image_sample_apply(C, op, event);
380  break;
381  }
382  case SPACE_SEQ: {
383  sequencer_sample_apply(C, op, event);
384  break;
385  }
386  }
387 }
388 
391 /* -------------------------------------------------------------------- */
397 void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
398 {
399  ImageSampleInfo *info = arg_info;
400  if (!info->draw) {
401  return;
402  }
403 
406  region,
407  info->color_manage,
408  info->use_default_view,
409  info->channels,
410  info->x,
411  info->y,
412  info->colp,
413  info->colfp,
414  info->linearcol,
415  info->zp,
416  info->zfp);
417 
418  if (info->sample_size > 1) {
420 
421  if (area && area->spacetype == SPACE_IMAGE) {
422 
423  const wmWindow *win = CTX_wm_window(C);
424  const wmEvent *event = win->eventstate;
425 
429 
430  const float color[3] = {1, 1, 1};
433 
434  /* TODO(campbell): lock to pixels. */
435  rctf sample_rect_fl;
437  &sample_rect_fl,
438  (float[2]){event->xy[0] - region->winrct.xmin, event->xy[1] - region->winrct.ymin},
439  (float)(info->sample_size / 2.0f) * sima->zoom);
440 
441  GPU_logic_op_xor_set(true);
442 
443  GPU_line_width(1.0f);
445  (float)sample_rect_fl.xmin,
446  (float)sample_rect_fl.ymin,
447  (float)sample_rect_fl.xmax,
448  (float)sample_rect_fl.ymax);
449 
450  GPU_logic_op_xor_set(false);
451 
453  }
454  }
455 }
456 
458 {
459  ImageSampleInfo *info = op->customdata;
460 
461  ED_region_draw_cb_exit(info->art, info->draw_handle);
463  MEM_freeN(info);
464 }
465 
467 {
468  ARegion *region = CTX_wm_region(C);
470  if (area) {
471  switch (area->spacetype) {
472  case SPACE_IMAGE: {
473  SpaceImage *sima = area->spacedata.first;
474  if (region->regiontype == RGN_TYPE_WINDOW) {
475  if (ED_space_image_show_cache_and_mval_over(sima, region, event->mval)) {
476  return OPERATOR_PASS_THROUGH;
477  }
478  }
479  if (!ED_space_image_has_buffer(sima)) {
480  return OPERATOR_CANCELLED;
481  }
482  break;
483  }
484  case SPACE_SEQ: {
485  /* Sequencer checks could be added. */
486  break;
487  }
488  }
489  }
490 
491  ImageSampleInfo *info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
492 
493  info->art = region->type;
496  info->sample_size = RNA_int_get(op->ptr, "size");
497  op->customdata = info;
498 
499  ed_imbuf_sample_apply(C, op, event);
500 
502 
503  return OPERATOR_RUNNING_MODAL;
504 }
505 
507 {
508  switch (event->type) {
509  case LEFTMOUSE:
510  case RIGHTMOUSE: /* XXX hardcoded */
511  if (event->val == KM_RELEASE) {
512  ED_imbuf_sample_exit(C, op);
513  return OPERATOR_CANCELLED;
514  }
515  break;
516  case MOUSEMOVE:
517  ed_imbuf_sample_apply(C, op, event);
518  break;
519  }
520 
521  return OPERATOR_RUNNING_MODAL;
522 }
523 
525 {
526  ED_imbuf_sample_exit(C, op);
527 }
528 
530 {
532  if (area == NULL) {
533  return false;
534  }
535 
536  switch (area->spacetype) {
537  case SPACE_IMAGE: {
538  SpaceImage *sima = area->spacedata.first;
539  Object *obedit = CTX_data_edit_object(C);
540  if (obedit) {
541  /* Disable when UV editing so it doesn't swallow all click events
542  * (use for setting cursor). */
543  if (ED_space_image_show_uvedit(sima, obedit)) {
544  return false;
545  }
546  }
547  else if (sima->mode != SI_MODE_VIEW) {
548  return false;
549  }
550  return true;
551  }
552  case SPACE_SEQ: {
553  SpaceSeq *sseq = area->spacedata.first;
554 
555  if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
556  return false;
557  }
559  return false;
560  }
561  ARegion *region = CTX_wm_region(C);
562  if (!(region && (region->regiontype == RGN_TYPE_PREVIEW))) {
563  return false;
564  }
565  return true;
566  }
567  }
568 
569  return false;
570 }
571 
typedef float(TangentPoint)[2]
void BKE_curvemapping_set_black_white(struct CurveMapping *cumap, const float black[3], const float white[3])
Definition: colortools.c:152
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct SpaceLink * CTX_wm_space_data(const bContext *C)
Definition: context.c:743
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:824
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:383
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
MINLINE void zero_v4(float r[4])
void BLI_rctf_init_pt_radius(struct rctf *rect, const float xy[2], float size)
Definition: rct.c:461
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
#define MIN2(a, b)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
@ IMA_VIEW_AS_RENDER
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
@ SPACE_NODE
@ SPACE_SEQ
@ SPACE_IMAGE
@ SEQ_DRAW_IMG_IMBUF
@ SI_MODE_VIEW
@ OPERATOR_CANCELLED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock)
Definition: image_edit.c:158
bool ED_space_image_has_buffer(struct SpaceImage *sima)
Definition: image_edit.c:188
void ED_image_draw_info(struct Scene *scene, struct ARegion *region, bool color_manage, bool use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4], const int *zp, const float *zpf)
Definition: image_draw.c:122
bool ED_space_image_show_uvedit(const struct SpaceImage *sima, struct Object *obedit)
struct Image * ED_space_image(const struct SpaceImage *sima)
bool ED_space_image_show_cache_and_mval_over(const struct SpaceImage *sima, struct ARegion *region, const int mval[2])
struct ImBuf * ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile)
Definition: image_edit.c:118
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
Definition: spacetypes.c:226
#define REGION_DRAW_POST_PIXEL
Definition: ED_space_api.h:63
bool ED_region_draw_cb_exit(struct ARegionType *art, void *handle)
Definition: spacetypes.c:241
void immUnbindProgram(void)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
GPUVertFormat * immVertexFormat(void)
void immUniformColor3fv(const float rgb[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
void GPU_line_width(float width)
Definition: gpu_state.cc:158
void GPU_logic_op_xor_set(bool enable)
Definition: gpu_state.cc:85
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, struct ColorSpace *colorspace)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define C
Definition: RandGen.cpp:25
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
@ KM_RELEASE
Definition: WM_types.h:268
#define NC_WINDOW
Definition: WM_types.h:325
volatile int lock
Scene scene
const Depsgraph * depsgraph
void ED_imbuf_sample_exit(bContext *C, wmOperator *op)
struct ImageSampleInfo ImageSampleInfo
static void image_sample_rect_color_ubyte(const ImBuf *ibuf, const rcti *rect, uchar r_col[4], float r_col_linear[4])
static void ed_imbuf_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
void ED_imbuf_sample_cancel(bContext *C, wmOperator *op)
static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
static void image_sample_pixel_color_ubyte(const ImBuf *ibuf, const int coord[2], uchar r_col[4], float r_col_linear[4])
Definition: ed_util_imbuf.c:77
static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r_col[4])
int ED_imbuf_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
bool ED_imbuf_sample_poll(bContext *C)
static void image_sample_pixel_color_float(ImBuf *ibuf, const int coord[2], float r_col[4])
Definition: ed_util_imbuf.c:88
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
int ED_imbuf_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
uint pos
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
ccl_global const KernelWorkTile * tile
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define G(x, y, z)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void SEQ_render_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4])
Definition: render.c:184
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
Editing * SEQ_editing_get(const Scene *scene)
Definition: sequencer.c:241
ImBuf * sequencer_ibuf_get(struct Main *bmain, ARegion *region, struct Depsgraph *depsgraph, Scene *scene, SpaceSeq *sseq, int timeline_frame, int frame_ofs, const char *viewname)
short regiontype
struct ARegionType * type
struct CurveMapping * curve_mapping
float * zbuf_float
int channels
struct ColorSpace * rect_colorspace
unsigned int * rect
float * rect_float
int * zbuf
float linearcol[4]
Definition: ed_util_imbuf.c:57
const float * colfp
Definition: ed_util_imbuf.c:62
unsigned char col[4]
Definition: ed_util_imbuf.c:55
ARegionType * art
Definition: ed_util_imbuf.c:47
unsigned char * colp
Definition: ed_util_imbuf.c:61
Definition: BKE_main.h:121
ColorManagedViewSettings view_settings
struct RenderData r
struct Image * image
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
short val
Definition: WM_types.h:680
int mval[2]
Definition: WM_types.h:684
short type
Definition: WM_types.h:678
struct PointerRNA * ptr
struct wmEvent * eventstate
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ RIGHTMOUSE
@ MOUSEMOVE
@ LEFTMOUSE