![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Include dependency graph for dev_viewport.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | dt_dev_viewport_state_t |
| What the darkroom view asks the pipeline to show: the window onto the image. More... | |
| struct | dt_dev_viewport_t |
Typedefs | |
| typedef struct dt_dev_viewport_state_t | dt_dev_viewport_state_t |
| What the darkroom view asks the pipeline to show: the window onto the image. | |
| typedef struct dt_dev_viewport_t | dt_dev_viewport_t |
What the darkroom view asks the pipeline to show: the window onto the image.
Meaningless without a GUI, and therefore absent without one – dt_develop_t owns a pointer that is allocated only for a gui_attached dev and NULL otherwise. That NULL IS the flag: it replaces roi.gui_inited, and for this half of the object it replaces dev->gui_attached too.
Two devs can hold one at the same time (the darkroom's and studio capture's), and studio capture swaps which one is global. Nothing here resolves dt_dev_get_global() internally; every entry point takes the dev whose viewport it means.
| int32_t dt_dev_viewport_border_size | ( | const struct dt_develop_t * | dev | ) |
| int32_t dt_dev_viewport_box_height | ( | const struct dt_develop_t * | dev | ) |
| int32_t dt_dev_viewport_box_width | ( | const struct dt_develop_t * | dev | ) |
| float dt_dev_viewport_center_x | ( | const struct dt_develop_t * | dev | ) |
| float dt_dev_viewport_center_y | ( | const struct dt_develop_t * | dev | ) |
| gboolean dt_dev_viewport_configured | ( | const struct dt_develop_t * | dev | ) |
| gboolean dt_dev_viewport_exists | ( | const struct dt_develop_t * | dev | ) |
| void dt_dev_viewport_free | ( | dt_dev_viewport_t * | viewport | ) |
| 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:
const dt_dev_viewport_state_t viewport = dt_dev_viewport_get(dev);
A dev with no viewport yields the NEUTRAL state, which is not zeroed: scaling is 1.0 and the centre is (0.5, 0.5), reproducing exactly what dt_dev_reset_roi() left on a headless dev before this object existed. Callers that need to distinguish "no viewport" from "viewport at defaults" ask dt_dev_viewport_exists().
| dt_dev_viewport_state_t dt_dev_viewport_neutral | ( | void | ) |
The neutral state a dev without a viewport reads as.
Definition at line 38 of file dev_viewport.c.
Referenced by dt_dev_viewport_get(), dt_dev_viewport_new(), and dt_dev_viewport_reset().
| dt_dev_viewport_t * dt_dev_viewport_new | ( | void | ) |
Allocate/free. dt_dev_init() creates one only for a gui_attached dev.
Definition at line 51 of file dev_viewport.c.
References dt_atomic_set_uint64(), dt_dev_viewport_neutral(), dt_dev_viewport_t::generation, IS_NULL_PTR, L, and dt_dev_viewport_t::state.
Referenced by dt_dev_init().
| void dt_dev_viewport_reset | ( | struct dt_develop_t * | dev | ) |
Reset to the neutral zoom and centre, without touching the allocation or border.
Definition at line 180 of file dev_viewport.c.
References _publish(), dt_dev_viewport_state_t::center_x, dt_dev_viewport_state_t::center_y, dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), dt_dev_viewport_neutral(), neutral, dt_dev_viewport_state_t::scaling, and dt_develop_t::viewport.
Referenced by dt_dev_reset_roi().
| float dt_dev_viewport_scaling | ( | const struct dt_develop_t * | dev | ) |
| gboolean dt_dev_viewport_set_border | ( | struct dt_develop_t * | dev, |
| int32_t | border_size | ||
| ) |
Border policy (ISO 12646 toggle, preference), in logical pixels.
Definition at line 119 of file dev_viewport.c.
References _publish(), dt_dev_viewport_state_t::border_size, dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), FALSE, TRUE, and dt_develop_t::viewport.
Referenced by dt_dev_toolbox_apply_iso_12646_size(), and gui_init().
| gboolean dt_dev_viewport_set_box | ( | struct dt_develop_t * | dev, |
| int32_t | box_width, | ||
| int32_t | box_height | ||
| ) |
The raster-pixel box an image backbuffer covers, and the "a size has been handed in" flag.
Takes the box already converted to raster pixels, because that is what its one caller computes today (dt_dev_configure_real, through dt_dev_convert_roi) and because the border subtraction that precedes it lives at ITS callers (views/dev_toolbox.c). Folding both into this object is the right end state and a behaviour change to argue separately; this tranche relocates state, it does not redistribute arithmetic.
Definition at line 133 of file dev_viewport.c.
References _publish(), dt_dev_viewport_state_t::box_height, dt_dev_viewport_state_t::box_width, dt_dev_viewport_state_t::configured, dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), FALSE, TRUE, and dt_develop_t::viewport.
Referenced by dt_dev_configure_real().
| gboolean dt_dev_viewport_set_center | ( | struct dt_develop_t * | dev, |
| float | center_x, | ||
| float | center_y | ||
| ) |
Absolute pan, in normalized image coordinates. The caller clamps: the clamp needs the processed size and the zoom level, which belong to the ROI request, not here.
Definition at line 149 of file dev_viewport.c.
References _publish(), dt_dev_viewport_state_t::center_x, dt_dev_viewport_state_t::center_y, dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), FALSE, TRUE, and dt_develop_t::viewport.
Referenced by _change_scaling(), _darkroom_edge_pan_apply(), _lib_navigation_draw_callback(), _lib_navigation_set_position(), dt_dev_clamp_viewport_center(), dt_masks_center_view_on_form(), key_pressed(), and mouse_moved().
| gboolean dt_dev_viewport_set_scaling | ( | struct dt_develop_t * | dev, |
| float | scaling | ||
| ) |
User zoom, applied on top of the natural (fit-to-box) scale. Clamped by the caller, for the same reason as the centre.
Definition at line 166 of file dev_viewport.c.
References _publish(), dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), FALSE, dt_dev_viewport_state_t::scaling, scaling, TRUE, and dt_develop_t::viewport.
Referenced by _change_scaling(), _zoom_preset_change(), and dt_dev_check_zoom_scale_bounds().
| gboolean dt_dev_viewport_set_widget_size | ( | struct dt_develop_t * | dev, |
| int32_t | widget_width, | ||
| int32_t | widget_height | ||
| ) |
The Gtk allocation of the darkroom centre widget, in logical pixels.
Definition at line 103 of file dev_viewport.c.
References _publish(), dt_dev_roi_request_publish(), dt_dev_viewport_exists(), dt_dev_viewport_get(), FALSE, TRUE, dt_develop_t::viewport, dt_dev_viewport_state_t::widget_height, and dt_dev_viewport_state_t::widget_width.
Referenced by _studio_configure_dev_roi(), and configure().
| int32_t dt_dev_viewport_widget_height | ( | const struct dt_develop_t * | dev | ) |
| int32_t dt_dev_viewport_widget_width | ( | const struct dt_develop_t * | dev | ) |