Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_roi_request.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
19#ifndef DT_DEVELOP_DEV_ROI_REQUEST_H
20#define DT_DEVELOP_DEV_ROI_REQUEST_H
21
22#include <glib.h>
23#include <math.h>
24#include <stdint.h>
25
26#include "system/atomic.h"
27
28struct dt_develop_t;
30
73
79
87static inline float dt_dev_roi_natural_scale(const int32_t box_width, const int32_t box_height,
88 const int32_t processed_width,
89 const int32_t processed_height)
90{
91 if(processed_width <= 0 || processed_height <= 0) return -1.f;
92
93 return fminf(fminf((float)box_width / (float)processed_width,
94 (float)box_height / (float)processed_height),
95 1.f);
96}
97
108
110void dt_dev_roi_request_init(struct dt_develop_t *dev);
111
121
125
136void dt_dev_roi_request_latch(struct dt_dev_pixelpipe_t *pipe, const dt_dev_roi_request_t *request);
137
140
141/* Single-field readers, one line each. Use dt_dev_roi_request_get() wherever more than one is
142 * needed: the whole point of the record is that its members are consumed as a product. */
146gboolean dt_dev_roi_request_valid(const struct dt_develop_t *dev);
147
148#endif // DT_DEVELOP_DEV_ROI_REQUEST_H
149
150// clang-format off
151// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
152// vim: shiftwidth=2 expandtab tabstop=2 cindent
153// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
154// clang-format on
void dt_dev_roi_request_init(struct dt_develop_t *dev)
dt_dev_roi_request_t dt_dev_roi_request_neutral(void)
The value a pipe carries before the worker has latched anything.
int32_t dt_dev_roi_request_preview_height(const struct dt_develop_t *dev)
dt_dev_roi_request_t dt_dev_roi_request_get(const struct dt_develop_t *dev)
dt_dev_roi_request_t dt_dev_roi_request_of_pipe(const struct dt_dev_pixelpipe_t *pipe)
static float dt_dev_roi_natural_scale(const int32_t box_width, const int32_t box_height, const int32_t processed_width, const int32_t processed_height)
natural scaling = MIN(box / processed, 1): the image fits the widget minus its borders.
int32_t dt_dev_roi_request_preview_width(const struct dt_develop_t *dev)
uint64_t dt_dev_roi_request_publish(struct dt_develop_t *dev)
Recompute the derived members from the viewport and the geometry record, and publish if anything chan...
void dt_dev_roi_request_latch(struct dt_dev_pixelpipe_t *pipe, const dt_dev_roi_request_t *request)
Publish onto a pipe the request its next run is planned from. Darkroom worker only.
float dt_dev_roi_request_natural_scale(const struct dt_develop_t *dev)
gboolean dt_dev_roi_request_valid(const struct dt_develop_t *dev)
unsigned __int64 uint64_t
Definition strptime.c:75
dt_dev_roi_request_t value
The coherent set of numbers a darkroom pipe plans its ROI from.