![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Drawlayer configuration read/write helpers (private include unit). More...
#include "iop/drawlayer/conf.h"#include "iop/drawlayer/runtime.h"#include "iop/drawlayer/widgets.h"#include "control/redraw.h"#include "develop/imageop_gui.h"#include "gui/application.h"#include "widgets/widget_settings.h"#include "widgets/bauhaus.h"
Include dependency graph for iop/drawlayer/conf.c:Go to the source code of this file.
Functions | |
| void | dt_drawlayer_conf_ensure_defaults (void) |
| Ensure all drawlayer GUI config keys exist with sane defaults. | |
| dt_iop_drawlayer_brush_shape_t | dt_drawlayer_conf_brush_shape (void) |
| Read and clamp configured brush shape. | |
| dt_iop_drawlayer_brush_mode_t | dt_drawlayer_conf_brush_mode (void) |
| Read and clamp configured brush blend mode. | |
| float | dt_drawlayer_conf_size (void) |
| Read and clamp configured brush size (px). | |
| float | dt_drawlayer_conf_opacity (void) |
| Read and clamp configured stroke opacity (%). | |
| float | dt_drawlayer_conf_flow (void) |
| Read and clamp configured flow (%). | |
| float | dt_drawlayer_conf_sprinkles (void) |
| Read and clamp configured sprinkles amount (%). | |
| float | dt_drawlayer_conf_sprinkle_size (void) |
| Read and clamp configured sprinkle feature size (px). | |
| float | dt_drawlayer_conf_sprinkle_coarseness (void) |
| Read and clamp configured sprinkle octave mix (%). | |
| float | dt_drawlayer_conf_distance (void) |
| Read and clamp configured distance/sampling parameter (%). | |
| float | dt_drawlayer_conf_smoothing (void) |
| Read and clamp configured smoothing parameter (%). | |
| static float | _conf_softness (void) |
| Read configured softness in [0,1]. | |
| float | dt_drawlayer_conf_hardness (void) |
| Derive hardness as complementary value of softness. | |
| float | dt_drawlayer_conf_hdr_exposure (void) |
| Read and clamp HDR picker exposure compensation (EV). | |
| drawlayer_pick_source_t | dt_drawlayer_conf_pick_source (void) |
| Read and clamp color picker source selector. | |
| drawlayer_mapping_profile_t | dt_drawlayer_conf_mapping_profile (const char *key) |
| Read and clamp one mapping-profile enum key. | |
| void | dt_drawlayer_conf_display_color (float rgb[3]) |
| Read configured display RGB brush color. | |
| static void | _color_history_key (const int index, const char channel, char *key, const size_t key_size) |
| Build config key for one color-history channel entry. | |
| static void | _color_history_valid_key (const int index, char *key, const size_t key_size) |
| Build config key for one color-history validity entry. | |
| void | dt_drawlayer_conf_load_color_history (dt_iop_drawlayer_gui_data_t *g) |
| Load persisted color-history stack from config into widgets state. | |
| static void | _store_color_history (const dt_iop_drawlayer_gui_data_t *g) |
| Persist current widget color-history stack into config. | |
| void | dt_drawlayer_conf_remember_display_color (dt_iop_module_t *self, const float display_rgb[3]) |
| Push current display color to history and trigger swatch redraw. | |
| void | dt_drawlayer_conf_apply_display_brush_color (dt_iop_module_t *self, const float display_rgb[3], const gboolean remember) |
| Apply display-space brush color to conf, widgets and redraw. | |
| void | dt_drawlayer_conf_sync_color_picker (dt_iop_module_t *self) |
| Refresh picker widgets from persisted config color. | |
| void | dt_drawlayer_mapping_rows (dt_iop_drawlayer_gui_data_t *g, dt_drawlayer_mapping_row_t rows[DT_DRAWLAYER_MAPPING_ROWS]) |
| void | dt_drawlayer_conf_sync_params_from_gui (dt_iop_module_t *self, const gboolean record_history) |
| Sync active GUI widget values back into persistent config keys. | |
Drawlayer configuration read/write helpers (private include unit).
Definition in file iop/drawlayer/conf.c.
|
static |
Build config key for one color-history channel entry.
Definition at line 204 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_BASE, and key.
Referenced by _store_color_history(), and dt_drawlayer_conf_load_color_history().
|
static |
Build config key for one color-history validity entry.
Definition at line 210 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_BASE, and key.
Referenced by _store_color_history(), and dt_drawlayer_conf_load_color_history().
|
static |
Read configured softness in [0,1].
Definition at line 164 of file iop/drawlayer/conf.c.
References _clamp01(), DRAWLAYER_CONF_SOFTNESS, and dt_conf_get_float().
Referenced by dt_drawlayer_conf_hardness().
|
static |
Persist current widget color-history stack into config.
Definition at line 240 of file iop/drawlayer/conf.c.
References _color_history_key(), _color_history_valid_key(), dt_conf_set_bool(), dt_conf_set_float(), DT_DRAWLAYER_COLOR_HISTORY_COUNT, dt_drawlayer_widgets_get_color_history(), FALSE, g, i, IS_NULL_PTR, and key.
Referenced by dt_drawlayer_conf_remember_display_color().
| void dt_drawlayer_conf_apply_display_brush_color | ( | dt_iop_module_t * | self, |
| const float | display_rgb[3], | ||
| const gboolean | remember | ||
| ) |
Apply display-space brush color to conf, widgets and redraw.
Definition at line 275 of file iop/drawlayer/conf.c.
References _clamp01(), DRAWLAYER_CONF_COLOR_B, DRAWLAYER_CONF_COLOR_G, DRAWLAYER_CONF_COLOR_R, dt_conf_set_float(), dt_control_queue_redraw_center(), dt_drawlayer_conf_remember_display_color(), dt_drawlayer_invalidate_brush_settings_cache(), dt_drawlayer_sync_cached_brush_colors(), dt_drawlayer_ui_cursor_clear(), dt_drawlayer_widgets_set_display_color(), dt_iop_gui_data(), g, and IS_NULL_PTR.
Referenced by _color_picker_set_from_position(), _color_swatch_button_press(), and color_picker_apply().
| dt_iop_drawlayer_brush_mode_t dt_drawlayer_conf_brush_mode | ( | void | ) |
Read and clamp configured brush blend mode.
Definition at line 109 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_BRUSH_MODE, dt_conf_get_int(), DT_DRAWLAYER_BRUSH_MODE_PAINT, and DT_DRAWLAYER_BRUSH_MODE_SMUDGE.
Referenced by _brush_paints_color(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), and gui_update().
| dt_iop_drawlayer_brush_shape_t dt_drawlayer_conf_brush_shape | ( | void | ) |
Read and clamp configured brush shape.
Definition at line 102 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_BRUSH_SHAPE, dt_conf_get_int(), DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, and DT_DRAWLAYER_BRUSH_SHAPE_SIGMOIDAL.
Referenced by _ensure_cursor_stamp_surface(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and _sync_mode_sensitive_widgets().
| void dt_drawlayer_conf_display_color | ( | float | rgb[3] | ) |
Read configured display RGB brush color.
Definition at line 196 of file iop/drawlayer/conf.c.
References _clamp01(), DRAWLAYER_CONF_COLOR_B, DRAWLAYER_CONF_COLOR_G, DRAWLAYER_CONF_COLOR_R, dt_conf_get_float(), and rgb.
Referenced by _ensure_cursor_stamp_surface(), _fill_input_brush_settings(), and dt_drawlayer_conf_sync_color_picker().
| float dt_drawlayer_conf_distance | ( | void | ) |
Read and clamp configured distance/sampling parameter (%).
Definition at line 152 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_DISTANCE, and dt_conf_get_float().
Referenced by _fill_input_brush_settings(), _refresh_brush_settings_cache(), and gui_update().
Ensure all drawlayer GUI config keys exist with sane defaults.
Definition at line 42 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_ACCEL_PROFILE, DRAWLAYER_CONF_BASE, DRAWLAYER_CONF_BRUSH_MODE, DRAWLAYER_CONF_BRUSH_SHAPE, DRAWLAYER_CONF_COLOR_B, DRAWLAYER_CONF_COLOR_G, DRAWLAYER_CONF_COLOR_R, DRAWLAYER_CONF_DISTANCE, DRAWLAYER_CONF_FLOW, DRAWLAYER_CONF_HDR_EV, DRAWLAYER_CONF_MAP_ACCEL_FLOW, DRAWLAYER_CONF_MAP_ACCEL_OPACITY, DRAWLAYER_CONF_MAP_ACCEL_SIZE, DRAWLAYER_CONF_MAP_ACCEL_SOFTNESS, DRAWLAYER_CONF_MAP_PRESSURE_FLOW, DRAWLAYER_CONF_MAP_PRESSURE_OPACITY, DRAWLAYER_CONF_MAP_PRESSURE_SIZE, DRAWLAYER_CONF_MAP_PRESSURE_SOFTNESS, DRAWLAYER_CONF_MAP_TILT_FLOW, DRAWLAYER_CONF_MAP_TILT_OPACITY, DRAWLAYER_CONF_MAP_TILT_SIZE, DRAWLAYER_CONF_MAP_TILT_SOFTNESS, DRAWLAYER_CONF_OPACITY, DRAWLAYER_CONF_PICK_SOURCE, DRAWLAYER_CONF_PRESSURE_PROFILE, DRAWLAYER_CONF_SIZE, DRAWLAYER_CONF_SMOOTHING, DRAWLAYER_CONF_SOFTNESS, DRAWLAYER_CONF_SPRINKLE_COARSENESS, DRAWLAYER_CONF_SPRINKLE_SIZE, DRAWLAYER_CONF_SPRINKLES, DRAWLAYER_CONF_TILT_PROFILE, DRAWLAYER_PICK_SOURCE_INPUT, DRAWLAYER_PROFILE_LINEAR, dt_conf_get_bool(), dt_conf_key_exists(), dt_conf_set_bool(), dt_conf_set_float(), dt_conf_set_int(), DT_DRAWLAYER_BRUSH_MODE_PAINT, DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, and FALSE.
Referenced by gui_init().
| float dt_drawlayer_conf_flow | ( | void | ) |
Read and clamp configured flow (%).
Definition at line 128 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_FLOW, and dt_conf_get_float().
Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), and gui_update().
| float dt_drawlayer_conf_hardness | ( | void | ) |
Derive hardness as complementary value of softness.
Definition at line 170 of file iop/drawlayer/conf.c.
References _conf_softness().
Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and gui_update().
| float dt_drawlayer_conf_hdr_exposure | ( | void | ) |
Read and clamp HDR picker exposure compensation (EV).
Definition at line 176 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_HDR_EV, and dt_conf_get_float().
Referenced by _brush_pipeline_color_from_display(), _working_rgb_to_display_rgb(), and gui_update().
| void dt_drawlayer_conf_load_color_history | ( | dt_iop_drawlayer_gui_data_t * | g | ) |
Load persisted color-history stack from config into widgets state.
Definition at line 216 of file iop/drawlayer/conf.c.
References _clamp01(), _color_history_key(), _color_history_valid_key(), dt_conf_get_bool(), dt_conf_get_float(), dt_conf_key_exists(), DT_DRAWLAYER_COLOR_HISTORY_COUNT, dt_drawlayer_widgets_set_color_history(), FALSE, g, i, IS_NULL_PTR, and key.
Referenced by gui_init().
| drawlayer_mapping_profile_t dt_drawlayer_conf_mapping_profile | ( | const char * | key | ) |
Read and clamp one mapping-profile enum key.
Definition at line 189 of file iop/drawlayer/conf.c.
References DRAWLAYER_PROFILE_INV_QUADRATIC, DRAWLAYER_PROFILE_LINEAR, dt_conf_get_int(), and key.
Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), and gui_update().
| float dt_drawlayer_conf_opacity | ( | void | ) |
Read and clamp configured stroke opacity (%).
Definition at line 122 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_OPACITY, and dt_conf_get_float().
Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and gui_update().
| drawlayer_pick_source_t dt_drawlayer_conf_pick_source | ( | void | ) |
Read and clamp color picker source selector.
Definition at line 182 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_PICK_SOURCE, DRAWLAYER_PICK_SOURCE_INPUT, DRAWLAYER_PICK_SOURCE_OUTPUT, and dt_conf_get_int().
Referenced by color_picker_apply(), and gui_update().
| void dt_drawlayer_conf_remember_display_color | ( | dt_iop_module_t * | self, |
| const float | display_rgb[3] | ||
| ) |
Push current display color to history and trigger swatch redraw.
Definition at line 264 of file iop/drawlayer/conf.c.
References _store_color_history(), dt_drawlayer_widgets_push_color_history(), dt_iop_gui_data(), g, and IS_NULL_PTR.
Referenced by _color_picker_button_release(), and dt_drawlayer_conf_apply_display_brush_color().
| float dt_drawlayer_conf_size | ( | void | ) |
Read and clamp configured brush size (px).
Definition at line 116 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_SIZE, and dt_conf_get_float().
Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), _refresh_brush_settings_cache(), dt_drawlayer_current_live_padding(), gui_update(), and scrolled().
| float dt_drawlayer_conf_smoothing | ( | void | ) |
Read and clamp configured smoothing parameter (%).
Definition at line 158 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_SMOOTHING, and dt_conf_get_float().
Referenced by _fill_input_brush_settings(), _refresh_brush_settings_cache(), and gui_update().
| float dt_drawlayer_conf_sprinkle_coarseness | ( | void | ) |
Read and clamp configured sprinkle octave mix (%).
Definition at line 146 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_SPRINKLE_COARSENESS, and dt_conf_get_float().
Referenced by _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and gui_update().
| float dt_drawlayer_conf_sprinkle_size | ( | void | ) |
Read and clamp configured sprinkle feature size (px).
Definition at line 140 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_SPRINKLE_SIZE, and dt_conf_get_float().
Referenced by _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and gui_update().
| float dt_drawlayer_conf_sprinkles | ( | void | ) |
Read and clamp configured sprinkles amount (%).
Definition at line 134 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_SPRINKLES, and dt_conf_get_float().
Referenced by _fill_input_brush_settings(), _refresh_brush_settings_cache(), _sync_brush_profile_preview_widget(), and gui_update().
| void dt_drawlayer_conf_sync_color_picker | ( | dt_iop_module_t * | self | ) |
Refresh picker widgets from persisted config color.
Definition at line 297 of file iop/drawlayer/conf.c.
References dt_drawlayer_conf_display_color(), dt_drawlayer_sync_cached_brush_colors(), dt_drawlayer_widgets_set_display_color(), dt_iop_gui_data(), g, and IS_NULL_PTR.
Referenced by gui_update().
| void dt_drawlayer_conf_sync_params_from_gui | ( | dt_iop_module_t * | self, |
| const gboolean | record_history | ||
| ) |
Sync active GUI widget values back into persistent config keys.
Definition at line 340 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_BRUSH_MODE, DRAWLAYER_CONF_BRUSH_SHAPE, DRAWLAYER_CONF_DISTANCE, DRAWLAYER_CONF_FLOW, DRAWLAYER_CONF_HDR_EV, DRAWLAYER_CONF_OPACITY, DRAWLAYER_CONF_PICK_SOURCE, DRAWLAYER_CONF_SIZE, DRAWLAYER_CONF_SMOOTHING, DRAWLAYER_CONF_SOFTNESS, DRAWLAYER_CONF_SPRINKLE_COARSENESS, DRAWLAYER_CONF_SPRINKLE_SIZE, DRAWLAYER_CONF_SPRINKLES, dt_bauhaus_combobox_get(), dt_bauhaus_slider_get(), dt_conf_set_bool(), dt_conf_set_float(), dt_conf_set_int(), dt_drawlayer_invalidate_brush_settings_cache(), dt_drawlayer_mapping_rows(), DT_DRAWLAYER_MAPPING_ROWS, DT_DRAWLAYER_MAPPING_TARGETS, dt_drawlayer_widgets_get_brush_profile_selection(), dt_gui_get_global(), dt_gui_widgets_suppressed(), dt_iop_gui_data(), g, IS_NULL_PTR, r, and void().
Referenced by _brush_profile_button_press(), and _widget_changed().
| void dt_drawlayer_mapping_rows | ( | dt_iop_drawlayer_gui_data_t * | g, |
| dt_drawlayer_mapping_row_t | rows[DT_DRAWLAYER_MAPPING_ROWS] | ||
| ) |
Definition at line 311 of file iop/drawlayer/conf.c.
References DRAWLAYER_CONF_ACCEL_PROFILE, DRAWLAYER_CONF_MAP_ACCEL_FLOW, DRAWLAYER_CONF_MAP_ACCEL_OPACITY, DRAWLAYER_CONF_MAP_ACCEL_SIZE, DRAWLAYER_CONF_MAP_ACCEL_SOFTNESS, DRAWLAYER_CONF_MAP_PRESSURE_FLOW, DRAWLAYER_CONF_MAP_PRESSURE_OPACITY, DRAWLAYER_CONF_MAP_PRESSURE_SIZE, DRAWLAYER_CONF_MAP_PRESSURE_SOFTNESS, DRAWLAYER_CONF_MAP_TILT_FLOW, DRAWLAYER_CONF_MAP_TILT_OPACITY, DRAWLAYER_CONF_MAP_TILT_SIZE, DRAWLAYER_CONF_MAP_TILT_SOFTNESS, DRAWLAYER_CONF_PRESSURE_PROFILE, DRAWLAYER_CONF_TILT_PROFILE, g, and IS_NULL_PTR.
Referenced by _build_input_tab(), dt_drawlayer_conf_sync_params_from_gui(), and gui_update().