Blender V5.0
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.h"
20#include "BLI_string_utf8.h"
21#include "BLI_threads.h"
22#include "BLI_utildefines.h"
23
25#include "IMB_imbuf_enums.h"
26#include "IMB_moviecache.hh"
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
57static void draw_render_info(
58 const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
59{
60 Render *re = RE_GetSceneRender(scene);
61 Scene *stats_scene = ED_render_job_get_scene(C);
62 if (stats_scene == nullptr) {
63 stats_scene = scene;
64 }
65
66 RenderResult *rr = BKE_image_acquire_renderresult(stats_scene, ima);
67
68 if (rr && rr->text) {
69 float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
70 ED_region_info_draw(region, rr->text, fill_color, true);
71 }
72
73 BKE_image_release_renderresult(stats_scene, ima, rr);
74
75 if (re) {
76 int total_tiles;
77 const rcti *tiles = RE_engine_get_current_tiles(re, &total_tiles);
78
79 if (total_tiles) {
80 /* find window pixel coordinates of origin */
81 int x, y;
82 UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
83
86 GPU_matrix_scale_2f(zoomx, zoomy);
87
89 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
92
93 GPU_line_width(1.0f);
94
95 const rcti *tile = tiles;
96 for (int i = 0; i < total_tiles; i++, tile++) {
97 immDrawBorderCorners(pos, tile, zoomx, zoomy);
98 }
99
101
103 }
104 }
105}
106
108 ARegion *region,
109 bool color_manage,
110 bool use_default_view,
111 int channels,
112 int x,
113 int y,
114 const uchar cp[4],
115 const float fp[4],
116 const float linearcol[4])
117{
118 rcti color_rect;
119 char str[256];
120 int dx = 6;
121 /* local coordinate visible rect inside region, to accommodate overlapping ui */
122 const rcti *rect = ED_region_visible_rect(region);
123 const int ymin = rect->ymin;
124 const int dy = ymin + 0.3f * UI_UNIT_Y;
125
126/* text colors */
127/* XXX colored text not allowed in Blender UI */
128#if 0
129 uchar red[3] = {255, 50, 50};
130 uchar green[3] = {0, 255, 0};
131 uchar blue[3] = {100, 100, 255};
132#else
133 const uchar red[3] = {255, 255, 255};
134 const uchar green[3] = {255, 255, 255};
135 const uchar blue[3] = {255, 255, 255};
136#endif
137 float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
138 float col[4], finalcol[4];
139
141
143 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
145
146 /* noisy, high contrast make impossible to read if lower alpha is used. */
147 immUniformColor4ub(0, 0, 0, 190);
148 immRectf(pos, 0, ymin, BLI_rcti_size_x(&region->winrct) + 1, ymin + UI_UNIT_Y);
149
151
153
155
156 BLF_color3ub(blf_mono_font, 255, 255, 255);
157 SNPRINTF_UTF8(str, "X:%-4d Y:%-4d |", x, y);
158 BLF_position(blf_mono_font, dx, dy, 0);
159 BLF_draw(blf_mono_font, str, sizeof(str));
160 dx += BLF_width(blf_mono_font, str, sizeof(str));
161
162 if (channels == 1 && (cp != nullptr || fp != nullptr)) {
163 if (fp != nullptr) {
164 SNPRINTF_UTF8(str, " Val:%-.3f |", fp[0]);
165 }
166 else if (cp != nullptr) {
167 SNPRINTF_UTF8(str, " Val:%-.3f |", cp[0] / 255.0f);
168 }
169 BLF_color3ub(blf_mono_font, 255, 255, 255);
170 BLF_position(blf_mono_font, dx, dy, 0);
171 BLF_draw(blf_mono_font, str, sizeof(str));
172 dx += BLF_width(blf_mono_font, str, sizeof(str));
173 }
174
175 if (channels >= 3) {
177 if (fp) {
178 SNPRINTF_UTF8(str, " R:%-.5f", fp[0]);
179 }
180 else if (cp) {
181 SNPRINTF_UTF8(str, " R:%-3d", cp[0]);
182 }
183 else {
184 STRNCPY_UTF8(str, " R:-");
185 }
186 BLF_position(blf_mono_font, dx, dy, 0);
187 BLF_draw(blf_mono_font, str, sizeof(str));
188 dx += BLF_width(blf_mono_font, str, sizeof(str));
189
191 if (fp) {
192 SNPRINTF_UTF8(str, " G:%-.5f", fp[1]);
193 }
194 else if (cp) {
195 SNPRINTF_UTF8(str, " G:%-3d", cp[1]);
196 }
197 else {
198 STRNCPY_UTF8(str, " G:-");
199 }
200 BLF_position(blf_mono_font, dx, dy, 0);
201 BLF_draw(blf_mono_font, str, sizeof(str));
202 dx += BLF_width(blf_mono_font, str, sizeof(str));
203
205 if (fp) {
206 SNPRINTF_UTF8(str, " B:%-.5f", fp[2]);
207 }
208 else if (cp) {
209 SNPRINTF_UTF8(str, " B:%-3d", cp[2]);
210 }
211 else {
212 STRNCPY_UTF8(str, " B:-");
213 }
214 BLF_position(blf_mono_font, dx, dy, 0);
215 BLF_draw(blf_mono_font, str, sizeof(str));
216 dx += BLF_width(blf_mono_font, str, sizeof(str));
217
218 if (channels == 4) {
219 BLF_color3ub(blf_mono_font, 255, 255, 255);
220 if (fp) {
221 SNPRINTF_UTF8(str, " A:%-.4f", fp[3]);
222 }
223 else if (cp) {
224 SNPRINTF_UTF8(str, " A:%-3d", cp[3]);
225 }
226 else {
227 STRNCPY_UTF8(str, "- ");
228 }
229 BLF_position(blf_mono_font, dx, dy, 0);
230 BLF_draw(blf_mono_font, str, sizeof(str));
231 dx += BLF_width(blf_mono_font, str, sizeof(str));
232 }
233
234 if (color_manage) {
235 float rgba[4];
236
237 copy_v3_v3(rgba, linearcol);
238 if (channels == 3) {
239 rgba[3] = 1.0f;
240 }
241 else {
242 rgba[3] = linearcol[3];
243 }
244
246 rgba,
247 (use_default_view) ? nullptr :
248 &scene->view_settings,
249 &scene->display_settings,
251
252 SNPRINTF_UTF8(str, " | Display R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
253 BLF_position(blf_mono_font, dx, dy, 0);
254 BLF_draw(blf_mono_font, str, sizeof(str));
255 dx += BLF_width(blf_mono_font, str, sizeof(str));
256 }
257 }
258
259 /* color rectangle */
260 if (channels == 1) {
261 if (fp) {
262 col[0] = col[1] = col[2] = fp[0];
263 }
264 else if (cp) {
265 col[0] = col[1] = col[2] = float(cp[0]) / 255.0f;
266 }
267 else {
268 col[0] = col[1] = col[2] = 0.0f;
269 }
270 col[3] = 1.0f;
271 }
272 else if (channels == 3) {
273 copy_v3_v3(col, linearcol);
274 col[3] = 1.0f;
275 }
276 else if (channels == 4) {
277 copy_v4_v4(col, linearcol);
278 }
279 else {
280 BLI_assert(0);
281 zero_v4(col);
282 }
283
284 if (color_manage) {
286 col,
287 (use_default_view) ? nullptr :
288 &scene->view_settings,
289 &scene->display_settings);
290 }
291 else {
292 copy_v4_v4(finalcol, col);
293 }
294
296 dx += 0.25f * UI_UNIT_X;
297
298 BLI_rcti_init(&color_rect,
299 dx,
300 dx + (1.5f * UI_UNIT_X),
301 ymin + 0.15f * UI_UNIT_Y,
302 ymin + 0.85f * UI_UNIT_Y);
303
304 /* BLF uses immediate mode too, so we must reset our vertex format */
306 immVertexFormat(), "pos", blender::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
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 */
350 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
352 immUniformColor3ub(128, 128, 128);
353 imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
355
356 dx += 1.75f * UI_UNIT_X;
357
358 BLF_color3ub(blf_mono_font, 255, 255, 255);
359 if (channels == 1) {
360 if (fp) {
361 rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
362 rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v, BLI_YUV_ITU_BT709);
363 }
364 else if (cp) {
366 float(cp[0]) / 255.0f, float(cp[0]) / 255.0f, float(cp[0]) / 255.0f, &hue, &sat, &val);
367 rgb_to_yuv(float(cp[0]) / 255.0f,
368 float(cp[0]) / 255.0f,
369 float(cp[0]) / 255.0f,
370 &lum,
371 &u,
372 &v,
374 }
375
376 SNPRINTF_UTF8(str, "V:%-.4f", val);
377 BLF_position(blf_mono_font, dx, dy, 0);
378 BLF_draw(blf_mono_font, str, sizeof(str));
379 dx += BLF_width(blf_mono_font, str, sizeof(str));
380
381 SNPRINTF_UTF8(str, " L:%-.4f", lum);
382 BLF_position(blf_mono_font, dx, dy, 0);
383 BLF_draw(blf_mono_font, str, sizeof(str));
384 }
385 else if (channels >= 3) {
386 rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
387 rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v, BLI_YUV_ITU_BT709);
388
389 SNPRINTF_UTF8(str, "H:%-.4f", hue);
390 BLF_position(blf_mono_font, dx, dy, 0);
391 BLF_draw(blf_mono_font, str, sizeof(str));
392 dx += BLF_width(blf_mono_font, str, sizeof(str));
393
394 SNPRINTF_UTF8(str, " S:%-.4f", sat);
395 BLF_position(blf_mono_font, dx, dy, 0);
396 BLF_draw(blf_mono_font, str, sizeof(str));
397 dx += BLF_width(blf_mono_font, str, sizeof(str));
398
399 SNPRINTF_UTF8(str, " V:%-.4f", val);
400 BLF_position(blf_mono_font, dx, dy, 0);
401 BLF_draw(blf_mono_font, str, sizeof(str));
402 dx += BLF_width(blf_mono_font, str, sizeof(str));
403
404 SNPRINTF_UTF8(str, " L:%-.4f", lum);
405 BLF_position(blf_mono_font, dx, dy, 0);
406 BLF_draw(blf_mono_font, str, sizeof(str));
407 }
408}
410{
412 Histogram *hist = &sima->sample_line_hist;
413
415 uint shdr_dashed_pos = GPU_vertformat_attr_add(
416 format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
417
419
420 float viewport_size[4];
421 GPU_viewport_size_get_f(viewport_size);
423 "viewport_size", viewport_size[2] / UI_SCALE_FAC, viewport_size[3] / UI_SCALE_FAC);
424
425 immUniform1i("colors_len", 2); /* Advanced dashes. */
426 immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
427 immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
428 immUniform1f("dash_width", 2.0f);
429 immUniform1f("udash_factor", 0.5f);
430
432 immVertex2fv(shdr_dashed_pos, hist->co[0]);
433 immVertex2fv(shdr_dashed_pos, hist->co[1]);
434 immEnd();
435
437 }
438}
439
441{
443 Image *ima = ED_space_image(sima);
444
445 const bool show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
446 const bool show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
447 if (ima && show_render) {
448 float zoomx, zoomy;
449 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
450 draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy);
451 }
452
453 if (sima->mode == SI_MODE_UV) {
454 const Scene *scene = CTX_data_scene(C);
455 const ToolSettings *ts = scene->toolsettings;
456 if (ts->uv_flag & UV_FLAG_CUSTOM_REGION) {
458 }
459 }
460}
461
463{
464 Image *image = ED_space_image(sima);
465 Mask *mask = nullptr;
466 if (sima->mode == SI_MODE_MASK) {
468 }
469 if (image == nullptr && mask == nullptr) {
470 return false;
471 }
472 if (mask == nullptr) {
473 return ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE);
474 }
475 return true;
476}
477
479 ARegion *region,
480 const int mval[2])
481{
482 const rcti *rect_visible = ED_region_visible_rect(region);
483 if (mval[1] > rect_visible->ymin + (16 * UI_SCALE_FAC)) {
484 return false;
485 }
486 return ED_space_image_show_cache(sima);
487}
488
489void draw_image_cache(const bContext *C, ARegion *region)
490{
492 Scene *scene = CTX_data_scene(C);
493 Image *image = ED_space_image(sima);
494 float x, cfra = scene->r.cfra, sfra = scene->r.sfra, efra = scene->r.efra,
495 framelen = region->winx / (efra - sfra + 1);
496 Mask *mask = nullptr;
497
498 if (!ED_space_image_show_cache(sima)) {
499 return;
500 }
501
502 if (sima->mode == SI_MODE_MASK) {
504 }
505
506 /* Local coordinate visible rect inside region, to accommodate overlapping ui. */
507 const rcti *rect_visible = ED_region_visible_rect(region);
508 const int region_bottom = rect_visible->ymin;
509
511
512 /* Draw cache background. */
514
515 /* Draw cached segments. */
516 if (image != nullptr && image->cache != nullptr &&
518 {
519 int num_segments = 0;
520 int *points = nullptr;
521
522 std::scoped_lock lock(image->runtime->cache_mutex);
523 IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
524
526 region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
527 }
528
530
531 /* Draw current frame. */
532 x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
533
535 immVertexFormat(), "pos", blender::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", blender::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}
void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
Definition glutil.cc:633
SpaceImage * CTX_wm_space_image(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
void BLF_size(int fontid, float size)
Definition blf.cc:443
void BLF_color3ubv(int fontid, const unsigned char rgb[3])
Definition blf.cc:476
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:585
int blf_mono_font
Definition blf.cc:48
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:802
void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b)
Definition blf.cc:493
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:388
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#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)
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:67
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.cc:414
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition BLI_rect.h:181
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition BLI_rect.h:177
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
unsigned char uchar
unsigned int uint
#define ELEM(...)
@ HISTO_FLAG_SAMPLELINE
@ IMA_SRC_MOVIE
@ IMA_SRC_VIEWER
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_R_RESULT
@ UV_FLAG_CUSTOM_REGION
#define SI_GRID_STEPS_LEN
eSpaceImage_GridShapeSource
@ SI_GRID_SHAPE_FIXED
@ SI_GRID_SHAPE_PIXEL
@ SI_GRID_SHAPE_DYNAMIC
@ SI_MODE_MASK
@ SI_MODE_UV
#define IMG_SIZE_FALLBACK
#define UI_SCALE_FAC
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
void ED_space_image_get_zoom(SpaceImage *sima, const ARegion *region, float *r_zoomx, float *r_zoomy)
Image * ED_space_image(const SpaceImage *sima)
Definition image_edit.cc:40
Mask * ED_space_image_get_mask(const SpaceImage *sima)
void ED_mask_draw_frames(Mask *mask, ARegion *region, int cfra, int sfra, int efra)
Definition mask_draw.cc:791
Scene * ED_render_job_get_scene(const bContext *C)
void ED_region_info_draw(ARegion *region, const char *text, const float fill_color[4], bool full_redraw)
Definition area.cc:4128
void ED_region_cache_draw_cached_segments(ARegion *region, int num_segments, const int *points, int sfra, int efra)
Definition area.cc:4362
const rcti * ED_region_visible_rect(ARegion *region)
Definition area.cc:4301
void ED_region_cache_draw_background(ARegion *region)
Definition area.cc:4312
void ED_region_cache_draw_curfra_label(int framenr, float x, float y)
Definition area.cc:4326
void immUniform4f(const char *name, float x, float y, float z, float w)
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immUniform2f(const char *name, float x, float y)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void immUniformThemeColor(int color_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 immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immUniformColor3fv(const float rgb[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void GPU_matrix_scale_2f(float x, float y)
void GPU_matrix_push()
void GPU_matrix_pop()
void GPU_matrix_translate_2f(float x, float y)
@ GPU_PRIM_LINES
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_line_width(float width)
Definition gpu_state.cc:166
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:42
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:273
uint GPU_vertformat_attr_add(GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float pixel[4], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW)
@ DISPLAY_SPACE_COLOR_INSPECTION
@ IMB_PROXY_NONE
void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
#define C
Definition RandGen.cpp:29
#define UI_ALPHA_CHECKER_LIGHT
#define UI_UNIT_Y
#define UI_ALPHA_CHECKER_DARK
#define UI_UNIT_X
@ TH_FACE_SELECT
@ TH_CFRAME
void UI_view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
Definition view2d.cc:1723
void UI_view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti *rect_dst) ATTR_NONNULL()
Definition view2d.cc:1786
volatile int lock
ATTR_WARN_UNUSED_RESULT const BMVert * v
nullptr float
#define powf(x, y)
#define roundf(x)
#define str(s)
uint pos
uint col
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
bool ED_space_image_show_cache(const SpaceImage *sima)
static void draw_render_info(const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
Definition image_draw.cc:57
void draw_image_main_helpers(const bContext *C, ARegion *region)
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])
void draw_image_uv_custom_region(const ARegion *region, const rctf &custom_region)
void ED_space_image_grid_steps(SpaceImage *sima, float grid_steps_x[SI_GRID_STEPS_LEN], float grid_steps_y[SI_GRID_STEPS_LEN], const int grid_dimension)
float ED_space_image_zoom_level(const View2D *v2d, const int grid_dimension)
void draw_image_cache(const bContext *C, ARegion *region)
void draw_image_sample_line(SpaceImage *sima)
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
float ED_space_image_increment_snap_value(const int grid_dimensions, const float grid_steps[SI_GRID_STEPS_LEN], const float zoom_factor)
const rcti * RE_engine_get_current_tiles(Render *re, int *r_total_tiles)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
const ccl_global KernelWorkTile * tile
format
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
#define ceilf
Render * RE_GetSceneRender(const Scene *scene)
float co[2][2]
struct Scene * scene
struct MovieCache * cache
short source
ImageRuntimeHandle * runtime
struct ToolSettings * toolsettings
ColorManagedViewSettings view_settings
struct RenderData r
ColorManagedDisplaySettings display_settings
struct Histogram sample_line_hist
int custom_grid_subdiv[2]
struct ImageUser iuser
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
i
Definition text_draw.cc:230