Blender  V2.93
ed_util_imbuf.c
Go to the documentation of this file.
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 
24 #include "MEM_guardedalloc.h"
25 
26 #include "BLI_rect.h"
27 
28 #include "BKE_colortools.h"
29 #include "BKE_context.h"
30 #include "BKE_image.h"
31 #include "BKE_main.h"
32 #include "BKE_screen.h"
33 
34 #include "ED_image.h"
35 #include "ED_screen.h"
36 #include "ED_space_api.h"
37 
38 #include "GPU_immediate.h"
39 #include "GPU_state.h"
40 
41 #include "IMB_colormanagement.h"
42 #include "IMB_imbuf.h"
43 #include "IMB_imbuf_types.h"
44 
45 #include "SEQ_render.h"
46 #include "SEQ_sequencer.h"
47 
48 #include "UI_view2d.h"
49 
50 #include "WM_api.h"
51 #include "WM_types.h"
52 
53 #include "sequencer_intern.h"
54 
55 /* Own define. */
56 #include "ED_util_imbuf.h"
57 
58 /* -------------------------------------------------------------------- */
62 typedef struct ImageSampleInfo {
64  void *draw_handle;
65  int x, y;
66  int channels;
67 
68  int width, height;
70 
71  unsigned char col[4];
72  float colf[4];
73  float linearcol[4];
74  int z;
75  float zf;
76 
77  unsigned char *colp;
78  const float *colfp;
79  int *zp;
80  float *zfp;
81 
82  bool draw;
86 
89 /* -------------------------------------------------------------------- */
93 static void image_sample_pixel_color_ubyte(const ImBuf *ibuf,
94  const int coord[2],
95  uchar r_col[4],
96  float r_col_linear[4])
97 {
98  const uchar *cp = (unsigned char *)(ibuf->rect + coord[1] * ibuf->x + coord[0]);
99  copy_v4_v4_uchar(r_col, cp);
100  rgba_uchar_to_float(r_col_linear, r_col);
102 }
103 
104 static void image_sample_pixel_color_float(ImBuf *ibuf, const int coord[2], float r_col[4])
105 {
106  const float *cp = ibuf->rect_float + (ibuf->channels) * (coord[1] * ibuf->x + coord[0]);
107  copy_v4_v4(r_col, cp);
108 }
109 
112 /* -------------------------------------------------------------------- */
116 static void image_sample_rect_color_ubyte(const ImBuf *ibuf,
117  const rcti *rect,
118  uchar r_col[4],
119  float r_col_linear[4])
120 {
121  uint col_accum_ub[4] = {0, 0, 0, 0};
122  zero_v4(r_col_linear);
123  int col_tot = 0;
124  int coord[2];
125  for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
126  for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
127  float col_temp_fl[4];
128  uchar col_temp_ub[4];
129  image_sample_pixel_color_ubyte(ibuf, coord, col_temp_ub, col_temp_fl);
130  add_v4_v4(r_col_linear, col_temp_fl);
131  col_accum_ub[0] += (uint)col_temp_ub[0];
132  col_accum_ub[1] += (uint)col_temp_ub[1];
133  col_accum_ub[2] += (uint)col_temp_ub[2];
134  col_accum_ub[3] += (uint)col_temp_ub[3];
135  col_tot += 1;
136  }
137  }
138  mul_v4_fl(r_col_linear, 1.0 / (float)col_tot);
139 
140  r_col[0] = MIN2(col_accum_ub[0] / col_tot, 255);
141  r_col[1] = MIN2(col_accum_ub[1] / col_tot, 255);
142  r_col[2] = MIN2(col_accum_ub[2] / col_tot, 255);
143  r_col[3] = MIN2(col_accum_ub[3] / col_tot, 255);
144 }
145 
146 static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r_col[4])
147 {
148  zero_v4(r_col);
149  int col_tot = 0;
150  int coord[2];
151  for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
152  for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
153  float col_temp_fl[4];
154  image_sample_pixel_color_float(ibuf, coord, col_temp_fl);
155  add_v4_v4(r_col, col_temp_fl);
156  col_tot += 1;
157  }
158  }
159  mul_v4_fl(r_col, 1.0 / (float)col_tot);
160 }
161 
164 /* -------------------------------------------------------------------- */
168 static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
169 {
171  ARegion *region = CTX_wm_region(C);
172  Image *image = ED_space_image(sima);
173 
174  float uv[2];
175  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &uv[0], &uv[1]);
176  int tile = BKE_image_get_tile_from_pos(sima->image, uv, uv, NULL);
177 
178  void *lock;
179  ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, tile);
180  ImageSampleInfo *info = op->customdata;
182  CurveMapping *curve_mapping = scene->view_settings.curve_mapping;
183 
184  if (ibuf == NULL) {
185  ED_space_image_release_buffer(sima, ibuf, lock);
186  info->draw = false;
187  return;
188  }
189 
190  if (uv[0] >= 0.0f && uv[1] >= 0.0f && uv[0] < 1.0f && uv[1] < 1.0f) {
191  int x = (int)(uv[0] * ibuf->x), y = (int)(uv[1] * ibuf->y);
192 
193  CLAMP(x, 0, ibuf->x - 1);
194  CLAMP(y, 0, ibuf->y - 1);
195 
196  info->width = ibuf->x;
197  info->height = ibuf->y;
198  info->x = x;
199  info->y = y;
200 
201  info->draw = true;
202  info->channels = ibuf->channels;
203 
204  info->colp = NULL;
205  info->colfp = NULL;
206  info->zp = NULL;
207  info->zfp = NULL;
208 
209  info->use_default_view = (image->flag & IMA_VIEW_AS_RENDER) ? false : true;
210 
211  rcti sample_rect;
212  sample_rect.xmin = max_ii(0, x - info->sample_size / 2);
213  sample_rect.ymin = max_ii(0, y - info->sample_size / 2);
214  sample_rect.xmax = min_ii(ibuf->x, sample_rect.xmin + info->sample_size) - 1;
215  sample_rect.ymax = min_ii(ibuf->y, sample_rect.ymin + info->sample_size) - 1;
216 
217  if (ibuf->rect) {
218  image_sample_rect_color_ubyte(ibuf, &sample_rect, info->col, info->linearcol);
219  rgba_uchar_to_float(info->colf, info->col);
220 
221  info->colp = info->col;
222  info->colfp = info->colf;
223  info->color_manage = true;
224  }
225  if (ibuf->rect_float) {
226  image_sample_rect_color_float(ibuf, &sample_rect, info->colf);
227 
228  if (ibuf->channels == 4) {
229  /* pass */
230  }
231  else if (ibuf->channels == 3) {
232  info->colf[3] = 1.0f;
233  }
234  else {
235  info->colf[1] = info->colf[0];
236  info->colf[2] = info->colf[0];
237  info->colf[3] = 1.0f;
238  }
239  info->colfp = info->colf;
240 
241  copy_v4_v4(info->linearcol, info->colf);
242 
243  info->color_manage = true;
244  }
245 
246  if (ibuf->zbuf) {
247  /* TODO, blend depth (not urgent). */
248  info->z = ibuf->zbuf[y * ibuf->x + x];
249  info->zp = &info->z;
250  if (ibuf->zbuf == (int *)ibuf->rect) {
251  info->colp = NULL;
252  }
253  }
254  if (ibuf->zbuf_float) {
255  /* TODO, blend depth (not urgent). */
256  info->zf = ibuf->zbuf_float[y * ibuf->x + x];
257  info->zfp = &info->zf;
258  if (ibuf->zbuf_float == ibuf->rect_float) {
259  info->colfp = NULL;
260  }
261  }
262 
263  if (curve_mapping && ibuf->channels == 4) {
264  /* we reuse this callback for set curves point operators */
265  if (RNA_struct_find_property(op->ptr, "point")) {
266  int point = RNA_enum_get(op->ptr, "point");
267 
268  if (point == 1) {
269  BKE_curvemapping_set_black_white(curve_mapping, NULL, info->linearcol);
270  }
271  else if (point == 0) {
272  BKE_curvemapping_set_black_white(curve_mapping, info->linearcol, NULL);
273  }
275  }
276  }
277 
278  /* XXX node curve integration. */
279 #if 0
280  {
281  ScrArea *sa, *cur = curarea;
282 
283  node_curvemap_sample(fp); /* sends global to node editor */
284  for (sa = G.curscreen->areabase.first; sa; sa = sa->next) {
285  if (sa->spacetype == SPACE_NODE) {
286  areawinset(sa->win);
287  scrarea_do_windraw(sa);
288  }
289  }
290  node_curvemap_sample(NULL); /* clears global in node editor */
291  curarea = cur;
292  }
293 #endif
294  }
295  else {
296  info->draw = 0;
297  }
298 
299  ED_space_image_release_buffer(sima, ibuf, lock);
301 }
302 
303 static void sequencer_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
304 {
305  Main *bmain = CTX_data_main(C);
308  SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
309  ARegion *region = CTX_wm_region(C);
310  ImBuf *ibuf = sequencer_ibuf_get(bmain, region, depsgraph, scene, sseq, CFRA, 0, NULL);
311  ImageSampleInfo *info = op->customdata;
312  float fx, fy;
313 
314  if (ibuf == NULL) {
315  IMB_freeImBuf(ibuf);
316  info->draw = 0;
317  return;
318  }
319 
320  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fx, &fy);
321 
322  fx /= scene->r.xasp / scene->r.yasp;
323 
324  fx += (float)scene->r.xsch / 2.0f;
325  fy += (float)scene->r.ysch / 2.0f;
326  fx *= (float)ibuf->x / (float)scene->r.xsch;
327  fy *= (float)ibuf->y / (float)scene->r.ysch;
328 
329  if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
330  const float *fp;
331  unsigned char *cp;
332  int x = (int)fx, y = (int)fy;
333 
334  info->x = x;
335  info->y = y;
336  info->draw = 1;
337  info->channels = ibuf->channels;
338 
339  info->colp = NULL;
340  info->colfp = NULL;
341 
342  if (ibuf->rect) {
343  cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
344 
345  info->col[0] = cp[0];
346  info->col[1] = cp[1];
347  info->col[2] = cp[2];
348  info->col[3] = cp[3];
349  info->colp = info->col;
350 
351  info->colf[0] = (float)cp[0] / 255.0f;
352  info->colf[1] = (float)cp[1] / 255.0f;
353  info->colf[2] = (float)cp[2] / 255.0f;
354  info->colf[3] = (float)cp[3] / 255.0f;
355  info->colfp = info->colf;
356 
357  copy_v4_v4(info->linearcol, info->colf);
359  info->linearcol, false, ibuf->rect_colorspace);
360 
361  info->color_manage = true;
362  }
363  if (ibuf->rect_float) {
364  fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
365 
366  info->colf[0] = fp[0];
367  info->colf[1] = fp[1];
368  info->colf[2] = fp[2];
369  info->colf[3] = fp[3];
370  info->colfp = info->colf;
371 
372  /* sequencer's image buffers are in non-linear space, need to make them linear */
373  copy_v4_v4(info->linearcol, info->colf);
375 
376  info->color_manage = true;
377  }
378  }
379  else {
380  info->draw = 0;
381  }
382 
383  IMB_freeImBuf(ibuf);
385 }
386 
387 static void ed_imbuf_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
388 {
389  ScrArea *sa = CTX_wm_area(C);
390 
391  if (sa && sa->spacetype == SPACE_IMAGE) {
392  image_sample_apply(C, op, event);
393  }
394 
395  if (sa && sa->spacetype == SPACE_SEQ) {
396  sequencer_sample_apply(C, op, event);
397  }
398 }
399 
402 /* -------------------------------------------------------------------- */
408 void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info)
409 {
410  ImageSampleInfo *info = arg_info;
411  if (!info->draw) {
412  return;
413  }
414 
417  region,
418  info->color_manage,
419  info->use_default_view,
420  info->channels,
421  info->x,
422  info->y,
423  info->colp,
424  info->colfp,
425  info->linearcol,
426  info->zp,
427  info->zfp);
428 
429  if (info->sample_size > 1) {
430  ScrArea *sa = CTX_wm_area(C);
431 
432  if (sa && sa->spacetype == SPACE_IMAGE) {
433 
434  const wmWindow *win = CTX_wm_window(C);
435  const wmEvent *event = win->eventstate;
436 
440 
441  const float color[3] = {1, 1, 1};
443  immUniformColor3fv(color);
444 
445  /* TODO(campbell): lock to pixels. */
446  rctf sample_rect_fl;
448  &sample_rect_fl,
449  (float[2]){event->x - region->winrct.xmin, event->y - region->winrct.ymin},
450  (float)(info->sample_size / 2.0f) * sima->zoom);
451 
452  GPU_logic_op_xor_set(true);
453 
454  GPU_line_width(1.0f);
456  (float)sample_rect_fl.xmin,
457  (float)sample_rect_fl.ymin,
458  (float)sample_rect_fl.xmax,
459  (float)sample_rect_fl.ymax);
460 
461  GPU_logic_op_xor_set(false);
462 
464  }
465  }
466 }
467 
469 {
470  ImageSampleInfo *info = op->customdata;
471 
472  ED_region_draw_cb_exit(info->art, info->draw_handle);
474  MEM_freeN(info);
475 }
476 
478 {
479  ARegion *region = CTX_wm_region(C);
480  ImageSampleInfo *info;
481 
482  info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
483 
484  info->art = region->type;
487  info->sample_size = RNA_int_get(op->ptr, "size");
488  op->customdata = info;
489 
490  ScrArea *sa = CTX_wm_area(C);
491 
492  if (sa && sa->spacetype == SPACE_IMAGE) {
494 
495  if (region->regiontype == RGN_TYPE_WINDOW) {
496  if (event->mval[1] <= 16 && ED_space_image_show_cache(sima)) {
497  return OPERATOR_PASS_THROUGH;
498  }
499  }
500 
501  if (!ED_space_image_has_buffer(sima)) {
502  return OPERATOR_CANCELLED;
503  }
504  }
505 
506  ed_imbuf_sample_apply(C, op, event);
507 
509 
510  return OPERATOR_RUNNING_MODAL;
511 }
512 
514 {
515  switch (event->type) {
516  case LEFTMOUSE:
517  case RIGHTMOUSE: /* XXX hardcoded */
518  if (event->val == KM_RELEASE) {
519  ED_imbuf_sample_exit(C, op);
520  return OPERATOR_CANCELLED;
521  }
522  break;
523  case MOUSEMOVE:
524  ed_imbuf_sample_apply(C, op, event);
525  break;
526  }
527 
528  return OPERATOR_RUNNING_MODAL;
529 }
530 
532 {
533  ED_imbuf_sample_exit(C, op);
534 }
535 
537 {
538  ScrArea *sa = CTX_wm_area(C);
539 
540  if (sa && sa->spacetype == SPACE_IMAGE) {
542  if (sima == NULL) {
543  return false;
544  }
545 
546  Object *obedit = CTX_data_edit_object(C);
547  if (obedit) {
548  /* Disable when UV editing so it doesn't swallow all click events
549  * (use for setting cursor). */
550  if (ED_space_image_show_uvedit(sima, obedit)) {
551  return false;
552  }
553  }
554  else if (sima->mode != SI_MODE_VIEW) {
555  return false;
556  }
557 
558  return true;
559  }
560 
561  if (sa && sa->spacetype == SPACE_SEQ) {
562  SpaceSeq *sseq = CTX_wm_space_seq(C);
563 
564  if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
565  return false;
566  }
567 
568  return sseq && SEQ_editing_get(CTX_data_scene(C), false) != NULL;
569  }
570 
571  return false;
572 }
573 
typedef float(TangentPoint)[2]
void BKE_curvemapping_set_black_white(struct CurveMapping *cumap, const float black[3], const float white[3])
Definition: colortools.c:168
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1296
struct SpaceSeq * CTX_wm_space_seq(const bContext *C)
Definition: context.c:827
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1424
struct SpaceLink * CTX_wm_space_data(const bContext *C)
Definition: context.c:719
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:800
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
Definition: image.c:707
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:414
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:500
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define MIN2(a, b)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
@ IMA_VIEW_AS_RENDER
#define CFRA
@ RGN_TYPE_WINDOW
@ 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:171
bool ED_space_image_has_buffer(struct SpaceImage *sima)
Definition: image_edit.c:202
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:145
struct Image * ED_space_image(struct SpaceImage *sima)
Definition: image_edit.c:55
bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit)
Definition: image_edit.c:460
bool ED_space_image_show_cache(struct SpaceImage *sima)
Definition: image_draw.c:982
struct ImBuf * ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile)
Definition: image_edit.c:139
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
Definition: spacetypes.c:238
#define REGION_DRAW_POST_PIXEL
Definition: ED_space_api.h:67
void ED_region_draw_cb_exit(struct ARegionType *, void *)
Definition: spacetypes.c:253
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:171
void GPU_line_width(float width)
Definition: gpu_state.cc:173
void GPU_logic_op_xor_set(bool enable)
Definition: gpu_state.cc:95
@ 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)
void IMB_freeImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:211
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define C
Definition: RandGen.cpp:39
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
#define NC_WINDOW
Definition: WM_types.h:277
#define KM_RELEASE
Definition: WM_types.h:243
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:93
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])
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
int ED_imbuf_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
uint pos
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void SEQ_render_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4])
Definition: render.c:191
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:866
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
Editing * SEQ_editing_get(Scene *scene, bool alloc)
Definition: sequencer.c:232
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
void * draw_handle
Definition: node_view.c:407
ARegionType * art
Definition: node_view.c:406
uchar col[4]
Definition: node_view.c:411
const float * colfp
Definition: ed_util_imbuf.c:78
float colf[4]
Definition: node_view.c:412
float linearcol[4]
Definition: node_view.c:413
unsigned char * colp
Definition: ed_util_imbuf.c:77
Definition: BKE_main.h:116
ColorManagedViewSettings view_settings
struct RenderData r
struct ScrArea * next
struct Image * image
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
short val
Definition: WM_types.h:579
int mval[2]
Definition: WM_types.h:583
short type
Definition: WM_types.h:577
struct PointerRNA * ptr
struct wmEvent * eventstate
#define G(x, y, z)
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