Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
geometry.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel.
3 Copyright (C) 2026 Aurélien Pierre.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
40#ifndef DT_DEVELOP_GEOMETRY_GEOMETRY_H
41#define DT_DEVELOP_GEOMETRY_GEOMETRY_H
42
43#include <glib.h>
44#include <stdint.h>
45
46#include "develop/pixelpipe_hb.h" // dt_iop_roi_t
47
48/* C linkage: geometry.c is a C translation unit and iop/lens.cc -- the first module to publish
49 * a record -- is a C++ one. Without this its calls and its vtable would name mangled symbols
50 * nothing defines. Linux would still link the plugin (a shared object may carry undefined
51 * symbols and resolve them at dlopen time) and fail at runtime; macOS and Windows fail the
52 * build. Same reason control/user_message.h carries these guards. */
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57struct dt_develop_t;
58struct dt_iop_module_t;
61
75{
77 void (*map_size)(const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out);
78
82 int (*transform)(const void *data, const struct dt_geometry_record_t *const record,
83 struct dt_geometry_chain_t *chain, float *points, size_t points_count);
84
86 int (*backtransform)(const void *data, const struct dt_geometry_record_t *const record,
87 struct dt_geometry_chain_t *chain, float *points, size_t points_count);
89
99{
100 char op[32];
102 double iop_order;
103 gboolean enabled;
104
105 /* The candidate half of the query-time GUI exception: the FOCUSED module's tag filter is
106 * tested against this. The focused module's own filter is not stored per record -- it is one
107 * value for the whole query, and it lives on the chain. See dt_geometry_set_focus(). */
109
111 void *data;
112 void (*free_data)(void *data);
114 /* Filled by the chain's own size fold, at full resolution and scale 1 -- the same numbers
115 * dt_dev_pixelpipe_get_roi_out() writes into a piece's buf_in/buf_out, which is what GUI
116 * consumers used to resolve a piece in order to read. */
120
123
126
136
151
177
179gboolean dt_geometry_chain_processed_size(const dt_geometry_chain_t *chain, int *width, int *height);
180
182const dt_geometry_record_t *dt_geometry_chain_find(const dt_geometry_chain_t *chain, const char *op,
183 int instance);
184
185/* Direction modes, matching dt_dev_distort_transform_plus()'s DT_DEV_TRANSFORM_DIR_* exactly:
186 * the walkers this replaces are bounded folds, and every existing caller's bound has to keep
187 * meaning what it meant. */
188
190int dt_geometry_transform(struct dt_develop_t *dev, double iop_order, int direction, float *points,
191 size_t points_count);
192
194int dt_geometry_backtransform(struct dt_develop_t *dev, double iop_order, int direction, float *points,
195 size_t points_count);
196
212 float *points, size_t points_count);
213
227int dt_geometry_chain_compose(dt_geometry_chain_t *chain, double iop_order, int direction, float *points,
228 size_t points_count);
229
230/* THE FOCUS EXCEPTION is not an entry point, deliberately. It used to be one -- a setter the GUI
231 * was supposed to call when the focused module or its editing state changed -- and nothing ever
232 * called it, so the chain composed every module while the pipe was skipping the ones the focused
233 * module's tag filter disables. The visible result was ashift's detected-lines overlay drawn
234 * against a different module stack than the image under it.
235 *
236 * A published copy of view state has to be refreshed to stay true and is wrong in between; that
237 * is the same lesson control/input.h records about the stored mouse-button state. So the chain
238 * now reads it where the pipe reads it -- dev->gui_module, its operation_tags_filter() and its
239 * live cache-bypass flag, at query time -- and the two cannot drift because there is nothing to
240 * keep in step. Do not reintroduce a setter for this.
241 */
242
254void dt_geometry_self_check(struct dt_develop_t *dev, double chain_ms);
255
256#ifdef __cplusplus
257}
258#endif
259
260#endif // DT_DEVELOP_GEOMETRY_GEOMETRY_H
261
262// clang-format off
263// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
264// vim: shiftwidth=2 expandtab tabstop=2 cindent
265// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
266// clang-format on
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
const dt_colormatrix_t dt_aligned_pixel_t out
void dt_geometry_self_check(struct dt_develop_t *dev, double chain_ms)
Check the chain against itself, and report what the rebuild cost.
Definition geometry.c:473
dt_geometry_chain_t * dt_geometry_chain_new(void)
Definition geometry.c:119
const dt_geometry_record_t * dt_geometry_chain_find(const dt_geometry_chain_t *chain, const char *op, int instance)
One module instance's record, or NULL. Use it for that module's own in/out dims.
Definition geometry.c:337
void dt_geometry_chain_rebuild(struct dt_develop_t *dev)
Rebuild the chain from the dev's current modules and history. GUI thread only.
Definition geometry.c:247
gboolean dt_geometry_chain_authoritative(const dt_geometry_chain_t *chain)
Can this chain answer questions yet?
Definition geometry.c:324
int dt_geometry_backtransform(struct dt_develop_t *dev, double iop_order, int direction, float *points, size_t points_count)
Compose backward over the chain, in place.
Definition geometry.c:429
uint64_t dt_geometry_chain_generation(const dt_geometry_chain_t *chain)
How many times this chain has been rebuilt. A GUI cache key for anything derived from the composed ge...
Definition geometry.c:319
int dt_geometry_chain_compose(dt_geometry_chain_t *chain, double iop_order, int direction, float *points, size_t points_count)
Compose the chain over points, for a record evaluator that needs the transform stack around its own m...
Definition geometry.c:412
gboolean dt_geometry_chain_processed_size(const dt_geometry_chain_t *chain, int *width, int *height)
The developed image's full-resolution size, from the chain's own fold.
Definition geometry.c:329
void dt_geometry_chain_free(dt_geometry_chain_t *chain)
Definition geometry.c:124
int dt_geometry_module_transform(struct dt_develop_t *dev, const struct dt_iop_module_t *module, float *points, size_t points_count)
Apply ONE module's own transform, and nothing else.
int dt_geometry_transform(struct dt_develop_t *dev, double iop_order, int direction, float *points, size_t points_count)
Compose forward over the chain, in place. direction is a DT_DEV_TRANSFORM_DIR_*.
Definition geometry.c:419
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
unsigned __int64 uint64_t
Definition strptime.c:75
dt_develop_t * dev
Definition geometry.c:87
One module instance's contribution, as data.
Definition geometry.h:99
dt_iop_roi_t in
Definition geometry.h:117
const dt_geometry_vtable_t * vtable
Definition geometry.h:110
void(* free_data)(void *data)
Definition geometry.h:112
dt_iop_roi_t out
Definition geometry.h:118
A module's geometry, evaluated. Pure functions of the record's own data.
Definition geometry.h:75
int(* backtransform)(const void *data, const struct dt_geometry_record_t *const record, struct dt_geometry_chain_t *chain, float *points, size_t points_count)
The inverse of transform.
Definition geometry.h:86
void(* map_size)(const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out)
Full-resolution input rect -> output rect. Mirrors modify_roi_out() at scale 1.
Definition geometry.h:77
int(* transform)(const void *data, const struct dt_geometry_record_t *const record, struct dt_geometry_chain_t *chain, float *points, size_t points_count)
Image coordinates in -> image coordinates out, in place, points_count pairs. ctx composes the sub-cha...
Definition geometry.h:82
Region of interest passed through the pixelpipe.
Definition format.h:49