Blender V5.3
image_draw.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cmath>
10#include <cstdlib>
11#include <cstring>
12
13#include "DNA_mask_types.h"
14#include "DNA_scene_types.h"
15#include "DNA_screen_types.h"
16#include "DNA_space_types.h"
17#include "DNA_view2d_types.h"
18
19#include "BLI_rect.hh"
20#include "BLI_string_utf8.hh"
21#include "BLI_threads.hh"
22#include "BLI_utildefines.hh"
23
24#include "IMB_cache.hh"
26#include "IMB_imbuf_enums.h"
27
28#include "BKE_context.hh"
29#include "BKE_image.hh"
30#include "BKE_paint.hh"
31
32#include "BIF_glutil.hh"
33
34#include "GPU_immediate.hh"
35#include "GPU_immediate_util.hh"
36#include "GPU_matrix.hh"
37#include "GPU_state.hh"
38
39#include "BLF_api.hh"
40
41#include "ED_gpencil_legacy.hh"
42#include "ED_image.hh"
43#include "ED_mask.hh"
44#include "ED_render.hh"
45#include "ED_screen.hh"
46#include "ED_util.hh"
47
48#include "UI_interface.hh"
49#include "UI_resources.hh"
50#include "UI_view2d.hh"
51
52#include "RE_engine.h"
53#include "RE_pipeline.h"
54
55#include "image_intern.hh"
56
57namespace blender {
58
59static void draw_render_info(
60 const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
61{
62 Render *re = RE_GetSceneRender(scene);
63 Scene *stats_scene = ED_render_job_get_scene(C);
64 if (stats_scene == nullptr) {
65 stats_scene = scene;
66 }
67
68 RenderResult *rr = BKE_image_acquire_renderresult(stats_scene, ima);
69
70 if (rr && rr->text) {
71 float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
72 ED_region_info_draw(region, rr->text, fill_color, true);
73 }
74
75 BKE_image_release_renderresult(stats_scene, ima, rr);
76
77 if (re) {
78 int total_tiles;
79 const rcti *tiles = RE_engine_get_current_tiles(re, &total_tiles);
80
81 if (total_tiles) {
82 /* find window pixel coordinates of origin */
83 int x, y;
84 ui::view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
85
88 GPU_matrix_scale_2f(zoomx, zoomy);
89
91 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
94
95 GPU_line_width(1.0f);
96
97 const rcti *tile = tiles;
98 for (int i = 0; i < total_tiles; i++, tile++) {
99 immDrawBorderCorners(pos, tile, zoomx, zoomy);
100 }
101
103
105 }
106 }
107}
108
110 ARegion *region,
111 bool color_manage,
112 bool use_default_view,
113 int channels,
114 int x,
115 int y,
116 const uchar cp[4],
117 const float fp[4],
118 const float linearcol[4])
119{
120 rcti color_rect;
121 char str[256];
122 int dx = 6;
123 /* local coordinate visible rect inside region, to accommodate overlapping ui */
124 const rcti *rect = ED_region_visible_rect(region);
125 const int ymin = rect->ymin;
126 const int dy = ymin + 0.3f * UI_UNIT_Y;
127
128/* text colors */
129/* XXX colored text not allowed in Blender UI */
130#if 0
131 uchar red[3] = {255, 50, 50};
132 uchar green[3] = {0, 255, 0};
133 uchar blue[3] = {100, 100, 255};
134#else
135 const uchar red[3] = {255, 255, 255};
136 const uchar green[3] = {255, 255, 255};
137 const uchar blue[3] = {255, 255, 255};
138#endif
139 float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
140 float col[4], finalcol[4];
141
143
144 uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
146
147 /* noisy, high contrast make impossible to read if lower alpha is used. */
148 immUniformColor4ub(0, 0, 0, 190);
149 immRectf(pos, 0, ymin, BLI_rcti_size_x(&region->winrct) + 1, ymin + UI_UNIT_Y);
150
152
154
156
157 BLF_color3ub(blf_mono_font, 255, 255, 255);
158 SNPRINTF_UTF8(str, "X:%-4d Y:%-4d |", x, y);
159 BLF_position(blf_mono_font, dx, dy, 0);
160 BLF_draw(blf_mono_font, str, sizeof(str));
161 dx += BLF_width(blf_mono_font, str, sizeof(str));
162
163 if (channels == 1 && (cp != nullptr || fp != nullptr)) {
164 if (fp != nullptr) {
165 SNPRINTF_UTF8(str, " Val:%-.3f |", fp[0]);
166 }
167 else if (cp != nullptr) {
168 SNPRINTF_UTF8(str, " Val:%-.3f |", cp[0] / 255.0f);
169 }
170 BLF_color3ub(blf_mono_font, 255, 255, 255);
171 BLF_position(blf_mono_font, dx, dy, 0);
172 BLF_draw(blf_mono_font, str, sizeof(str));
173 dx += BLF_width(blf_mono_font, str, sizeof(str));
174 }
175
176 if (channels >= 3) {
178 if (fp) {
179 SNPRINTF_UTF8(str, " R:%-.5f", fp[0]);
180 }
181 else if (cp) {
182 SNPRINTF_UTF8(str, " R:%-3d", cp[0]);
183 }
184 else {
185 STRNCPY_UTF8(str, " R:-");
186 }
187 BLF_position(blf_mono_font, dx, dy, 0);
188 BLF_draw(blf_mono_font, str, sizeof(str));
189 dx += BLF_width(blf_mono_font, str, sizeof(str));
190
192 if (fp) {
193 SNPRINTF_UTF8(str, " G:%-.5f", fp[1]);
194 }
195 else if (cp) {
196 SNPRINTF_UTF8(str, " G:%-3d", cp[1]);
197 }
198 else {
199 STRNCPY_UTF8(str, " G:-");
200 }
201 BLF_position(blf_mono_font, dx, dy, 0);
202 BLF_draw(blf_mono_font, str, sizeof(str));
203 dx += BLF_width(blf_mono_font, str, sizeof(str));
204
206 if (fp) {
207 SNPRINTF_UTF8(str, " B:%-.5f", fp[2]);
208 }
209 else if (cp) {
210 SNPRINTF_UTF8(str, " B:%-3d", cp[2]);
211 }
212 else {
213 STRNCPY_UTF8(str, " B:-");
214 }
215 BLF_position(blf_mono_font, dx, dy, 0);
216 BLF_draw(blf_mono_font, str, sizeof(str));
217 dx += BLF_width(blf_mono_font, str, sizeof(str));
218
219 if (channels == 4) {
220 BLF_color3ub(blf_mono_font, 255, 255, 255);
221 if (fp) {
222 SNPRINTF_UTF8(str, " A:%-.4f", fp[3]);
223 }
224 else if (cp) {
225 SNPRINTF_UTF8(str, " A:%-3d", cp[3]);
226 }
227 else {
228 STRNCPY_UTF8(str, "- ");
229 }
230 BLF_position(blf_mono_font, dx, dy, 0);
231 BLF_draw(blf_mono_font, str, sizeof(str));
232 dx += BLF_width(blf_mono_font, str, sizeof(str));
233 }
234
235 if (color_manage) {
236 float rgba[4];
237
238 copy_v3_v3(rgba, linearcol);
239 if (channels == 3) {
240 rgba[3] = 1.0f;
241 }
242 else {
243 rgba[3] = linearcol[3];
244 }
245
247 rgba,
248 (use_default_view) ? nullptr :
249 &scene->view_settings,
250 &scene->display_settings,
252
253 SNPRINTF_UTF8(str, " | Display R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
254 BLF_position(blf_mono_font, dx, dy, 0);
255 BLF_draw(blf_mono_font, str, sizeof(str));
256 dx += BLF_width(blf_mono_font, str, sizeof(str));
257 }
258 }
259
260 /* color rectangle */
261 if (channels == 1) {
262 if (fp) {
263 col[0] = col[1] = col[2] = fp[0];
264 }
265 else if (cp) {
266 col[0] = col[1] = col[2] = float(cp[0]) / 255.0f;
267 }
268 else {
269 col[0] = col[1] = col[2] = 0.0f;
270 }
271 col[3] = 1.0f;
272 }
273 else if (channels == 3) {
274 copy_v3_v3(col, linearcol);
275 col[3] = 1.0f;
276 }
277 else if (channels == 4) {
278 copy_v4_v4(col, linearcol);
279 }
280 else {
281 BLI_assert(0);
282 zero_v4(col);
283 }
284
285 if (color_manage) {
287 col,
288 (use_default_view) ? nullptr :
289 &scene->view_settings,
290 &scene->display_settings);
291 }
292 else {
293 copy_v4_v4(finalcol, col);
294 }
295
297 dx += 0.25f * UI_UNIT_X;
298
299 BLI_rcti_init(&color_rect,
300 dx,
301 dx + (1.5f * UI_UNIT_X),
302 ymin + 0.15f * UI_UNIT_Y,
303 ymin + 0.85f * UI_UNIT_Y);
304
305 /* BLF uses immediate mode too, so we must reset our vertex format */
306 pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
308
309 if (channels == 4) {
310 rcti color_rect_half;
311 int color_quater_x, color_quater_y;
312
313 color_rect_half = color_rect;
314 color_rect_half.xmax = BLI_rcti_cent_x(&color_rect);
315 /* what color ??? */
316 immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
317
318 color_rect_half = color_rect;
319 color_rect_half.xmin = BLI_rcti_cent_x(&color_rect);
320
321 color_quater_x = BLI_rcti_cent_x(&color_rect_half);
322 color_quater_y = BLI_rcti_cent_y(&color_rect_half);
323
325 immRectf(pos,
326 color_rect_half.xmin,
327 color_rect_half.ymin,
328 color_rect_half.xmax,
329 color_rect_half.ymax);
330
332 immRectf(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
333 immRectf(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
334
335 if (fp != nullptr || cp != nullptr) {
337 immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f));
338 immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
340 }
341 }
342 else {
343 immUniformColor3fv(finalcol);
344 immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
345 }
347
348 /* draw outline */
349 pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
351 immUniformColor3ub(128, 128, 128);
352 imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
354
355 dx += 1.75f * UI_UNIT_X;
356
357 BLF_color3ub(blf_mono_font, 255, 255, 255);
358 if (channels == 1) {
359 if (fp) {
360 rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
361 rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v, BLI_YUV_ITU_BT709);
362 }
363 else if (cp) {
365 float(cp[0]) / 255.0f, float(cp[0]) / 255.0f, float(cp[0]) / 255.0f, &hue, &sat, &val);
366 rgb_to_yuv(float(cp[0]) / 255.0f,
367 float(cp[0]) / 255.0f,
368 float(cp[0]) / 255.0f,
369 &lum,
370 &u,
371 &v,
373 }
374
375 SNPRINTF_UTF8(str, "V:%-.4f", val);
376 BLF_position(blf_mono_font, dx, dy, 0);
377 BLF_draw(blf_mono_font, str, sizeof(str));
378 dx += BLF_width(blf_mono_font, str, sizeof(str));
379
380 SNPRINTF_UTF8(str, " L:%-.4f", lum);
381 BLF_position(blf_mono_font, dx, dy, 0);
382 BLF_draw(blf_mono_font, str, sizeof(str));
383 }
384 else if (channels >= 3) {
385 rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
386 rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v, BLI_YUV_ITU_BT709);
387
388 SNPRINTF_UTF8(str, "H:%-.4f", hue);
389 BLF_position(blf_mono_font, dx, dy, 0);
390 BLF_draw(blf_mono_font, str, sizeof(str));
391 dx += BLF_width(blf_mono_font, str, sizeof(str));
392
393 SNPRINTF_UTF8(str, " S:%-.4f", sat);
394 BLF_position(blf_mono_font, dx, dy, 0);
395 BLF_draw(blf_mono_font, str, sizeof(str));
396 dx += BLF_width(blf_mono_font, str, sizeof(str));
397
398 SNPRINTF_UTF8(str, " V:%-.4f", val);
399 BLF_position(blf_mono_font, dx, dy, 0);
400 BLF_draw(blf_mono_font, str, sizeof(str));
401 dx += BLF_width(blf_mono_font, str, sizeof(str));
402
403 SNPRINTF_UTF8(str, " L:%-.4f", lum);
404 BLF_position(blf_mono_font, dx, dy, 0);
405 BLF_draw(blf_mono_font, str, sizeof(str));
406 }
407}
409{
411 Histogram *hist = &sima->sample_line_hist;
412
413 GPUVertFormat *format = immVertexFormat();
414 uint shdr_dashed_pos = GPU_vertformat_attr_add(format, "pos", gpu::VertAttrType::SFLOAT_32_32);
415
417
418 float viewport_size[4];
419 GPU_viewport_size_get_f(viewport_size);
421 "viewport_size", viewport_size[2] / UI_SCALE_FAC, viewport_size[3] / UI_SCALE_FAC);
422
423 immUniform1i("colors_len", 2); /* Advanced dashes. */
424 immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
425 immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
426 immUniform1f("dash_width", 2.0f);
427 immUniform1f("udash_factor", 0.5f);
428
430 immVertex2fv(shdr_dashed_pos, hist->co[0]);
431 immVertex2fv(shdr_dashed_pos, hist->co[1]);
432 immEnd();
433
435 }
436}
437
439{
441 Image *ima = ED_space_image(sima);
442
443 const bool show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
444 const bool show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
445 if (ima && show_render) {
446 float zoomx, zoomy;
447 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
448 draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy);
449 }
450
451 if (sima->mode == SI_MODE_UV) {
452 const Scene *scene = CTX_data_scene(C);
453 const ToolSettings *ts = scene->toolsettings;
454 if (ts->uv_flag & UV_FLAG_CUSTOM_REGION) {
456 }
457 }
458}
459
461{
462 Image *image = ED_space_image(sima);
463 Mask *mask = nullptr;
464 if (sima->mode == SI_MODE_MASK) {
466 }
467 if (image == nullptr && mask == nullptr) {
468 return false;
469 }
470 if (mask == nullptr) {
471 return ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE);
472 }
473 return true;
474}
475
477 ARegion *region,
478 const int mval[2])
479{
480 const rcti *rect_visible = ED_region_visible_rect(region);
481 if (mval[1] > rect_visible->ymin + (16 * UI_SCALE_FAC)) {
482 return false;
483 }
484 return ED_space_image_show_cache(sima);
485}
486
487void draw_image_cache(const bContext *C, ARegion *region)
488{
490 Scene *scene = CTX_data_scene(C);
491 Image *image = ED_space_image(sima);
492 ScrArea *area = CTX_wm_area(C);
493 float x, cfra = scene->r.cfra, sfra = scene->r.sfra, efra = scene->r.efra,
494 framelen = region->winx / (efra - sfra + 1);
495 Mask *mask = nullptr;
496
497 if (!ED_space_image_show_cache(sima)) {
498 ED_area_hud_region_set_padding_flag(area, region, false);
499 return;
500 }
501
502 ED_area_hud_region_set_padding_flag(area, region, true);
503 if (sima->mode == SI_MODE_MASK) {
505 }
506
507 /* Local coordinate visible rect inside region, to accommodate overlapping ui. */
508 const rcti *rect_visible = ED_region_visible_rect(region);
509 const int region_bottom = rect_visible->ymin;
510
512
513 /* Draw cache background. */
515
516 /* Draw cached segments. */
517 if (image != nullptr && image->runtime->cache != nullptr &&
519 {
520 int num_segments = 0;
521 int *points = nullptr;
522
523 std::scoped_lock lock(image->runtime->cache_mutex);
524 IMB_cache_get_cache_segments(image->runtime->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
525
527 region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
528 }
529
531
532 /* Draw current frame. */
533 x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
534
535 uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
538 immRectf(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_SCALE_FAC);
540
542 cfra, x + roundf(framelen / 2), region_bottom + 8.0f * UI_SCALE_FAC);
543
544 if (mask != nullptr) {
545 ED_mask_draw_frames(mask, region, cfra, sfra, efra);
546 }
547}
548
549float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension)
550{
551 /* UV-space length per pixel */
552 float xzoom = (v2d->cur.xmax - v2d->cur.xmin) / float(v2d->mask.xmax - v2d->mask.xmin);
553 float yzoom = (v2d->cur.ymax - v2d->cur.ymin) / float(v2d->mask.ymax - v2d->mask.ymin);
554
555 /* Zoom_factor for UV/Image editor is calculated based on:
556 * - Default grid size on startup, which is 256x256 pixels
557 * - How blend factor for grid lines is set up in the fragment shader `grid_frag.glsl`. */
558 float zoom_factor;
559 zoom_factor = (xzoom + yzoom) / 2.0f; /* Average for accuracy. */
560 zoom_factor *= 256.0f / powf(grid_dimension, 2);
561 return zoom_factor;
562}
563
565 float grid_steps_x[SI_GRID_STEPS_LEN],
566 float grid_steps_y[SI_GRID_STEPS_LEN],
567 const int grid_dimension)
568{
570 sima->grid_shape_source);
571 for (int step = 0; step < SI_GRID_STEPS_LEN; step++) {
572 switch (grid_shape_source) {
574 grid_steps_x[step] = powf(grid_dimension, step - SI_GRID_STEPS_LEN);
575 grid_steps_y[step] = powf(grid_dimension, step - SI_GRID_STEPS_LEN);
576 break;
578 grid_steps_x[step] = 1.0f / sima->custom_grid_subdiv[0];
579 grid_steps_y[step] = 1.0f / sima->custom_grid_subdiv[1];
580 break;
581 case SI_GRID_SHAPE_PIXEL: {
582 int pixel_width = IMG_SIZE_FALLBACK;
583 int pixel_height = IMG_SIZE_FALLBACK;
584 ED_space_image_get_size(sima, &pixel_width, &pixel_height);
585 BLI_assert(pixel_width > 0 && pixel_height > 0);
586 grid_steps_x[step] = 1.0f / pixel_width;
587 grid_steps_y[step] = 1.0f / pixel_height;
588 break;
589 }
590 default:
592 }
593 }
594}
595
596float ED_space_image_increment_snap_value(const int grid_dimensions,
597 const float grid_steps[SI_GRID_STEPS_LEN],
598 const float zoom_factor)
599{
600 /* Small offset on each grid_steps[] so that snapping value doesn't change until grid lines are
601 * significantly visible.
602 * `Offset = 3/4 * (grid_steps[i] - (grid_steps[i] / grid_dimensions))`
603 *
604 * Refer `grid_frag.glsl` to find out when grid lines actually start appearing */
605
606 for (int step = 0; step < SI_GRID_STEPS_LEN; step++) {
607 float offset = (3.0f / 4.0f) * (grid_steps[step] - (grid_steps[step] / grid_dimensions));
608
609 if ((grid_steps[step] - offset) > zoom_factor) {
610 return grid_steps[step];
611 }
612 }
613
614 /* Fallback */
615 return grid_steps[0];
616}
617
618void draw_image_uv_custom_region(const ARegion *region, const rctf &custom_region)
619{
620 const uint shdr_pos = GPU_vertformat_attr_add(
621 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
622
623 GPU_line_width(1.0f);
624
626
627 float viewport_size[4];
628 GPU_viewport_size_get_f(viewport_size);
629 immUniform2f("viewport_size", viewport_size[2] / UI_SCALE_FAC, viewport_size[3] / UI_SCALE_FAC);
630
631 immUniform1i("colors_len", 0); /* "simple" mode */
632 immUniform4f("color", 1.0f, 0.25f, 0.25f, 1.0f);
633 immUniform1f("dash_width", 6.0f);
634 immUniform1f("udash_factor", 0.5f);
635 rcti region_rect;
636
637 ui::view2d_view_to_region_rcti(&region->v2d, &custom_region, &region_rect);
638
640 shdr_pos, region_rect.xmin, region_rect.ymin, region_rect.xmax, region_rect.ymax);
641
643}
644
645} // namespace blender
#define BLI_YUV_ITU_BT709
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
#define SI_GRID_STEPS_LEN
#define IMG_SIZE_FALLBACK
#define UI_SCALE_FAC
#define C
Definition RandGen.cpp:29
#define UI_ALPHA_CHECKER_LIGHT
#define UI_UNIT_Y
#define UI_ALPHA_CHECKER_DARK
#define UI_UNIT_X
volatile int lock
#define BLI_assert_unreachable()
#define ELEM(...)
#define powf(x, y)
#define roundf(x)
#define str(s)
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
const ccl_global KernelWorkTile * tile
void view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti *rect_dst) ATTR_NONNULL()
Definition view2d.cc:1767
void view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
Definition view2d.cc:1705
BMesh Iterators.
Scene * ED_render_job_get_scene(const bContext *C)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
ScrArea * CTX_wm_area(const bContext *C)
void draw_image_cache(const bContext *C, ARegion *region)
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:390
void immEnd()
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
Definition blf.cc:835
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition BKE_text.h:55
void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
Definition glutil.cc:191
void IMB_cache_get_cache_segments(ImBufCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
Definition cache.cc:491
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
bool ED_space_image_show_cache(const SpaceImage *sima)
void immUniform2f(const char *name, float x, float y)
void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b)
Definition blf.cc:495
GPUVertFormat * immVertexFormat()
void ED_region_cache_draw_background(ARegion *region)
Definition area.cc:4806
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
void draw_image_main_helpers(const bContext *C, ARegion *region)
void immBegin(GPUPrimType, uint vertex_len)
@ HISTO_FLAG_SAMPLELINE
static void draw_render_info(const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
Definition image_draw.cc:59
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
const rcti * ED_region_visible_rect(ARegion *region)
Definition area.cc:4791
void ED_image_draw_info(Scene *scene, 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])
void ED_region_cache_draw_cached_segments(ARegion *region, int num_segments, const int *points, int sfra, int efra)
Definition area.cc:4854
void immUnbindProgram()
void GPU_line_width(float width)
Definition gpu_state.cc:151
void GPU_matrix_scale_2f(float x, float y)
@ GPU_BLEND_NONE
Definition GPU_state.hh:88
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:90
MINLINE void zero_v4(float r[4])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
Render * RE_GetSceneRender(const Scene *scene)
void immUniformThemeColor(int color_id)
void BLF_size(int fontid, float size)
Definition blf.cc:445
void immUniform1f(const char *name, float x)
unsigned char uchar
Definition BKE_text.h:58
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition BLI_rect.hh:190
float ED_space_image_zoom_level(const View2D *v2d, int grid_dimension)
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:258
void BLF_color3ubv(int fontid, const unsigned char rgb[3])
Definition blf.cc:478
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void draw_image_sample_line(SpaceImage *sima)
void rgb_to_yuv(float r, float g, float b, float *r_y, float *r_u, float *r_v, int colorspace)
Definition math_color.cc:71
void GPU_matrix_translate_2f(float x, float y)
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:587
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
const rcti * RE_engine_get_current_tiles(Render *re, int *r_total_tiles)
eSpaceImage_GridShapeSource
@ SI_GRID_SHAPE_DYNAMIC
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition rct.cc:428
SpaceImage * CTX_wm_space_image(const bContext *C)
void immUniform4f(const char *name, float x, float y, float z, float w)
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void ED_mask_draw_frames(Mask *mask, ARegion *region, int cfra, int sfra, int efra)
Definition mask_draw.cc:793
void ED_area_hud_region_set_padding_flag(ScrArea *area, ARegion *changed_region, const bool set_padding=false)
Definition area.cc:851
void ED_space_image_get_zoom(SpaceImage *sima, const ARegion *region, float *r_zoomx, float *r_zoomy)
int blf_mono_font
Definition blf.cc:50
Scene * CTX_data_scene(const bContext *C)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void immUniformColor3fv(const float rgb[3])
float ED_space_image_increment_snap_value(int grid_dimensions, const float grid_steps[SI_GRID_STEPS_LEN], float zoom_factor)
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:44
void immUniform1i(const char *name, int x)
@ DISPLAY_SPACE_COLOR_INSPECTION
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition BLI_rect.hh:186
void immVertex2fv(uint attr_id, const float data[2])
void GPU_matrix_pop()
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void ED_region_cache_draw_curfra_label(int framenr, float x, float y)
Definition area.cc:4819
Image * ED_space_image(const SpaceImage *sima)
Definition image_edit.cc:43
void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float pixel[4], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW)
void ED_region_info_draw(ARegion *region, const char *text, const float fill_color[4], bool full_redraw)
Definition area.cc:4602
void draw_image_uv_custom_region(const ARegion *region, const rctf &custom_region)
void GPU_matrix_push()
Mask * ED_space_image_get_mask(const SpaceImage *sima)
void ED_space_image_grid_steps(SpaceImage *sima, float grid_steps_x[SI_GRID_STEPS_LEN], float grid_steps_y[SI_GRID_STEPS_LEN], int grid_dimension)
#define ceilf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eHistogram_Flag flag
struct Scene * scene
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings
struct RenderData r
struct ToolSettings * toolsettings
struct ImageUser iuser
eSpaceImage_GridShapeSource grid_shape_source
struct Histogram sample_line_hist
eSpaceImage_Mode mode