8000 Add support for spot removal presets. by TurboGit · Pull Request #399 · darktable-org/darktable · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for spot removal presets. #399

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/develop/masks.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ void dt_masks_form_remove(struct dt_iop_module_t *module, dt_masks_form_t *grp,
void dt_masks_form_change_opacity(dt_masks_form_t *form, int parentid, int up);
void dt_masks_form_move(dt_masks_form_t *grp, int formid, int up);
int dt_masks_form_duplicate(dt_develop_t *dev, int formid);
void dt_masks_sync_clone(dt_develop_t *dev, int formid);
#endif
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
Expand Down
14 changes: 14 additions & 0 deletions src/develop/masks/masks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,20 @@ void dt_masks_cleanup_unused(dt_develop_t *dev)
dt_masks_write_forms(dev);
free(used);
}

void dt_masks_sync_clone(dt_develop_t *dev, int formid)
{
sqlite3_stmt *stmt;

// copy all the clone forms (DT_MASKS_CLONE = 8) from the image having the formid into the current image

DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "INSERT INTO mask SELECT ?1,formid,form,name,version,points,points_count,source FROM mask WHERE imgid=(SELECT imgid FROM mask WHERE formid=?2) AND form&8==8", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, dev->image_storage.id);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, formid);
sqlite3_step(stmt);
sqlite3_finalize (stmt);
}

// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-space on;
18 changes: 16 additions & 2 deletions src/iop/spots.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "develop/blend.h"
#include "control/control.h"
#include "control/conf.h"
#include "common/debug.h"
#include "gui/gtk.h"
#include <gtk/gtk.h>
#include <stdlib.h>
Expand Down Expand Up @@ -116,12 +117,25 @@ static void _resynch_params(struct dt_iop_module_t *self)
dt_iop_spots_params_t *p = (dt_iop_spots_params_t *)self->params;
dt_develop_blend_params_t *bp = self->blend_params;

// get the forms
dt_masks_form_t *grp = dt_masks_get_from_id(darktable.develop,bp->mask_id);

// if we have some masks, check if we need to clone there from another image. This is needed when applying a preset
// for example. In this case we indeed get the formid but the mask database table does not contain any information
// for the corresponding form.

if (p->clone_id[0]!=0 && grp==NULL)
{
dt_masks_sync_clone(self->dev, p->clone_id[0]);
dt_masks_read_forms(self->dev);
// then re-read the forms
grp = dt_masks_get_from_id(darktable.develop,bp->mask_id);
}

//we create 2 new buffers
int nid[64] = {0};
int nalgo[64] = {2};

//we go through all forms in blend params
dt_masks_form_t *grp = dt_masks_get_from_id(darktable.develop,bp->mask_id);
if (grp && (grp->type & DT_MASKS_GROUP))
{
GList *forms = g_list_first(grp->points);
Expand Down
0