Blender  V2.93
image_draw.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) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <stdlib.h>
26 #include <string.h>
27 
28 #include "MEM_guardedalloc.h"
29 
30 #include "DNA_brush_types.h"
31 #include "DNA_camera_types.h"
32 #include "DNA_mask_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_scene_types.h"
35 #include "DNA_screen_types.h"
36 #include "DNA_space_types.h"
37 
38 #include "PIL_time.h"
39 
40 #include "BLI_listbase.h"
41 #include "BLI_math.h"
42 #include "BLI_rect.h"
43 #include "BLI_string.h"
44 #include "BLI_threads.h"
45 #include "BLI_utildefines.h"
46 
47 #include "IMB_colormanagement.h"
48 #include "IMB_imbuf.h"
49 #include "IMB_imbuf_types.h"
50 #include "IMB_moviecache.h"
51 
52 #include "BKE_context.h"
53 #include "BKE_image.h"
54 #include "BKE_paint.h"
55 
56 #include "BIF_glutil.h"
57 
58 #include "GPU_framebuffer.h"
59 #include "GPU_immediate.h"
60 #include "GPU_immediate_util.h"
61 #include "GPU_matrix.h"
62 #include "GPU_state.h"
63 
64 #include "BLF_api.h"
65 
66 #include "ED_gpencil.h"
67 #include "ED_image.h"
68 #include "ED_mask.h"
69 #include "ED_render.h"
70 #include "ED_screen.h"
71 #include "ED_util.h"
72 
73 #include "UI_interface.h"
74 #include "UI_resources.h"
75 #include "UI_view2d.h"
76 
77 #include "RE_engine.h"
78 #include "RE_pipeline.h"
79 
80 #include "image_intern.h"
81 
82 static void draw_render_info(
83  const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
84 {
86  Scene *stats_scene = ED_render_job_get_scene(C);
87  if (stats_scene == NULL) {
88  stats_scene = CTX_data_scene(C);
89  }
90 
91  RenderResult *rr = BKE_image_acquire_renderresult(stats_scene, ima);
92 
93  if (rr && rr->text) {
94  float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
95  ED_region_info_draw(region, rr->text, fill_color, true);
96  }
97 
98  BKE_image_release_renderresult(stats_scene, ima);
99 
100  if (re) {
101  int total_tiles;
102  bool need_free_tiles;
103  rcti *tiles = RE_engine_get_current_tiles(re, &total_tiles, &need_free_tiles);
104 
105  if (total_tiles) {
106  /* find window pixel coordinates of origin */
107  int x, y;
108  UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
109 
110  GPU_matrix_push();
112  GPU_matrix_scale_2f(zoomx, zoomy);
113 
115  if (rd->mode & R_BORDER) {
116  /* TODO: round or floor instead of casting to int */
117  GPU_matrix_translate_2f((int)(-rd->border.xmin * rd->xsch * rd->size * 0.01f),
118  (int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f));
119  }
120 
125 
126  GPU_line_width(1.0f);
127 
128  rcti *tile = tiles;
129  for (int i = 0; i < total_tiles; i++, tile++) {
130  immDrawBorderCorners(pos, tile, zoomx, zoomy);
131  }
132 
134 
135  if (need_free_tiles) {
136  MEM_freeN(tiles);
137  }
138 
139  GPU_matrix_pop();
140  }
141  }
142 }
143 
144 /* used by node view too */
146  ARegion *region,
147  bool color_manage,
148  bool use_default_view,
149  int channels,
150  int x,
151  int y,
152  const uchar cp[4],
153  const float fp[4],
154  const float linearcol[4],
155  const int *zp,
156  const float *zpf)
157 {
158  rcti color_rect;
159  char str[256];
160  int dx = 6;
161  /* local coordinate visible rect inside region, to accommodate overlapping ui */
162  const rcti *rect = ED_region_visible_rect(region);
163  const int ymin = rect->ymin;
164  const int dy = ymin + 0.3f * UI_UNIT_Y;
165 
166  /* text colors */
167  /* XXX colored text not allowed in Blender UI */
168 #if 0
169  uchar red[3] = {255, 50, 50};
170  uchar green[3] = {0, 255, 0};
171  uchar blue[3] = {100, 100, 255};
172 #else
173  const uchar red[3] = {255, 255, 255};
174  const uchar green[3] = {255, 255, 255};
175  const uchar blue[3] = {255, 255, 255};
176 #endif
177  float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
178  float col[4], finalcol[4];
179 
181 
185 
186  /* noisy, high contrast make impossible to read if lower alpha is used. */
187  immUniformColor4ub(0, 0, 0, 190);
188  immRecti(pos, 0, ymin, BLI_rcti_size_x(&region->winrct) + 1, ymin + UI_UNIT_Y);
189 
191 
193 
194  BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi);
195 
196  BLF_color3ub(blf_mono_font, 255, 255, 255);
197  SNPRINTF(str, "X:%-4d Y:%-4d |", x, y);
198  BLF_position(blf_mono_font, dx, dy, 0);
199  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
200  dx += BLF_width(blf_mono_font, str, sizeof(str));
201 
202  if (zp) {
203  BLF_color3ub(blf_mono_font, 255, 255, 255);
204  SNPRINTF(str, " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
205  BLF_position(blf_mono_font, dx, dy, 0);
206  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
207  dx += BLF_width(blf_mono_font, str, sizeof(str));
208  }
209  if (zpf) {
210  BLF_color3ub(blf_mono_font, 255, 255, 255);
211  SNPRINTF(str, " Z:%-.3f |", *zpf);
212  BLF_position(blf_mono_font, dx, dy, 0);
213  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
214  dx += BLF_width(blf_mono_font, str, sizeof(str));
215  }
216 
217  if (channels == 1 && (cp != NULL || fp != NULL)) {
218  if (fp != NULL) {
219  SNPRINTF(str, " Val:%-.3f |", fp[0]);
220  }
221  else if (cp != NULL) {
222  SNPRINTF(str, " Val:%-.3f |", cp[0] / 255.0f);
223  }
224  BLF_color3ub(blf_mono_font, 255, 255, 255);
225  BLF_position(blf_mono_font, dx, dy, 0);
226  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
227  dx += BLF_width(blf_mono_font, str, sizeof(str));
228  }
229 
230  if (channels >= 3) {
232  if (fp) {
233  SNPRINTF(str, " R:%-.5f", fp[0]);
234  }
235  else if (cp) {
236  SNPRINTF(str, " R:%-3d", cp[0]);
237  }
238  else {
239  STRNCPY(str, " R:-");
240  }
241  BLF_position(blf_mono_font, dx, dy, 0);
242  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
243  dx += BLF_width(blf_mono_font, str, sizeof(str));
244 
246  if (fp) {
247  SNPRINTF(str, " G:%-.5f", fp[1]);
248  }
249  else if (cp) {
250  SNPRINTF(str, " G:%-3d", cp[1]);
251  }
252  else {
253  STRNCPY(str, " G:-");
254  }
255  BLF_position(blf_mono_font, dx, dy, 0);
256  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
257  dx += BLF_width(blf_mono_font, str, sizeof(str));
258 
260  if (fp) {
261  SNPRINTF(str, " B:%-.5f", fp[2]);
262  }
263  else if (cp) {
264  SNPRINTF(str, " B:%-3d", cp[2]);
265  }
266  else {
267  STRNCPY(str, " B:-");
268  }
269  BLF_position(blf_mono_font, dx, dy, 0);
270  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
271  dx += BLF_width(blf_mono_font, str, sizeof(str));
272 
273  if (channels == 4) {
274  BLF_color3ub(blf_mono_font, 255, 255, 255);
275  if (fp) {
276  SNPRINTF(str, " A:%-.4f", fp[3]);
277  }
278  else if (cp) {
279  SNPRINTF(str, " A:%-3d", cp[3]);
280  }
281  else {
282  STRNCPY(str, "- ");
283  }
284  BLF_position(blf_mono_font, dx, dy, 0);
285  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
286  dx += BLF_width(blf_mono_font, str, sizeof(str));
287  }
288 
289  if (color_manage) {
290  float rgba[4];
291 
292  copy_v3_v3(rgba, linearcol);
293  if (channels == 3) {
294  rgba[3] = 1.0f;
295  }
296  else {
297  rgba[3] = linearcol[3];
298  }
299 
300  if (use_default_view) {
302  }
303  else {
305  rgba, rgba, &scene->view_settings, &scene->display_settings);
306  }
307 
308  SNPRINTF(str, " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
309  BLF_position(blf_mono_font, dx, dy, 0);
310  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
311  dx += BLF_width(blf_mono_font, str, sizeof(str));
312  }
313  }
314 
315  /* color rectangle */
316  if (channels == 1) {
317  if (fp) {
318  col[0] = col[1] = col[2] = fp[0];
319  }
320  else if (cp) {
321  col[0] = col[1] = col[2] = (float)cp[0] / 255.0f;
322  }
323  else {
324  col[0] = col[1] = col[2] = 0.0f;
325  }
326  col[3] = 1.0f;
327  }
328  else if (channels == 3) {
329  copy_v3_v3(col, linearcol);
330  col[3] = 1.0f;
331  }
332  else if (channels == 4) {
333  copy_v4_v4(col, linearcol);
334  }
335  else {
336  BLI_assert(0);
337  zero_v4(col);
338  }
339 
340  if (color_manage) {
341  if (use_default_view) {
343  }
344  else {
346  finalcol, col, &scene->view_settings, &scene->display_settings);
347  }
348  }
349  else {
350  copy_v4_v4(finalcol, col);
351  }
352 
354  dx += 0.25f * UI_UNIT_X;
355 
356  BLI_rcti_init(&color_rect,
357  dx,
358  dx + (1.5f * UI_UNIT_X),
359  ymin + 0.15f * UI_UNIT_Y,
360  ymin + 0.85f * UI_UNIT_Y);
361 
362  /* BLF uses immediate mode too, so we must reset our vertex format */
365 
366  if (channels == 4) {
367  rcti color_rect_half;
368  int color_quater_x, color_quater_y;
369 
370  color_rect_half = color_rect;
371  color_rect_half.xmax = BLI_rcti_cent_x(&color_rect);
372  /* what color ??? */
373  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
374 
375  color_rect_half = color_rect;
376  color_rect_half.xmin = BLI_rcti_cent_x(&color_rect);
377 
378  color_quater_x = BLI_rcti_cent_x(&color_rect_half);
379  color_quater_y = BLI_rcti_cent_y(&color_rect_half);
380 
382  immRecti(pos,
383  color_rect_half.xmin,
384  color_rect_half.ymin,
385  color_rect_half.xmax,
386  color_rect_half.ymax);
387 
389  immRecti(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
390  immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
391 
393  immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f));
394  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
396  }
397  else {
398  immUniformColor3fv(finalcol);
399  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
400  }
402 
403  /* draw outline */
406  immUniformColor3ub(128, 128, 128);
407  imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
409 
410  dx += 1.75f * UI_UNIT_X;
411 
412  BLF_color3ub(blf_mono_font, 255, 255, 255);
413  if (channels == 1) {
414  if (fp) {
415  rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
416  rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v, BLI_YUV_ITU_BT709);
417  }
418  else if (cp) {
419  rgb_to_hsv(
420  (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &hue, &sat, &val);
421  rgb_to_yuv((float)cp[0] / 255.0f,
422  (float)cp[0] / 255.0f,
423  (float)cp[0] / 255.0f,
424  &lum,
425  &u,
426  &v,
428  }
429 
430  SNPRINTF(str, "V:%-.4f", val);
431  BLF_position(blf_mono_font, dx, dy, 0);
432  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
433  dx += BLF_width(blf_mono_font, str, sizeof(str));
434 
435  SNPRINTF(str, " L:%-.4f", lum);
436  BLF_position(blf_mono_font, dx, dy, 0);
437  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
438  }
439  else if (channels >= 3) {
440  rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
441  rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v, BLI_YUV_ITU_BT709);
442 
443  SNPRINTF(str, "H:%-.4f", hue);
444  BLF_position(blf_mono_font, dx, dy, 0);
445  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
446  dx += BLF_width(blf_mono_font, str, sizeof(str));
447 
448  SNPRINTF(str, " S:%-.4f", sat);
449  BLF_position(blf_mono_font, dx, dy, 0);
450  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
451  dx += BLF_width(blf_mono_font, str, sizeof(str));
452 
453  SNPRINTF(str, " V:%-.4f", val);
454  BLF_position(blf_mono_font, dx, dy, 0);
455  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
456  dx += BLF_width(blf_mono_font, str, sizeof(str));
457 
458  SNPRINTF(str, " L:%-.4f", lum);
459  BLF_position(blf_mono_font, dx, dy, 0);
460  BLF_draw_ascii(blf_mono_font, str, sizeof(str));
461  }
462 }
463 
464 /* image drawing */
466  float x1, float y1, int rectx, int recty, const int *rect, float zoomx, float zoomy)
467 {
468  const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
469 
470  /* Very slow! */
471  float *rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
472  for (int a = rectx * recty - 1; a >= 0; a--) {
473  /* zbuffer values are signed, so we need to shift color range */
474  rectf[a] = rect[a] * 0.5f + 0.5f;
475  }
476 
479  state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
480 
481  immDrawPixelsTex(&state, x1, y1, rectx, recty, GPU_R16F, false, rectf, zoomx, zoomy, NULL);
482 
483  MEM_freeN(rectf);
484 }
485 
487  float x1,
488  float y1,
489  int rectx,
490  int recty,
491  const float *rect_float,
492  float zoomx,
493  float zoomy)
494 {
495  float bias, scale, *rectf, clip_end;
496  int a;
497  const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
498 
499  if (scene->camera && scene->camera->type == OB_CAMERA) {
500  bias = ((Camera *)scene->camera->data)->clip_start;
501  clip_end = ((Camera *)scene->camera->data)->clip_end;
502  scale = 1.0f / (clip_end - bias);
503  }
504  else {
505  bias = 0.1f;
506  scale = 0.01f;
507  clip_end = 100.0f;
508  }
509 
510  rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
511  for (a = rectx * recty - 1; a >= 0; a--) {
512  if (rect_float[a] > clip_end) {
513  rectf[a] = 0.0f;
514  }
515  else if (rect_float[a] < bias) {
516  rectf[a] = 1.0f;
517  }
518  else {
519  rectf[a] = 1.0f - (rect_float[a] - bias) * scale;
520  rectf[a] *= rectf[a];
521  }
522  }
523 
526  state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
527 
528  immDrawPixelsTex(&state, x1, y1, rectx, recty, GPU_R16F, false, rectf, zoomx, zoomy, NULL);
529 
530  MEM_freeN(rectf);
531 }
532 
533 static void draw_udim_label(ARegion *region, float fx, float fy, const char *label)
534 {
535  if (label == NULL || !label[0]) {
536  return;
537  }
538 
539  /* find window pixel coordinates of origin */
540  int x, y;
541  UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
542 
544 
545  int textwidth = BLF_width(blf_mono_font, label, strlen(label)) + 10;
546  float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
547  float opacity;
548  if (textwidth < 0.5f * (stepx - 10)) {
549  opacity = 1.0f;
550  }
551  else if (textwidth < (stepx - 10)) {
552  opacity = 2.0f - 2.0f * (textwidth / (stepx - 10));
553  }
554  else {
555  opacity = 0.0f;
556  }
557  BLF_color4ub(blf_mono_font, 220, 220, 220, 150 * opacity);
558  BLF_position(blf_mono_font, (int)(x + 10), (int)(y + 10), 0);
560 
562 }
563 
564 static void draw_image_buffer(const bContext *C,
565  SpaceImage *sima,
566  ARegion *region,
567  Scene *scene,
568  ImBuf *ibuf,
569  float fx,
570  float fy,
571  float zoomx,
572  float zoomy)
573 {
574  /* Image are still drawn in display space. */
577 
578  int x, y;
579  int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf);
580 
581  /* find window pixel coordinates of origin */
582  UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
583 
584  /* this part is generic image display */
585  if (sima_flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) {
586  if (ibuf->zbuf) {
587  sima_draw_zbuf_pixels(x, y, ibuf->x, ibuf->y, ibuf->zbuf, zoomx, zoomy);
588  }
589  else if (ibuf->zbuf_float) {
590  sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->zbuf_float, zoomx, zoomy);
591  }
592  else if (ibuf->channels == 1) {
593  sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float, zoomx, zoomy);
594  }
595  }
596  else {
597  int clip_max_x, clip_max_y;
599  &region->v2d, region->v2d.cur.xmax, region->v2d.cur.ymax, &clip_max_x, &clip_max_y);
600 
601  if (sima_flag & SI_USE_ALPHA) {
602  imm_draw_box_checker_2d(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
603 
605  }
606 
607  /* If RGBA display with color management */
608  if ((sima_flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B | SI_SHOW_ALPHA)) == 0) {
609 
610  ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, false, 0, 0, clip_max_x, clip_max_y, zoomx, zoomy);
611  }
612  else {
613  float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f};
614  uchar *display_buffer;
615  void *cache_handle;
616  ColorManagedViewSettings *view_settings;
617  ColorManagedDisplaySettings *display_settings;
618 
619  if (sima_flag & SI_SHOW_R) {
620  shuffle[0] = 1.0f;
621  }
622  else if (sima_flag & SI_SHOW_G) {
623  shuffle[1] = 1.0f;
624  }
625  else if (sima_flag & SI_SHOW_B) {
626  shuffle[2] = 1.0f;
627  }
628  else if (sima_flag & SI_SHOW_ALPHA) {
629  shuffle[3] = 1.0f;
630  }
631 
634  state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
635 
636  IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
637  display_buffer = IMB_display_buffer_acquire(
638  ibuf, view_settings, display_settings, &cache_handle);
639 
640  if (display_buffer) {
642  x,
643  y,
644  ibuf->x,
645  ibuf->y,
646  GPU_RGBA8,
647  false,
648  display_buffer,
649  0,
650  0,
651  clip_max_x,
652  clip_max_y,
653  zoomx,
654  zoomy,
655  NULL);
656  }
657 
658  IMB_display_buffer_release(cache_handle);
659  }
660 
661  if (sima_flag & SI_USE_ALPHA) {
663  }
664  }
665 
667 }
668 
670  SpaceImage *sima,
671  ARegion *region,
672  Scene *scene,
673  ImBuf *ibuf,
674  float zoomx,
675  float zoomy)
676 {
677  const double time_current = PIL_check_seconds_timer();
678 
679  const int xmax = ceil(region->v2d.cur.xmax);
680  const int ymax = ceil(region->v2d.cur.ymax);
681  const int xmin = floor(region->v2d.cur.xmin);
682  const int ymin = floor(region->v2d.cur.ymin);
683 
684  for (int x = xmin; x < xmax; x++) {
685  for (int y = ymin; y < ymax; y++) {
686  draw_image_buffer(C, sima, region, scene, ibuf, x, y, zoomx, zoomy);
687 
688  /* only draw until running out of time */
689  if ((PIL_check_seconds_timer() - time_current) > 0.25) {
690  return;
691  }
692  }
693  }
694 }
695 
696 /* draw uv edit */
697 
698 /* draw grease pencil */
699 void draw_image_grease_pencil(bContext *C, bool onlyv2d)
700 {
701  /* draw in View2D space? */
702  if (onlyv2d) {
703  /* draw grease-pencil ('image' strokes) */
705  }
706  else {
707  /* assume that UI_view2d_restore(C) has been called... */
708  // SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
709 
710  /* draw grease-pencil ('screen' strokes) */
712  }
713 }
714 
716 {
718  Histogram *hist = &sima->sample_line_hist;
719 
721  uint shdr_dashed_pos = GPU_vertformat_attr_add(
722  format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
723 
725 
726  float viewport_size[4];
727  GPU_viewport_size_get_f(viewport_size);
728  immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
729 
730  immUniform1i("colors_len", 2); /* Advanced dashes. */
732  "colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
733  immUniform1f("dash_width", 2.0f);
734  immUniform1f("dash_factor", 0.5f);
735 
737  immVertex2fv(shdr_dashed_pos, hist->co[0]);
738  immVertex2fv(shdr_dashed_pos, hist->co[1]);
739  immEnd();
740 
742  }
743 }
744 
745 static void draw_udim_tile_grid(uint pos_attr,
746  uint color_attr,
747  ARegion *region,
748  int x,
749  int y,
750  float stepx,
751  float stepy,
752  const float color[3])
753 {
754  float x1, y1;
755  UI_view2d_view_to_region_fl(&region->v2d, x, y, &x1, &y1);
756  const int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
757  for (int i = 0; i < 4; i++) {
758  immAttr3fv(color_attr, color);
759  immVertex2f(pos_attr, x1 + gridpos[i][0] * stepx, y1 + gridpos[i][1] * stepy);
760  immAttr3fv(color_attr, color);
761  immVertex2f(pos_attr, x1 + gridpos[i + 1][0] * stepx, y1 + gridpos[i + 1][1] * stepy);
762  }
763 }
764 
765 static void draw_udim_tile_grids(ARegion *region, SpaceImage *sima, Image *ima)
766 {
767  int num_tiles;
768  if (ima != NULL) {
769  num_tiles = BLI_listbase_count(&ima->tiles);
770 
771  if (ima->source != IMA_SRC_TILED) {
772  return;
773  }
774  }
775  else {
776  num_tiles = sima->tile_grid_shape[0] * sima->tile_grid_shape[1];
777  }
778 
779  float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
780  float stepy = BLI_rcti_size_y(&region->v2d.mask) / BLI_rctf_size_y(&region->v2d.cur);
781 
785 
787  immBegin(GPU_PRIM_LINES, 8 * num_tiles);
788 
789  float theme_color[3], selected_color[3];
790  UI_GetThemeColorShade3fv(TH_GRID, 60.0f, theme_color);
791  UI_GetThemeColor3fv(TH_FACE_SELECT, selected_color);
792 
793  if (ima != NULL) {
794  ImageTile *cur_tile = BLI_findlink(&ima->tiles, ima->active_tile_index);
795 
796  LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
797  if (tile != cur_tile) {
798  int x = (tile->tile_number - 1001) % 10;
799  int y = (tile->tile_number - 1001) / 10;
800  draw_udim_tile_grid(pos, color, region, x, y, stepx, stepy, theme_color);
801  }
802  }
803 
804  if (cur_tile != NULL) {
805  int cur_x = (cur_tile->tile_number - 1001) % 10;
806  int cur_y = (cur_tile->tile_number - 1001) / 10;
807  draw_udim_tile_grid(pos, color, region, cur_x, cur_y, stepx, stepy, selected_color);
808  }
809  }
810  else {
811  for (int y = 0; y < sima->tile_grid_shape[1]; y++) {
812  for (int x = 0; x < sima->tile_grid_shape[0]; x++) {
813  draw_udim_tile_grid(pos, color, region, x, y, stepx, stepy, theme_color);
814  }
815  }
816  }
817 
818  immEnd();
820 }
821 
822 /* draw main image region */
823 
824 void draw_image_main(const bContext *C, ARegion *region)
825 {
828  Image *ima;
829  ImBuf *ibuf;
830  float zoomx, zoomy;
831  bool show_viewer, show_stereo3d, show_multilayer;
832  void *lock;
833 
834  /* XXX can we do this in refresh? */
835 #if 0
836  what_image(sima);
837 
838  if (sima->image) {
839  ED_image_get_aspect(sima->image, &xuser_asp, &yuser_asp);
840 
841  /* UGLY hack? until now iusers worked fine... but for flipbook viewer we need this */
842  if (sima->image->type == IMA_TYPE_COMPOSITE) {
844  if (iuser) {
845  BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);
846  sima->iuser = *iuser;
847  }
848  }
849  /* and we check for spare */
850  ibuf = ED_space_image_buffer(sima);
851  }
852 #endif
853 
854  /* retrieve the image and information about it */
855  ima = ED_space_image(sima);
856  ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
857 
858  /* Tag image as in active use for garbage collector. */
859  if (ima) {
860  BKE_image_tag_time(ima);
861  }
862 
863  show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
864  show_stereo3d = (ima && BKE_image_is_stereo(ima) && (sima->iuser.flag & IMA_SHOW_STEREO));
865  show_multilayer = ima && BKE_image_is_multilayer(ima);
866 
867  if (show_viewer) {
868  /* use locked draw for drawing viewer image buffer since the compositor
869  * is running in separated thread and compositor could free this buffers.
870  * other images are not modifying in such a way so they does not require
871  * lock (sergey)
872  */
874  }
875 
876  if (show_stereo3d) {
877  if (show_multilayer) {
878  /* Update multi-index and pass for the current eye. */
879  BKE_image_multilayer_index(ima->rr, &sima->iuser);
880  }
881  else {
882  BKE_image_multiview_index(ima, &sima->iuser);
883  }
884  }
885 
886  ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
887 
888  int main_w = 0;
889  int main_h = 0;
890 
891  /* draw the image or grid */
892  if (ibuf == NULL) {
893  if (ima != NULL) {
894  LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
895  int x = (tile->tile_number - 1001) % 10;
896  int y = (tile->tile_number - 1001) / 10;
897  ED_region_grid_draw(region, zoomx, zoomy, x, y);
898  }
899  }
900  else {
901  for (int y = 0; y < sima->tile_grid_shape[1]; y++) {
902  for (int x = 0; x < sima->tile_grid_shape[0]; x++) {
903  ED_region_grid_draw(region, zoomx, zoomy, x, y);
904  }
905  }
906  }
907  }
908  else {
909  if (sima->flag & SI_DRAW_TILE) {
910  draw_image_buffer_repeated(C, sima, region, scene, ibuf, zoomx, zoomy);
911  }
912  else {
913  main_w = ibuf->x;
914  main_h = ibuf->y;
915 
916  draw_image_buffer(C, sima, region, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
917  if (ima->source == IMA_SRC_TILED) {
918  ImageTile *tile = BKE_image_get_tile(ima, 0);
919  char label[sizeof(tile->label)];
920  BKE_image_get_tile_label(ima, tile, label, sizeof(label));
921  draw_udim_label(region, 0.0f, 0.0f, label);
922  }
923  }
924 
925  if (sima->flag & SI_DRAW_METADATA) {
926  int x, y;
927  rctf frame;
928 
929  BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
930  UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
931 
932  ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
933  }
934  }
935 
936  ED_space_image_release_buffer(sima, ibuf, lock);
937 
938  if (ima != NULL && ima->source == IMA_SRC_TILED) {
939  LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
940  if (tile->tile_number == 1001) {
941  continue;
942  }
943 
944  ibuf = ED_space_image_acquire_buffer(sima, &lock, tile->tile_number);
945  if (ibuf != NULL) {
946  int x_pos = (tile->tile_number - 1001) % 10;
947  int y_pos = (tile->tile_number - 1001) / 10;
948  char label[sizeof(tile->label)];
949  BKE_image_get_tile_label(ima, tile, label, sizeof(label));
950 
951  float tile_zoomx = (zoomx * main_w) / ibuf->x;
952  float tile_zoomy = (zoomy * main_h) / ibuf->y;
953  draw_image_buffer(C, sima, region, scene, ibuf, x_pos, y_pos, tile_zoomx, tile_zoomy);
954  draw_udim_label(region, x_pos, y_pos, label);
955  }
956  ED_space_image_release_buffer(sima, ibuf, lock);
957  }
958  }
959 
960  draw_udim_tile_grids(region, sima, ima);
961  draw_image_main_helpers(C, region);
962 
963  if (show_viewer) {
965  }
966 }
967 
969 {
971  Image *ima = ED_space_image(sima);
972 
973  const bool show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
974  const bool show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
975  if (ima && show_render) {
976  float zoomx, zoomy;
977  ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
978  draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy);
979  }
980 }
981 
983 {
984  Image *image = ED_space_image(sima);
985  Mask *mask = NULL;
986  if (sima->mode == SI_MODE_MASK) {
988  }
989  if (image == NULL && mask == NULL) {
990  return false;
991  }
992  if (mask == NULL) {
993  return ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE);
994  }
995  return true;
996 }
997 
998 void draw_image_cache(const bContext *C, ARegion *region)
999 {
1000  SpaceImage *sima = CTX_wm_space_image(C);
1002  Image *image = ED_space_image(sima);
1003  float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
1004  Mask *mask = NULL;
1005 
1006  if (!ED_space_image_show_cache(sima)) {
1007  return;
1008  }
1009 
1010  if (sima->mode == SI_MODE_MASK) {
1011  mask = ED_space_image_get_mask(sima);
1012  }
1013 
1014  /* Local coordinate visible rect inside region, to accommodate overlapping ui. */
1015  const rcti *rect_visible = ED_region_visible_rect(region);
1016  const int region_bottom = rect_visible->ymin;
1017 
1019 
1020  /* Draw cache background. */
1022 
1023  /* Draw cached segments. */
1024  if (image != NULL && image->cache != NULL &&
1026  int num_segments = 0;
1027  int *points = NULL;
1028 
1029  IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
1031  region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
1032  }
1033 
1035 
1036  /* Draw current frame. */
1037  x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
1038 
1043  immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_DPI_FAC);
1044  immUnbindProgram();
1045 
1046  ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC);
1047 
1048  if (mask != NULL) {
1049  ED_mask_draw_frames(mask, region, cfra, sfra, efra);
1050  }
1051 }
typedef float(TangentPoint)[2]
void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:329
void immDrawPixelsTex(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:298
void ED_draw_imbuf_ctx_clipping(const struct bContext *C, struct ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y)
void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy)
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition: glutil.c:66
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:800
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser)
Definition: image.c:3846
bool BKE_image_is_stereo(struct Image *ima)
Definition: image.c:3889
struct RenderResult * BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima)
Definition: image.c:3925
bool BKE_image_is_multilayer(struct Image *ima)
Definition: image.c:3868
struct RenderPass * BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser)
Definition: image.c:3813
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima)
Definition: image.c:3947
void BKE_image_get_tile_label(struct Image *ima, struct ImageTile *tile, char *label, int len_label)
Definition: image.c:3697
void BKE_image_tag_time(struct Image *ima)
Definition: image.c:1184
void BLF_color3ubv(int fontid, const unsigned char rgb[3])
Definition: blf.c:411
float BLF_width(int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:723
void BLF_draw_ascii(int fontid, const char *str, size_t len) ATTR_NONNULL(2)
Definition: blf.c:573
int blf_mono_font
Definition: blf.c:70
void BLF_size(int fontid, int size, int dpi)
Definition: blf.c:367
void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b)
Definition: blf.c:429
void BLF_color4ub(int fontid, unsigned char r, unsigned char g, unsigned char b, unsigned char alpha)
Definition: blf.c:416
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:312
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define BLI_YUV_ITU_BT709
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
Definition: math_color.c:229
void rgb_to_yuv(float r, float g, float b, float *r_y, float *r_u, float *r_v, int colorspace)
Definition: math_color.c:79
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v4(float r[4])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:446
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
Definition: rct.c:436
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition: BLI_rect.h:140
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:161
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:165
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition: BLI_rect.h:136
#define STRNCPY(dst, src)
Definition: BLI_string.h:163
#define SNPRINTF(dst, format,...)
Definition: BLI_string.h:165
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
void BLI_thread_unlock(int type)
Definition: threads.cc:389
void BLI_thread_lock(int type)
Definition: threads.cc:384
@ LOCK_DRAW_IMAGE
Definition: BLI_threads.h:68
#define ELEM(...)
@ HISTO_FLAG_SAMPLELINE
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_SRC_MOVIE
@ IMA_SRC_VIEWER
@ IMA_SRC_TILED
@ IMA_SRC_SEQUENCE
#define IMA_SHOW_STEREO
Object is a sort of wrapper for general info.
@ OB_CAMERA
#define R_BORDER
#define CFRA
#define SFRA
#define EFRA
@ SI_DRAW_TILE
@ SI_SHOW_ZBUF
@ SI_SHOW_R
@ SI_DRAW_METADATA
@ SI_USE_ALPHA
@ SI_SHOW_G
@ SI_SHOW_B
@ SI_SHOW_ALPHA
@ SI_MODE_MASK
void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock)
Definition: image_edit.c:171
struct Mask * ED_space_image_get_mask(struct SpaceImage *sima)
Definition: image_edit.c:122
struct Image * ED_space_image(struct SpaceImage *sima)
Definition: image_edit.c:55
void ED_space_image_get_zoom(struct SpaceImage *sima, const struct ARegion *region, float *r_zoomx, float *r_zoomy)
int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf)
Definition: image_edit.c:179
struct ImBuf * ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile)
Definition: image_edit.c:139
void ED_mask_draw_frames(struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra)
Definition: mask_draw.c:788
struct Scene * ED_render_job_get_scene(const struct bContext *C)
void ED_region_info_draw(struct ARegion *region, const char *text, float fill_color[4], const bool full_redraw)
Definition: area.c:3510
void ED_region_grid_draw(struct ARegion *region, float zoomx, float zoomy, float x0, float y0)
Definition: area.c:3538
void ED_region_cache_draw_background(struct ARegion *region)
Definition: area.c:3693
void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y)
Definition: area.c:3707
void ED_region_cache_draw_cached_segments(struct ARegion *region, const int num_segments, const int *points, const int sfra, const int efra)
Definition: area.c:3732
const rcti * ED_region_visible_rect(ARegion *region)
Definition: area.c:3682
void ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy)
Definition: ed_draw.c:313
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb)
GPUFrameBuffer * GPU_framebuffer_active_get(void)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
void immUniform2f(const char *name, float x, float y)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immUniformThemeColor(int color_id)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immVertex2fv(uint attr_id, const float data[2])
void immUniform1i(const char *name, int x)
void immUniform1f(const char *name, float x)
void immUniformArray4fv(const char *bare_name, const float *data, int count)
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
GPUVertFormat * immVertexFormat(void)
void immAttr3fv(uint attr_id, const float data[3])
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immEnd(void)
void immUniformColor3fv(const float rgb[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2)
void immRecti(uint pos, int x1, int y1, int x2, int 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 GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_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
_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 blue
_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 green
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:142
void GPU_matrix_scale_2f(float x, float y)
Definition: gpu_matrix.cc:232
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:135
void GPU_matrix_translate_2f(float x, float y)
Definition: gpu_matrix.cc:190
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
Definition: gpu_shader.cc:551
void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, const float *value)
Definition: gpu_shader.cc:617
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
Definition: GPU_shader.h:365
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:171
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
Definition: GPU_shader.h:251
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:178
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:57
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
void GPU_line_width(float width)
Definition: gpu_state.cc:173
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:279
@ GPU_R16F
Definition: GPU_texture.h:114
@ GPU_RGBA8
Definition: GPU_texture.h:88
@ GPU_FETCH_FLOAT
@ GPU_FETCH_INT_TO_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
@ GPU_COMP_I32
void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float pixel[4], const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings)
void IMB_colormanagement_display_settings_from_ctx(const struct bContext *C, struct ColorManagedViewSettings **r_view_settings, struct ColorManagedDisplaySettings **r_display_settings)
void IMB_display_buffer_release(void *cache_handle)
unsigned char * IMB_display_buffer_acquire(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, void **cache_handle)
@ IMB_PROXY_NONE
Definition: IMB_imbuf.h:318
Contains defines and structs used throughout the imbuf module.
void IMB_moviecache_get_cache_segments(struct MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
Definition: moviecache.c:480
Read Guarded memory(de)allocation.
Platform independent time functions.
#define C
Definition: RandGen.cpp:39
#define UI_ALPHA_CHECKER_LIGHT
#define UI_UNIT_Y
#define UI_ALPHA_CHECKER_DARK
#define UI_DPI_FAC
Definition: UI_interface.h:309
#define UI_UNIT_X
void UI_GetThemeColor3fv(int colorid, float col[3])
Definition: resources.c:1191
@ TH_GRID
Definition: UI_resources.h:84
@ TH_FACE_SELECT
Definition: UI_resources.h:105
@ TH_CFRAME
Definition: UI_resources.h:113
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
Definition: resources.c:1218
void UI_view2d_view_to_region_fl(const struct View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL()
void UI_view2d_view_to_region(const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
void ED_annotation_draw_2dimage(const bContext *C)
void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int U
Definition: btGjkEpa3.h:78
struct MovieCache * cache
ListBase tiles
short type
short source
struct RenderResult * rr
int active_tile_index
const char * label
Scene scene
RenderData * RE_engine_get_render_data(Render *re)
Definition: engine.c:616
rcti * RE_engine_get_current_tiles(Render *re, int *r_total_tiles, bool *r_needs_free)
Definition: engine.c:568
#define str(s)
uint pos
uint col
struct ImageUser * ntree_get_active_iuser(bNodeTree *ntree)
Definition: image_buttons.c:67
static void draw_render_info(const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
Definition: image_draw.c:82
static void draw_image_buffer_repeated(const bContext *C, SpaceImage *sima, ARegion *region, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy)
Definition: image_draw.c:669
static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty, const float *rect_float, float zoomx, float zoomy)
Definition: image_draw.c:486
void draw_image_grease_pencil(bContext *C, bool onlyv2d)
Definition: image_draw.c:699
static void draw_udim_tile_grids(ARegion *region, SpaceImage *sima, Image *ima)
Definition: image_draw.c:765
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, const int *rect, float zoomx, float zoomy)
Definition: image_draw.c:465
void draw_image_main_helpers(const bContext *C, ARegion *region)
Definition: image_draw.c:968
static void draw_udim_tile_grid(uint pos_attr, uint color_attr, ARegion *region, int x, int y, float stepx, float stepy, const float color[3])
Definition: image_draw.c:745
void ED_image_draw_info(Scene *scene, ARegion *region, bool color_manage, bool use_default_view, int channels, int x, int y, const uchar cp[4], const float fp[4], const float linearcol[4], const int *zp, const float *zpf)
Definition: image_draw.c:145
void draw_image_cache(const bContext *C, ARegion *region)
Definition: image_draw.c:998
static void draw_udim_label(ARegion *region, float fx, float fy, const char *label)
Definition: image_draw.c:533
void draw_image_main(const bContext *C, ARegion *region)
Definition: image_draw.c:824
bool ED_space_image_show_cache(SpaceImage *sima)
Definition: image_draw.c:982
void draw_image_sample_line(SpaceImage *sima)
Definition: image_draw.c:715
static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *region, Scene *scene, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy)
Definition: image_draw.c:564
BLI_INLINE float fb(float length, float L)
static void shuffle(float2 points[], int size, int rng_seed)
Definition: jitter.cpp:243
#define ceilf(x)
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static ulong state[N]
static unsigned a[3]
Definition: RandGen.cpp:92
Render * RE_GetSceneRender(const Scene *scene)
Definition: pipeline.c:591
float co[2][2]
float * zbuf_float
int channels
float * rect_float
int * zbuf
char label[64]
struct Scene * scene
void * data
struct bNodeTree * nodetree
ColorManagedViewSettings view_settings
struct RenderData r
struct Object * camera
ColorManagedDisplaySettings display_settings
int tile_grid_shape[2]
struct Histogram sample_line_hist
struct ImageUser iuser
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
double PIL_check_seconds_timer(void)
Definition: time.c:80
ccl_device_inline float2 floor(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)