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
150
152{
153 union {
154 double iop_order_f; // only used for backward compatibility while migrating db
155 int iop_order; // order from 1 and incrementing
156 } o;
157 // operation + instance is the unique id for an active module in the pipe
158 char operation[20];
159 int32_t instance; // or previously named multi_priority
160 char name[25];
162
164{
165 char op_prev[20];
166 char op_next[20];
168
177const char *dt_iop_order_string(const dt_iop_order_t order);
178
189
200
207gboolean dt_ioppr_has_iop_order_list(int32_t imgid);
208
218GList *dt_ioppr_get_iop_order_list(int32_t imgid, gboolean sorted);
234GList *dt_ioppr_get_iop_order_link(GList *iop_order_list, const char *op_name, const int multi_priority);
243gboolean dt_ioppr_has_multiple_instances(GList *iop_order_list);
244
253int dt_ioppr_get_iop_order(GList *iop_order_list, const char *op_name, const int multi_priority);
254
262gboolean dt_ioppr_write_iop_order_list(GList *iop_order_list, const int32_t imgid);
263
271void *dt_ioppr_serialize_iop_order_list(GList *iop_order_list, size_t *size);
279GList *dt_ioppr_deserialize_iop_order_list(const char *buf, size_t size);
286char *dt_ioppr_serialize_text_iop_order_list(GList *iop_order_list);
293GList *dt_ioppr_deserialize_text_iop_order_list(const char *buf);
294
304void dt_ioppr_insert_module_instance(struct dt_develop_t *dev, struct dt_iop_module_t *module);
324void dt_ioppr_resync_pipeline(struct dt_develop_t *dev, const int32_t imgid, const char *msg, gboolean check_duplicates);
325
332void dt_ioppr_rebuild_iop_order_from_modules(struct dt_develop_t *dev, GList *ordered_modules);
333
341void dt_ioppr_update_for_style_items(struct dt_develop_t *dev, GList *st_items, gboolean append);
349void dt_ioppr_update_for_modules(struct dt_develop_t *dev, GList *modules, gboolean append);
350
359void dt_ioppr_set_default_iop_order(struct dt_develop_t *dev, const int32_t imgid);
367void dt_ioppr_change_iop_order(struct dt_develop_t *dev, const int32_t imgid, GList *new_iop_list);
368
376int dt_ioppr_check_so_iop_order(GList *iop_list, GList *iop_order_list);
377
384
391GList *dt_ioppr_iop_order_copy_deep(GList *iop_order_list);
392
400gint dt_sort_iop_by_order(gconstpointer a, gconstpointer b);
408gint dt_sort_iop_list_by_order_f(gconstpointer a, gconstpointer b);
409
418gboolean dt_ioppr_check_can_move_before_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next);
427gboolean dt_ioppr_check_can_move_after_iop(GList *iop_list, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev);
428
439gboolean dt_ioppr_move_iop_before(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_next);
450gboolean dt_ioppr_move_iop_after(struct dt_develop_t *dev, struct dt_iop_module_t *module, struct dt_iop_module_t *module_prev);
451
462int dt_ioppr_check_iop_order(struct dt_develop_t *dev, const int32_t imgid, const char *msg);
463
464#ifdef __cplusplus
465}
466#endif
467
468#endif
469// clang-format off
470// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
471// vim: shiftwidth=2 expandtab tabstop=2 cindent
472// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
473// clang-format on
const float b
Definition colorspaces_inline_conversions.h:1326
const float a
Definition colorspaces_inline_conversions.h:1292
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:831
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:689
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:808
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:2243
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:788
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:597
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:1457
gint dt_sort_iop_by_order(gconstpointer a, gconstpointer b)
Compare two module instances by iop_order for sorting.
Definition iop_order.c:1675
GList * dt_ioppr_get_iop_order_rules()
Return the list of ordering rules (prev/next constraints).
Definition iop_order.c:496
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:2129
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:1875
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:1931
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:1023
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:992
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:969
GList * dt_ioppr_iop_order_copy_deep(GList *iop_order_list)
Deep-copy an order list.
Definition iop_order.c:1669
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:757
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:572
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:1633
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:1910
dt_iop_order_t
Definition iop_order.h:143
@ DT_IOP_ORDER_LEGACY
Definition iop_order.h:145
@ DT_IOP_ORDER_LAST
Definition iop_order.h:148
@ 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_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:606
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:1688
char * dt_ioppr_serialize_text_iop_order_list(GList *iop_order_list)
Serialize an order list to a text representation.
Definition iop_order.c:2285
GList * dt_ioppr_deserialize_text_iop_order_list(const char *buf)
Deserialize an order list from a text representation.
Definition iop_order.c:2340
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:1420
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:91
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:961
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:476
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:2385
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:2101
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:1060
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:534
size_t size
Definition mipmap_cache.c:3
Definition pixelpipe_hb.h:216
Definition develop.h:155
Definition imageop.h:216
Definition iop_order.h:152
char name[25]
Definition iop_order.h:160
int iop_order
Definition iop_order.h:155
char operation[20]
Definition iop_order.h:158
union dt_iop_order_entry_t::@8 o
double iop_order_f
Definition iop_order.h:154
int32_t instance
Definition iop_order.h:159
Definition iop_order.h:164
char op_prev[20]
Definition iop_order.h:165
char op_next[20]
Definition iop_order.h:166