Blender  V3.3
image_draw.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include <math.h>
9 #include <stdlib.h>
10 #include <string.h>
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "DNA_brush_types.h"
15 #include "DNA_camera_types.h"
16 #include "DNA_mask_types.h"
17 #include "DNA_object_types.h"
18 #include "DNA_scene_types.h"
19 #include "DNA_screen_types.h"
20 #include "DNA_space_types.h"
21 #include "DNA_view2d_types.h"
22 
23 #include "PIL_time.h"
24 
25 #include "BLI_listbase.h"
26 #include "BLI_math.h"
27 #include "BLI_rect.h"
28 #include "BLI_string.h"
29 #include "BLI_threads.h"
30 #include "BLI_utildefines.h"
31 
32 #include "IMB_colormanagement.h"
33 #include "IMB_imbuf.h"
34 #include "IMB_imbuf_types.h"
35 #include "IMB_moviecache.h"
36 
37 #include "BKE_context.h"
38 #include "BKE_image.h"
39 #include "BKE_paint.h"
40 
41 #include "BIF_glutil.h"
42 
43 #include "GPU_framebuffer.h"
44 #include "GPU_immediate.h"
45 #include "GPU_immediate_util.h"
46 #include "GPU_matrix.h"
47 #include "GPU_state.h"
48 
49 #include "BLF_api.h"
50 
51 #include "ED_gpencil.h"
52 #include "ED_image.h"
53 #include "ED_mask.h"
54 #include "ED_render.h"
55 #include "ED_screen.h"
56 #include "ED_util.h"
57 
58 #include "UI_interface.h"
59 #include "UI_resources.h"
60 #include "UI_view2d.h"
61 
62 #include "RE_engine.h"
63 #include "RE_pipeline.h"
64 
65 #include "image_intern.h"
66 
67 static void draw_render_info(
68  const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
69 {
71  Scene *stats_scene = ED_render_job_get_scene(C);
72  if (stats_scene == NULL) {
73  stats_scene = CTX_data_scene(C);
74  }
75 
76  RenderResult *rr = BKE_image_acquire_renderresult(stats_scene, ima);
77 
78  if (rr && rr->text) {
79  float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
80  ED_region_info_draw(region, rr->text, fill_color, true);
81  }
82 
83  BKE_image_release_renderresult(stats_scene, ima);
84 
85  if (re) {
86  int total_tiles;
87  bool need_free_tiles;
88  rcti *tiles = RE_engine_get_current_tiles(re, &total_tiles, &need_free_tiles);
89 
90  if (total_tiles) {
91  /* find window pixel coordinates of origin */
92  int x, y;
93  UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
94 
97  GPU_matrix_scale_2f(zoomx, zoomy);
98 
103 
104  GPU_line_width(1.0f);
105 
106  rcti *tile = tiles;
107  for (int i = 0; i < total_tiles; i++, tile++) {
108  immDrawBorderCorners(pos, tile, zoomx, zoomy);
109  }
110 
112 
113  if (need_free_tiles) {
114  MEM_freeN(tiles);
115  }
116 
117  GPU_matrix_pop();
118  }
119  }
120 }
121 
123  ARegion *region,
124  bool color_manage,
125  bool use_default_view,
126  int channels,
127  int x,
128  int y,
129  const uchar cp[4],
130  const float fp[4],
131  const float linearcol[4],
132  const int *zp,
133  const float *zpf)
134 {
135  rcti color_rect;
136  char str[256];
137  int dx = 6;
138  /* local coordinate visible rect inside region, to accommodate overlapping ui */
139  const rcti *rect = ED_region_visible_rect(region);
140  const int ymin = rect->ymin;
141  const int dy = ymin + 0.3f * UI_UNIT_Y;
142 
143  /* text colors */
144  /* XXX colored text not allowed in Blender UI */
145 #if 0
146  uchar red[3] = {255, 50, 50};
147  uchar green[3] = {0, 255, 0};
148  uchar blue[3] = {100, 100, 255};
149 #else
150  const uchar red[3] = {255, 255, 255};
151  const uchar green[3] = {255, 255, 255};
152  const uchar blue[3] = {255, 255, 255};
153 #endif
154  float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
155  float col[4], finalcol[4];
156 
158 
162 
163  /* noisy, high contrast make impossible to read if lower alpha is used. */
164  immUniformColor4ub(0, 0, 0, 190);
165  immRecti(pos, 0, ymin, BLI_rcti_size_x(&region->winrct) + 1, ymin + UI_UNIT_Y);
166 
168 
170 
171  BLF_size(blf_mono_font, 11.0f * U.pixelsize, U.dpi);
172 
173  BLF_color3ub(blf_mono_font, 255, 255, 255);
174  SNPRINTF(str, "X:%-4d Y:%-4d |", x, y);
175  BLF_position(blf_mono_font, dx, dy, 0);
176  BLF_draw(blf_mono_font, str, sizeof(str));
177  dx += BLF_width(blf_mono_font, str, sizeof(str));
178 
179  if (zp) {
180  BLF_color3ub(blf_mono_font, 255, 255, 255);
181  SNPRINTF(str, " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
182  BLF_position(blf_mono_font, dx, dy, 0);
183  BLF_draw(blf_mono_font, str, sizeof(str));
184  dx += BLF_width(blf_mono_font, str, sizeof(str));
185  }
186  if (zpf) {
187  BLF_color3ub(blf_mono_font, 255, 255, 255);
188  SNPRINTF(str, " Z:%-.3f |", *zpf);
189  BLF_position(blf_mono_font, dx, dy, 0);
190  BLF_draw(blf_mono_font, str, sizeof(str));
191  dx += BLF_width(blf_mono_font, str, sizeof(str));
192  }
193 
194  if (channels == 1 && (cp != NULL || fp != NULL)) {
195  if (fp != NULL) {
196  SNPRINTF(str, " Val:%-.3f |", fp[0]);
197  }
198  else if (cp != NULL) {
199  SNPRINTF(str, " Val:%-.3f |", cp[0] / 255.0f);
200  }
201  BLF_color3ub(blf_mono_font, 255, 255, 255);
202  BLF_position(blf_mono_font, dx, dy, 0);
203  BLF_draw(blf_mono_font, str, sizeof(str));
204  dx += BLF_width(blf_mono_font, str, sizeof(str));
205  }
206 
207  if (channels >= 3) {
209  if (fp) {
210  SNPRINTF(str, " R:%-.5f", fp[0]);
211  }
212  else if (cp) {
213  SNPRINTF(str, " R:%-3d", cp[0]);
214  }
215  else {
216  STRNCPY(str, " R:-");
217  }
218  BLF_position(blf_mono_font, dx, dy, 0);
219  BLF_draw(blf_mono_font, str, sizeof(str));
220  dx += BLF_width(blf_mono_font, str, sizeof(str));
221 
223  if (fp) {
224  SNPRINTF(str, " G:%-.5f", fp[1]);
225  }
226  else if (cp) {
227  SNPRINTF(str, " G:%-3d", cp[1]);
228  }
229  else {
230  STRNCPY(str, " G:-");
231  }
232  BLF_position(blf_mono_font, dx, dy, 0);
233  BLF_draw(blf_mono_font, str, sizeof(str));
234  dx += BLF_width(blf_mono_font, str, sizeof(str));
235 
237  if (fp) {
238  SNPRINTF(str, " B:%-.5f", fp[2]);
239  }
240  else if (cp) {
241  SNPRINTF(str, " B:%-3d", cp[2]);
242  }
243  else {
244  STRNCPY(str, " B:-");
245  }
246  BLF_position(blf_mono_font, dx, dy, 0);
247  BLF_draw(blf_mono_font, str, sizeof(str));
248  dx += BLF_width(blf_mono_font, str, sizeof(str));
249 
250  if (channels == 4) {
251  BLF_color3ub(blf_mono_font, 255, 255, 255);
252  if (fp) {
253  SNPRINTF(str, " A:%-.4f", fp[3]);
254  }
255  else if (cp) {
256  SNPRINTF(str, " A:%-3d", cp[3]);
257  }
258  else {
259  STRNCPY(str, "- ");
260  }
261  BLF_position(blf_mono_font, dx, dy, 0);
262  BLF_draw(blf_mono_font, str, sizeof(str));
263  dx += BLF_width(blf_mono_font, str, sizeof(str));
264  }
265 
266  if (color_manage) {
267  float rgba[4];
268 
269  copy_v3_v3(rgba, linearcol);
270  if (channels == 3) {
271  rgba[3] = 1.0f;
272  }
273  else {
274  rgba[3] = linearcol[3];
275  }
276 
277  if (use_default_view) {
279  }
280  else {
283  }
284 
285  SNPRINTF(str, " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
286  BLF_position(blf_mono_font, dx, dy, 0);
287  BLF_draw(blf_mono_font, str, sizeof(str));
288  dx += BLF_width(blf_mono_font, str, sizeof(str));
289  }
290  }
291 
292  /* color rectangle */
293  if (channels == 1) {
294  if (fp) {
295  col[0] = col[1] = col[2] = fp[0];
296  }
297  else if (cp) {
298  col[0] = col[1] = col[2] = (float)cp[0] / 255.0f;
299  }
300  else {
301  col[0] = col[1] = col[2] = 0.0f;
302  }
303  col[3] = 1.0f;
304  }
305  else if (channels == 3) {
306  copy_v3_v3(col, linearcol);
307  col[3] = 1.0f;
308  }
309  else if (channels == 4) {
310  copy_v4_v4(col, linearcol);
311  }
312  else {
313  BLI_assert(0);
314  zero_v4(col);
315  }
316 
317  if (color_manage) {
318  if (use_default_view) {
320  }
321  else {
323  finalcol, col, &scene->view_settings, &scene->display_settings);
324  }
325  }
326  else {
327  copy_v4_v4(finalcol, col);
328  }
329 
331  dx += 0.25f * UI_UNIT_X;
332 
333  BLI_rcti_init(&color_rect,
334  dx,
335  dx + (1.5f * UI_UNIT_X),
336  ymin + 0.15f * UI_UNIT_Y,
337  ymin + 0.85f * UI_UNIT_Y);
338 
339  /* BLF uses immediate mode too, so we must reset our vertex format */
342 
343  if (channels == 4) {
344  rcti color_rect_half;
345  int color_quater_x, color_quater_y;
346 
347  color_rect_half = color_rect;
348  color_rect_half.xmax = BLI_rcti_cent_x(&color_rect);
349  /* what color ??? */
350  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
351 
352  color_rect_half = color_rect;
353  color_rect_half.xmin = BLI_rcti_cent_x(&color_rect);
354 
355  color_quater_x = BLI_rcti_cent_x(&color_rect_half);
356  color_quater_y = BLI_rcti_cent_y(&color_rect_half);
357 
359  immRecti(pos,
360  color_rect_half.xmin,
361  color_rect_half.ymin,
362  color_rect_half.xmax,
363  color_rect_half.ymax);
364 
366  immRecti(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
367  immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
368 
369  if (fp != NULL || cp != NULL) {
371  immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f));
372  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
374  }
375  }
376  else {
377  immUniformColor3fv(finalcol);
378  immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
379  }
381 
382  /* draw outline */
385  immUniformColor3ub(128, 128, 128);
386  imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
388 
389  dx += 1.75f * UI_UNIT_X;
390 
391  BLF_color3ub(blf_mono_font, 255, 255, 255);
392  if (channels == 1) {
393  if (fp) {
394  rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
395  rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v, BLI_YUV_ITU_BT709);
396  }
397  else if (cp) {
398  rgb_to_hsv(
399  (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &hue, &sat, &val);
400  rgb_to_yuv((float)cp[0] / 255.0f,
401  (float)cp[0] / 255.0f,
402  (float)cp[0] / 255.0f,
403  &lum,
404  &u,
405  &v,
407  }
408 
409  SNPRINTF(str, "V:%-.4f", val);
410  BLF_position(blf_mono_font, dx, dy, 0);
411  BLF_draw(blf_mono_font, str, sizeof(str));
412  dx += BLF_width(blf_mono_font, str, sizeof(str));
413 
414  SNPRINTF(str, " L:%-.4f", lum);
415  BLF_position(blf_mono_font, dx, dy, 0);
416  BLF_draw(blf_mono_font, str, sizeof(str));
417  }
418  else if (channels >= 3) {
419  rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
420  rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v, BLI_YUV_ITU_BT709);
421 
422  SNPRINTF(str, "H:%-.4f", hue);
423  BLF_position(blf_mono_font, dx, dy, 0);
424  BLF_draw(blf_mono_font, str, sizeof(str));
425  dx += BLF_width(blf_mono_font, str, sizeof(str));
426 
427  SNPRINTF(str, " S:%-.4f", sat);
428  BLF_position(blf_mono_font, dx, dy, 0);
429  BLF_draw(blf_mono_font, str, sizeof(str));
430  dx += BLF_width(blf_mono_font, str, sizeof(str));
431 
432  SNPRINTF(str, " V:%-.4f", val);
433  BLF_position(blf_mono_font, dx, dy, 0);
434  BLF_draw(blf_mono_font, str, sizeof(str));
435  dx += BLF_width(blf_mono_font, str, sizeof(str));
436 
437  SNPRINTF(str, " L:%-.4f", lum);
438  BLF_position(blf_mono_font, dx, dy, 0);
439  BLF_draw(blf_mono_font, str, sizeof(str));
440  }
441 }
443 {
445  Histogram *hist = &sima->sample_line_hist;
446 
448  uint shdr_dashed_pos = GPU_vertformat_attr_add(
449  format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
450 
452 
453  float viewport_size[4];
454  GPU_viewport_size_get_f(viewport_size);
455  immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
456 
457  immUniform1i("colors_len", 2); /* Advanced dashes. */
458  immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
459  immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
460  immUniform1f("dash_width", 2.0f);
461  immUniform1f("dash_factor", 0.5f);
462 
464  immVertex2fv(shdr_dashed_pos, hist->co[0]);
465  immVertex2fv(shdr_dashed_pos, hist->co[1]);
466  immEnd();
467 
469  }
470 }
471 
473 {
475  Image *ima = ED_space_image(sima);
476 
477  const bool show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
478  const bool show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
479  if (ima && show_render) {
480  float zoomx, zoomy;
481  ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
482  draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy);
483  }
484 }
485 
487 {
488  Image *image = ED_space_image(sima);
489  Mask *mask = NULL;
490  if (sima->mode == SI_MODE_MASK) {
492  }
493  if (image == NULL && mask == NULL) {
494  return false;
495  }
496  if (mask == NULL) {
497  return ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE);
498  }
499  return true;
500 }
501 
503  ARegion *region,
504  const int mval[2])
505 {
506  const rcti *rect_visible = ED_region_visible_rect(region);
507  if (mval[1] > rect_visible->ymin + (16 * UI_DPI_FAC)) {
508  return false;
509  }
510  return ED_space_image_show_cache(sima);
511 }
512 
513 void draw_image_cache(const bContext *C, ARegion *region)
514 {
517  Image *image = ED_space_image(sima);
518  float x, cfra = scene->r.cfra, sfra = scene->r.sfra, efra = scene->r.efra,
519  framelen = region->winx / (efra - sfra + 1);
520  Mask *mask = NULL;
521 
522  if (!ED_space_image_show_cache(sima)) {
523  return;
524  }
525 
526  if (sima->mode == SI_MODE_MASK) {
528  }
529 
530  /* Local coordinate visible rect inside region, to accommodate overlapping ui. */
531  const rcti *rect_visible = ED_region_visible_rect(region);
532  const int region_bottom = rect_visible->ymin;
533 
535 
536  /* Draw cache background. */
538 
539  /* Draw cached segments. */
540  if (image != NULL && image->cache != NULL &&
542  int num_segments = 0;
543  int *points = NULL;
544 
545  BLI_mutex_lock(image->runtime.cache_mutex);
546  IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
547  BLI_mutex_unlock(image->runtime.cache_mutex);
548 
550  region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
551  }
552 
554 
555  /* Draw current frame. */
556  x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
557 
562  immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_DPI_FAC);
564 
565  ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC);
566 
567  if (mask != NULL) {
568  ED_mask_draw_frames(mask, region, cfra, sfra, efra);
569  }
570 }
571 
572 float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension)
573 {
574  /* UV-space length per pixel */
575  float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin));
576  float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin));
577 
578  /* Zoom_factor for UV/Image editor is calculated based on:
579  * - Default grid size on startup, which is 256x256 pixels
580  * - How blend factor for grid lines is set up in the fragment shader `grid_frag.glsl`. */
581  float zoom_factor;
582  zoom_factor = (xzoom + yzoom) / 2.0f; /* Average for accuracy. */
583  zoom_factor *= 256.0f / (powf(grid_dimension, 2));
584  return zoom_factor;
585 }
586 
588  float grid_steps[SI_GRID_STEPS_LEN],
589  const int grid_dimension)
590 {
591  if (sima->flag & SI_CUSTOM_GRID) {
592  for (int step = 0; step < SI_GRID_STEPS_LEN; step++) {
593  grid_steps[step] = powf(1, step) * (1.0f / ((float)sima->custom_grid_subdiv));
594  }
595  }
596  else {
597  for (int step = 0; step < SI_GRID_STEPS_LEN; step++) {
598  grid_steps[step] = powf(grid_dimension, step) *
599  (1.0f / (powf(grid_dimension, SI_GRID_STEPS_LEN)));
600  }
601  }
602 }
603 
604 float ED_space_image_increment_snap_value(const int grid_dimesnions,
605  const float grid_steps[SI_GRID_STEPS_LEN],
606  const float zoom_factor)
607 {
608  /* Small offset on each grid_steps[] so that snapping value doesn't change until grid lines are
609  * significantly visible.
610  * `Offset = 3/4 * (grid_steps[i] - (grid_steps[i] / grid_dimesnsions))`
611  *
612  * Refer `grid_frag.glsl` to find out when grid lines actually start appearing */
613 
614  for (int step = 0; step < SI_GRID_STEPS_LEN; step++) {
615  float offset = (3.0f / 4.0f) * (grid_steps[step] - (grid_steps[step] / grid_dimesnions));
616 
617  if ((grid_steps[step] - offset) > zoom_factor) {
618  return grid_steps[step];
619  }
620  }
621 
622  /* Fallback */
623  return grid_steps[0];
624 }
typedef float(TangentPoint)[2]
void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy)
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:824
struct RenderResult * BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima)
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima)
void BLF_color3ubv(int fontid, const unsigned char rgb[3])
Definition: blf.c:407
float BLF_width(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:688
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2)
Definition: blf.c:538
int blf_mono_font
Definition: blf.c:48
void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b)
Definition: blf.c:425
void BLF_size(int fontid, float size, int dpi)
Definition: blf.c:363
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:308
#define BLI_assert(a)
Definition: BLI_assert.h:46
#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:208
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:59
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])
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:417
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition: BLI_rect.h:173
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition: BLI_rect.h:169
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
#define SNPRINTF(dst, format,...)
Definition: BLI_string.h:485
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
void BLI_mutex_lock(ThreadMutex *mutex)
Definition: threads.cc:373
void BLI_mutex_unlock(ThreadMutex *mutex)
Definition: threads.cc:378
#define ELEM(...)
@ HISTO_FLAG_SAMPLELINE
@ IMA_SRC_MOVIE
@ IMA_SRC_VIEWER
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_R_RESULT
Object is a sort of wrapper for general info.
@ SI_CUSTOM_GRID
#define SI_GRID_STEPS_LEN
@ SI_MODE_MASK
struct Mask * ED_space_image_get_mask(const struct SpaceImage *sima)
struct Image * ED_space_image(const struct SpaceImage *sima)
void ED_space_image_get_zoom(struct SpaceImage *sima, const struct ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_mask_draw_frames(struct Mask *mask, struct ARegion *region, int cfra, int sfra, int efra)
Definition: mask_draw.c:773
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], bool full_redraw)
Definition: area.c:3591
void ED_region_cache_draw_curfra_label(int framenr, float x, float y)
Definition: area.c:3788
void ED_region_cache_draw_background(struct ARegion *region)
Definition: area.c:3774
void ED_region_cache_draw_cached_segments(struct ARegion *region, int num_segments, const int *points, int sfra, int efra)
Definition: area.c:3813
const rcti * ED_region_visible_rect(ARegion *region)
Definition: area.c:3763
void immUniform4f(const char *name, float x, float y, float z, float w)
void immUniform2f(const char *name, float x, float y)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void immUnbindProgram(void)
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 immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
GPUVertFormat * immVertexFormat(void)
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 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 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:126
void GPU_matrix_scale_2f(float x, float y)
Definition: gpu_matrix.cc:216
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
void GPU_matrix_translate_2f(float x, float y)
Definition: gpu_matrix.cc:174
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
Definition: GPU_shader.h:349
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:259
@ 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)
@ IMB_PROXY_NONE
Definition: IMB_imbuf.h:341
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.cc:489
Read Guarded memory(de)allocation.
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 or normal between and object coordinate space Combine Create a color from its hue
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 producing a negative Combine Generate a color from its red
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 producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
Platform independent time functions.
#define C
Definition: RandGen.cpp:25
#define UI_ALPHA_CHECKER_LIGHT
#define UI_UNIT_Y
#define UI_ALPHA_CHECKER_DARK
#define UI_DPI_FAC
Definition: UI_interface.h:305
#define UI_UNIT_X
@ TH_FACE_SELECT
Definition: UI_resources.h:89
@ TH_CFRAME
Definition: UI_resources.h:97
void UI_view2d_view_to_region(const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int U
Definition: btGjkEpa3.h:78
short type
short source
#define powf(x, y)
Definition: cuda/compat.h:103
Scene scene
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
rcti * RE_engine_get_current_tiles(Render *re, int *r_total_tiles, bool *r_needs_free)
Definition: engine.c:642
#define str(s)
uint pos
uint col
bool ED_space_image_show_cache(const SpaceImage *sima)
Definition: image_draw.c:486
static void draw_render_info(const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
Definition: image_draw.c:67
float ED_space_image_increment_snap_value(const int grid_dimesnions, const float grid_steps[SI_GRID_STEPS_LEN], const float zoom_factor)
Definition: image_draw.c:604
void draw_image_main_helpers(const bContext *C, ARegion *region)
Definition: image_draw.c:472
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:122
float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension)
Definition: image_draw.c:572
void draw_image_cache(const bContext *C, ARegion *region)
Definition: image_draw.c:513
void draw_image_sample_line(SpaceImage *sima)
Definition: image_draw.c:442
void ED_space_image_grid_steps(SpaceImage *sima, float grid_steps[SI_GRID_STEPS_LEN], const int grid_dimension)
Definition: image_draw.c:587
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
Definition: image_draw.c:502
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
ccl_global const KernelWorkTile * tile
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
#define ceilf(x)
Definition: metal/compat.h:225
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
Render * RE_GetSceneRender(const Scene *scene)
Definition: pipeline.c:551
float co[2][2]
struct Scene * scene
ColorManagedViewSettings view_settings
struct RenderData r
ColorManagedDisplaySettings display_settings
struct Histogram sample_line_hist
struct ImageUser iuser
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