Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
iop_order.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2018-2019 Edgardo Hoszowski.
4 Copyright (C) 2019, 2021, 2025 Aurélien PIERRE.
5 Copyright (C) 2019 Hanno Schwalm.
6 Copyright (C) 2019 luzpaz.
7 Copyright (C) 2019 Marcus Rückert.
8 Copyright (C) 2019-2020 Pascal Obry.
9 Copyright (C) 2020 Philippe Weyland.
10 Copyright (C) 2022 Martin Bařinka.
11 Copyright (C) 2025 Alynx Zhou.
12
13 darktable is free software: you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 darktable is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with darktable. If not, see <http://www.gnu.org/licenses/>.
25*/
127#ifndef DT_IOP_ORDER_H
128#define DT_IOP_ORDER_H
129
130#ifdef HAVE_CONFIG_H
131#include "config.h"
132#endif
133
134#ifdef __cplusplus
135extern "C" {
136#endif
137
138struct dt_iop_module_t;
139struct dt_develop_t;
140struct dt_dev_pixelpipe_t;
141
142typedef enum dt_iop_order_t
143{
144 DT_IOP_ORDER_CUSTOM = 0, // a customr order (re-ordering the pipe)
145 DT_IOP_ORDER_LEGACY = 1, // up to dt 2.6.3
146 DT_IOP_ORDER_V30 = 2, // starts with dt 3.0
147 DT_IOP_ORDER_V30_JPG = 3, // same as previous but tuned for non-linear input
152
154{
155 union {
156 double iop_order_f; // only used for backward compatibility while migrating db
157 int iop_order; // order from 1 and incrementing
158 } o;
159 // operation + instance is the unique id for an active module in the pipe
160 char operation[20];
161 int32_t instance; // or previously named multi_priority
162 char name[25];
164
166{
167 char op_prev[20];
168 char op_next[20];
170
179const char *dt_iop_order_string(const dt_iop_order_t order);
180
191
202
209gboolean dt_ioppr_has_iop_order_list(int32_t imgid);
210
220GList *dt_ioppr_get_iop_order_list(int32_t imgid, gboolean sorted);
236GList *dt_ioppr_get_iop_order_link(GList *iop_order_list, const char *op_name, const int multi_priority);
245gboolean dt_ioppr_has_multiple_instances(GList *iop_order_list);
246
255int dt_ioppr_get_iop_order(GList *iop_order_list, const char *op_name, const int multi_priority);
256
264gboolean dt_ioppr_write_iop_order_list(GList *iop_order_list, const int32_t imgid);
265
273void *dt_ioppr_serialize_iop_order_list(GList *iop_order_list, size_t *size);
281GList *dt_ioppr_deserialize_iop_order_list(const char *buf, size_t size);
288char *dt_ioppr_serialize_text_iop_order_list(GList *iop_order_list);
295GList *dt_ioppr_deserialize_text_iop_order_list(const char *buf);
296
306void dt_ioppr_insert_module_instance(struct dt_develop_t *dev, struct dt_iop_module_t *module);
326void dt_ioppr_resync_pipeline(struct dt_develop_t *dev, const int32_t imgid, const char *msg, gboolean check_duplicates);
327
334void dt_ioppr_rebuild_iop_order_from_modules(struct dt_develop_t *dev, GList *ordered_modules);
335
343void dt_ioppr_update_for_style_items(struct dt_develop_t *dev, GList *st_items, gboolean append);
351void dt_ioppr_update_for_modules(struct dt_develop_t *dev, GList *modules, gboolean append);
352
361void dt_ioppr_set_default_iop_order(struct dt_develop_t *dev, const int32_t imgid);
369void dt_ioppr_change_iop_order(struct dt_develop_t *dev, const int32_t imgid, GList *new_iop_list);
370
378int dt_ioppr_check_so_iop_order(GList *iop_list, GList *iop_order_list);
379
386
393GList *dt_ioppr_iop_order_copy_deep(GList *iop_order_list);
394
402gint dt_sort_iop_by_order(gconstpointer a, gconstpointer b);
410gint dt_sort_iop_list_by_order_f(gconstpointer a, gconstpointer b);
411
420gboolean dt_ioppr_check_can_move_before_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next);
429gboolean dt_ioppr_check_can_move_after_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev);
430
441gboolean dt_ioppr_move_iop_before(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next);
452gboolean dt_ioppr_move_iop_after(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev);
453
464int dt_ioppr_check_iop_order(struct dt_develop_t *dev, const int32_t imgid, const char *msg);
465
466#ifdef __cplusplus
467}
468#endif
469
470#endif
471// clang-format off
472// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
473// vim: shiftwidth=2 expandtab tabstop=2 cindent
474// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
475// clang-format on
GList * dt_ioppr_get_iop_order_list(int32_t imgid, gboolean sorted)
Load the order list for an image from the DB.
Definition iop_order.c:1076
gboolean dt_ioppr_has_multiple_instances(GList *iop_order_list)
Detect whether multiple instances are grouped for a non-custom order.
Definition iop_order.c:925
gboolean dt_ioppr_has_iop_order_list(int32_t imgid)
Check whether the image has an explicit order list stored in DB.
Definition iop_order.c:1053
void * dt_ioppr_serialize_iop_order_list(GList *iop_order_list, size_t *size)
Serialize an order list into a binary blob (used for presets).
Definition iop_order.c:2430
GList * dt_ioppr_get_iop_order_list_version(dt_iop_order_t version)
Return the built-in order list for a given version.
Definition iop_order.c:1024
gint dt_sort_iop_list_by_order_f(gconstpointer a, gconstpointer b)
Compare two list nodes holding modules by iop_order.
Definition iop_order.c:879
void dt_ioppr_update_for_modules(struct dt_develop_t *dev, GList *modules, gboolean append)
Update dev->iop_order_list with modules from a module list.
Definition iop_order.c:1723
gint dt_sort_iop_by_order(gconstpointer a, gconstpointer b)
Compare two module instances by iop_order for sorting.
Definition iop_order.c:1941
GList * dt_ioppr_get_iop_order_rules()
Return the list of ordering rules (prev/next constraints).
Definition iop_order.c:779
int dt_ioppr_check_iop_order(struct dt_develop_t *dev, const int32_t imgid, const char *msg)
Debug helper to validate the current order for a develop context.
Definition iop_order.c:2316
gboolean dt_ioppr_check_can_move_after_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev)
Validate whether module can be moved after module_prev.
Definition iop_order.c:2123
gboolean dt_ioppr_move_iop_after(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev)
Move a module instance after another module in the pipe.
Definition iop_order.c:2190
void dt_ioppr_set_default_iop_order(struct dt_develop_t *dev, const int32_t imgid)
Set dev->iop_order_list to the default order for a given image.
Definition iop_order.c:1289
void dt_ioppr_rebuild_iop_order_from_modules(struct dt_develop_t *dev, GList *ordered_modules)
Rebuild dev->iop_order_list from a list of ordered modules.
Definition iop_order.c:1258
void dt_ioppr_resync_modules_order(struct dt_develop_t *dev)
Update dev->iop module order values from dev->iop_order_list.
Definition iop_order.c:1235
GList * dt_ioppr_iop_order_copy_deep(GList *iop_order_list)
Deep-copy an order list.
Definition iop_order.c:1935
gboolean dt_ioppr_write_iop_order_list(GList *iop_order_list, const int32_t imgid)
Persist an order list to the DB for a given image.
Definition iop_order.c:993
int dt_ioppr_get_iop_order(GList *iop_order_list, const char *op_name, const int multi_priority)
Return the iop_order for a given operation/instance pair.
Definition iop_order.c:854
int dt_ioppr_check_so_iop_order(GList *iop_list, GList *iop_order_list)
Check whether any module .so is missing an iop_order entry.
Definition iop_order.c:1899
gboolean dt_ioppr_move_iop_before(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next)
Move a module instance before another module in the pipe.
Definition iop_order.c:2158
dt_iop_order_t
Definition iop_order.h:143
@ DT_IOP_ORDER_ANSEL_RAW
Definition iop_order.h:148
@ DT_IOP_ORDER_LEGACY
Definition iop_order.h:145
@ DT_IOP_ORDER_LAST
Definition iop_order.h:150
@ DT_IOP_ORDER_V30_JPG
Definition iop_order.h:147
@ DT_IOP_ORDER_V30
Definition iop_order.h:146
@ DT_IOP_ORDER_CUSTOM
Definition iop_order.h:144
@ DT_IOP_ORDER_ANSEL_JPG
Definition iop_order.h:149
dt_iop_order_t dt_ioppr_get_iop_order_list_kind(GList *iop_order_list)
Determine the kind of an order list by inspecting its content.
Definition iop_order.c:891
gboolean dt_ioppr_check_can_move_before_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next)
Validate whether module can be moved before module_next.
Definition iop_order.c:1954
char * dt_ioppr_serialize_text_iop_order_list(GList *iop_order_list)
Serialize an order list to a text representation.
Definition iop_order.c:2472
GList * dt_ioppr_deserialize_text_iop_order_list(const char *buf)
Deserialize an order list from a text representation.
Definition iop_order.c:2527
void dt_ioppr_update_for_style_items(struct dt_develop_t *dev, GList *st_items, gboolean append)
Update dev->iop_order_list with modules referenced by style items.
Definition iop_order.c:1686
const char * dt_iop_order_string(const dt_iop_order_t order)
Return the human-readable name for an IOP order enum value.
Definition iop_order.c:78
void dt_ioppr_resync_pipeline(struct dt_develop_t *dev, const int32_t imgid, const char *msg, gboolean check_duplicates)
Resynchronize pipeline order and related structures.
Definition iop_order.c:1227
dt_iop_order_t dt_ioppr_get_iop_order_version(const int32_t imgid)
Fetch the IOP order version stored for an image.
Definition iop_order.c:759
GList * dt_ioppr_deserialize_iop_order_list(const char *buf, size_t size)
Deserialize an order list from a binary blob.
Definition iop_order.c:2569
void dt_ioppr_insert_module_instance(struct dt_develop_t *dev, struct dt_iop_module_t *module)
Ensure a module instance has an entry in dev->iop_order_list.
Definition iop_order.c:2288
void dt_ioppr_change_iop_order(struct dt_develop_t *dev, const int32_t imgid, GList *new_iop_list)
Replace the current order list with a new one and persist it.
Definition iop_order.c:1326
GList * dt_ioppr_get_iop_order_link(GList *iop_order_list, const char *op_name, const int multi_priority)
Find a list link matching an operation and instance.
Definition iop_order.c:816
size_t size
Definition mipmap_cache.c:3
Definition pixelpipe_hb.h:218
Definition develop.h:159
Definition imageop.h:246
Definition iop_order.h:154
char name[25]
Definition iop_order.h:162
int iop_order
Definition iop_order.h:157
char operation[20]
Definition iop_order.h:160
union dt_iop_order_entry_t::@8 o
double iop_order_f
Definition iop_order.h:156
int32_t instance
Definition iop_order.h:161
Definition iop_order.h:166
char op_prev[20]
Definition iop_order.h:167
char op_next[20]
Definition iop_order.h:168