-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow raster mask to be combined with drawn & parametric mask #19819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow raster mask to be combined with drawn & parametric mask #19819
Conversation
|
I've had thoughts about adding raster masks to the conditional blending, but never got around to implementing anything. My idea was to treat the raster mask as just another "shape" in drawn masks (which would also allow multiple rasters to be combined with AND/OR/XOR/ANDNOT). Internally, darktable generates a raster mask for each drawn shape and then merges those layers into the final drawn mask. Adding a raster as another layer would take very little code beyond the GUI stuff to select the raster. |
|
@ralfbrown Sounds good! What I've been thinking is to multiply the raster mask with the mask generated by drawn and/or parametric mask. Can you point me to the function that merges layers into the final drawn mask? |
|
Not an expert on that part of the codebase, but I'd start in files src/develop/masks.h and src/develop/masks/masks.c. My suggestion after a quick scan of those files: Add a new value to After that, there's a good chance that the existing machinery will just work, letting you use the mask manager module to specify combination methods (union/intersection/diff/sum). |
|
@stnKrisna : Please do not |
|
@ralfbrown It took me a while to implement this. But I got a working prototype. Also, as of now, I don't think any of the mask operations are working. The only way to invert the raster mask is to invert it in another module (or original module) before using it. As of now, to load the raster mask into the drawn mask, you'd need to configure the raster map and switching back to the drawn & parametric mask. I need suggestion how to best load the raster mask into the raster shape. Also, it's currently not possible to select the raster "shape" in the viewport, as I think this would block selection of other drawn masks. When updating shape of the raster mask, it will not update the mask value when used in the parametric "shape". |
Yeah, that might be tricky. The obvious idea is to treat raster as being "behind" all drawn shapes, i.e. selected whenever the mouse is not over or near-enough a drawn shape. You can probably achieve that by returning a fixed distance equal to the maximum distance at which a shape gets selected. Won't help when multiple raster masks are enabled, though, and I'm not sure how to indicate that the raster is currently selected (beyond the hinter message) since there's no outline to emphasize. |
|
If you're expanding mask functionality, I offer up this - |
|
@stnKrisna , what do you think of the link I posted above? If you're going to do appreciable work in this area, it would be good to make it as generally useful as reasonably possible. |
|
Hi, im currently out on holiday. I’ll get back in 2 weeks.
…On Sat, Jan 10, 2026 at 9:21 AM Andrew ***@***.***> wrote:
*RawConvert* left a comment (darktable-org/darktable#19819)
<#19819 (comment)>
@stnKrisna <https://github.com/stnKrisna> , what do you think of the link
I posted above? If you're going to do appreciable work in this area, it
would be good to make it as generally useful as reasonably possible.
—
Reply to this email directly, view it on GitHub
<#19819 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAVNDBOEZKEUVDORVPDXFT4GASW7AVCNFSM6AAAAACNEQISNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMZQG43TMNJXGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@RawConvert I like the idea of the Mask Manipulator Module as currently the bug that I still cannot solve revolves around reading the raster mask when the same shape group with a raster shape is used by multiple modules. I'll see how this can be done as im not 100% familiar with the codebase |
|
@stnKrisna , I'm pleased you like the idea. If and when you get something working, I will try to support with some testing, if that helps. |
|
@stnKrisna If you decide to pursue the suggested new module, I suggest you open an RFC first to inform everyone what you're planning and get some feedback since you'll be replacing the current mask manager module. I would also suggest you not add it on to this PR. If you can't do this PR without it, then I would close this PR and open a new one. EDIT: You might want to look at #20123. |
|
I would like to not see a new module. If the mask manager must be extended or changed deeply no problem as the libs modules are not versioned so won't break anything. I'm also not convinced that adding a raster mask section is a good move. Why? Because the raster masks are kind of temporary solution that will be replaced when we have a way to vectorize them and so handle them as all other masks. At this stage I don't think we want to have the raster mask more visible and certainly not a first class citizen in the UI. |
|
@TurboGit Do you recommend me continuing what I've been doing for now or pause work until vectorisation of the raster mask is implemented? From what I've gathered, implementing a new module will require me to reimplement all of the logic for the masking, since the module will have to output a new raster mask. |
|
@stnKrisna : I will recommend to pause this until we have a clear view/design for the long run about raster masks, vectorisation and how to deal with them. |
|
@TurboGit , re. "I don't think we want to have the raster mask more visible and certainly not a first class citizen in the UI." Why do you say this? - is it because they use lots of memory? |
No because a raster mask is not saved into the XMP. It is an external resource that can't be easily shared. To avoid that we need to vectorize the raster masks and in this case the mask will be saved into the XMP. That's the goal of #20198. Last but not least this will be the base for AI masking is someone what to work on this topic. |




The idea is to use external raster mask to mask out areas parametric & drawn mask that we don't want them to take effect (i.e. background exposure).
Changes to pixel pipeline is not implemented yet