Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_viewport.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_VIEWPORT_H
20#define DT_DEVELOP_DEV_VIEWPORT_H
21
22#include <glib.h>
23#include <stdint.h>
24
25#include "system/atomic.h"
26
27struct dt_develop_t;
28
66
74
78
90
93
94gboolean dt_dev_viewport_exists(const struct dt_develop_t *dev);
95
96/* Single-field readers, one line each, for the sites that want one number. */
97float dt_dev_viewport_scaling(const struct dt_develop_t *dev);
98float dt_dev_viewport_center_x(const struct dt_develop_t *dev);
99float dt_dev_viewport_center_y(const struct dt_develop_t *dev);
100int32_t dt_dev_viewport_box_width(const struct dt_develop_t *dev);
101int32_t dt_dev_viewport_box_height(const struct dt_develop_t *dev);
104int32_t dt_dev_viewport_border_size(const struct dt_develop_t *dev);
105gboolean dt_dev_viewport_configured(const struct dt_develop_t *dev);
106
107/* ---- mutators ----
108 *
109 * GUI thread only. Each returns TRUE when the published state actually changed, so a caller
110 * can decide whether to trigger a recompute without comparing fields itself. Each publishes
111 * once, as a whole state, so no reader can observe a half-applied change; and each applies its
112 * own clamps BEFORE publishing, so no value the clamp would take back is ever visible.
113 *
114 * A dev with no viewport accepts every call and does nothing.
115 */
116
118gboolean dt_dev_viewport_set_widget_size(struct dt_develop_t *dev, int32_t widget_width,
119 int32_t widget_height);
120
122gboolean dt_dev_viewport_set_border(struct dt_develop_t *dev, int32_t border_size);
123
131gboolean dt_dev_viewport_set_box(struct dt_develop_t *dev, int32_t box_width, int32_t box_height);
132
135gboolean dt_dev_viewport_set_center(struct dt_develop_t *dev, float center_x, float center_y);
136
139gboolean dt_dev_viewport_set_scaling(struct dt_develop_t *dev, float scaling);
140
142void dt_dev_viewport_reset(struct dt_develop_t *dev);
143
144#endif // DT_DEVELOP_DEV_VIEWPORT_H
145
146// clang-format off
147// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
148// vim: shiftwidth=2 expandtab tabstop=2 cindent
149// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
150// clang-format on
static const float scaling
int32_t dt_dev_viewport_widget_height(const struct dt_develop_t *dev)
void dt_dev_viewport_free(dt_dev_viewport_t *viewport)
gboolean dt_dev_viewport_set_widget_size(struct dt_develop_t *dev, int32_t widget_width, int32_t widget_height)
gboolean dt_dev_viewport_set_border(struct dt_develop_t *dev, int32_t border_size)
int32_t dt_dev_viewport_widget_width(const struct dt_develop_t *dev)
dt_dev_viewport_state_t dt_dev_viewport_get(const struct dt_develop_t *dev)
Coherent copy of the viewport state, by value – the ordinary way to read it:
int32_t dt_dev_viewport_box_height(const struct dt_develop_t *dev)
dt_dev_viewport_state_t dt_dev_viewport_neutral(void)
gboolean dt_dev_viewport_set_center(struct dt_develop_t *dev, float center_x, float center_y)
float dt_dev_viewport_center_y(const struct dt_develop_t *dev)
gboolean dt_dev_viewport_set_scaling(struct dt_develop_t *dev, float scaling)
dt_dev_viewport_t * dt_dev_viewport_new(void)
gboolean dt_dev_viewport_configured(const struct dt_develop_t *dev)
void dt_dev_viewport_reset(struct dt_develop_t *dev)
float dt_dev_viewport_scaling(const struct dt_develop_t *dev)
gboolean dt_dev_viewport_exists(const struct dt_develop_t *dev)
float dt_dev_viewport_center_x(const struct dt_develop_t *dev)
int32_t dt_dev_viewport_box_width(const struct dt_develop_t *dev)
gboolean dt_dev_viewport_set_box(struct dt_develop_t *dev, int32_t box_width, int32_t box_height)
int32_t dt_dev_viewport_border_size(const struct dt_develop_t *dev)
What the darkroom view asks the pipeline to show: the window onto the image.
dt_atomic_uint64 generation
dt_dev_viewport_state_t state