Skip to content

Commit 4d4b8e9

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Visualize mask in developer mode
The way we visualize masks is good while developing the image in most cases, especially if debugging code or trying to understand why some masks "misbehave" we might want to see the masks without "distraction" from image content. Enabled by the hidden boolean conf key "darkroom/ui/develop_mask"
1 parent 5d3bf03 commit 4d4b8e9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

data/darktableconfig.xml.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,6 +2463,13 @@
24632463
<shortdescription>show loading screen between images</shortdescription>
24642464
<longdescription>show gray loading screen when navigating between images in the darkroom\ndisable to just show a toast message</longdescription>
24652465
</dtconfig>
2466+
<dtconfig>
2467+
<name>darkroom/ui/develop_mask</name>
2468+
<type>bool</type>
2469+
<default>false</default>
2470+
<shortdescription>show mask in developer mode</shortdescription>
2471+
<longdescription>if switched on, the mask visualize button will show the 'pure mask' instead of mask and image content.</longdescription>
2472+
</dtconfig>
24662473
<dtconfig prefs="processing" section="general">
24672474
<name>plugins/lighttable/export/pixel_interpolator_warp</name>
24682475
<type>

src/iop/gamma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ static void _mask_display(const float *const restrict in,
305305
{
306306
// yellow, "unused" element aids vectorization
307307
const dt_aligned_pixel_t mask_color = { 1.0f, 1.0f, 0.0f };
308-
308+
const gboolean devel = dt_conf_get_bool("darkroom/ui/develop_mask");
309309
#ifdef _OPENMP
310310
#pragma omp parallel for simd default(none) schedule(static) \
311311
aligned(in, out: 64) aligned(mask_color: 16) \
312-
dt_omp_firstprivate(in, out, buffsize, alpha, mask_color)
312+
dt_omp_firstprivate(in, out, buffsize, alpha, mask_color, devel)
313313
#endif
314314
for(size_t j = 0; j < buffsize; j+= 4)
315315
{
316-
const float gray = 0.3f * in[j + 0] + 0.59f * in[j + 1] + 0.11f * in[j + 2];
316+
const float gray = devel ? in[j + 3] : (0.3f * in[j + 0] + 0.59f * in[j + 1] + 0.11f * in[j + 2]);
317317
const dt_aligned_pixel_t pixel = { gray, gray, gray, gray };
318318
_write_pixel(pixel, out + j, mask_color, in[j + 3] * alpha);
319319
}

0 commit comments

Comments
 (0)