예제 #1
0
파일: develop.c 프로젝트: rpoisel/darktable
void dt_dev_snapshot_request(dt_develop_t *dev, const char *filename)
{
  dev->proxy.snapshot.filename = filename;
  dev->proxy.snapshot.request = TRUE;
  dt_control_queue_redraw_center();
}
예제 #2
0
파일: styles.c 프로젝트: ksyz/darktable
void
dt_styles_apply_to_image(const char *name,gboolean duplicate, int32_t imgid)
{
    int id=0;
    sqlite3_stmt *stmt;

    if ((id=dt_styles_get_id_by_name(name)) != 0)
    {
        /* check if we should make a duplicate before applying style */
        if (duplicate)
            imgid = dt_image_duplicate (imgid);

        /* if merge onto history stack, lets find history offest in destination image */
        int32_t offs = 0;
#if 1
        {
            /* apply on top of history stack */
            DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select count(num) from history where imgid = ?1", -1, &stmt, NULL);
            DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
            if (sqlite3_step (stmt) == SQLITE_ROW) offs = sqlite3_column_int (stmt, 0);
        }
#else
        {
            /* replace history stack */
            DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "delete from history where imgid = ?1", -1, &stmt, NULL);
            DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
            sqlite3_step (stmt);
        }
#endif
        sqlite3_finalize (stmt);

        /* copy history items from styles onto image */
        DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "insert into history (imgid,num,module,operation,op_params,enabled,blendop_params,blendop_version) select ?1, num+?2,module,operation,op_params,enabled,blendop_params,blendop_version from style_items where styleid=?3", -1, &stmt, NULL);
        DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
        DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, offs);
        DT_DEBUG_SQLITE3_BIND_INT(stmt, 3, id);
        sqlite3_step (stmt);
        sqlite3_finalize (stmt);

        /* add tag */
        guint tagid=0;
        gchar ntag[512]= {0};
        g_snprintf(ntag,512,"darktable|style|%s",name);
        if (dt_tag_new(ntag,&tagid))
            dt_tag_attach(tagid,imgid);

        /* if current image in develop reload history */
        if (dt_dev_is_current_image(darktable.develop, imgid))
        {
            dt_dev_reload_history_items (darktable.develop);
            dt_dev_modulegroups_set(darktable.develop, dt_dev_modulegroups_get(darktable.develop));
        }

        /* update xmp file */
        dt_image_synch_xmp(imgid);

        /* remove old obsolete thumbnails */
        dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);

        /* redraw center view to update visible mipmaps */
        dt_control_queue_redraw_center();
    }
}