Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
conf.c File Reference

Drawlayer configuration read/write helpers (private include unit). More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DRAWLAYER_CONF_BASE   "plugins/drawlayer/"
 
#define DRAWLAYER_CONF_BRUSH_SHAPE   DRAWLAYER_CONF_BASE "brush_shape"
 
#define DRAWLAYER_CONF_BRUSH_MODE   DRAWLAYER_CONF_BASE "brush_mode"
 
#define DRAWLAYER_CONF_COLOR_R   DRAWLAYER_CONF_BASE "color_r"
 
#define DRAWLAYER_CONF_COLOR_G   DRAWLAYER_CONF_BASE "color_g"
 
#define DRAWLAYER_CONF_COLOR_B   DRAWLAYER_CONF_BASE "color_b"
 
#define DRAWLAYER_CONF_SOFTNESS   DRAWLAYER_CONF_BASE "softness"
 
#define DRAWLAYER_CONF_OPACITY   DRAWLAYER_CONF_BASE "opacity"
 
#define DRAWLAYER_CONF_FLOW   DRAWLAYER_CONF_BASE "flow"
 
#define DRAWLAYER_CONF_SPRINKLES   DRAWLAYER_CONF_BASE "sprinkles"
 
#define DRAWLAYER_CONF_SPRINKLE_SIZE   DRAWLAYER_CONF_BASE "sprinkle_size"
 
#define DRAWLAYER_CONF_SPRINKLE_COARSENESS   DRAWLAYER_CONF_BASE "sprinkle_coarseness"
 
#define DRAWLAYER_CONF_DISTANCE   DRAWLAYER_CONF_BASE "distance"
 
#define DRAWLAYER_CONF_SMOOTHING   DRAWLAYER_CONF_BASE "smoothing"
 
#define DRAWLAYER_CONF_SIZE   DRAWLAYER_CONF_BASE "size"
 
#define DRAWLAYER_CONF_PICK_SOURCE   DRAWLAYER_CONF_BASE "pick_source"
 
#define DRAWLAYER_CONF_HDR_EV   DRAWLAYER_CONF_BASE "hdr_exposure"
 
#define DRAWLAYER_CONF_MAP_PRESSURE_SIZE   DRAWLAYER_CONF_BASE "map_pressure_size"
 
#define DRAWLAYER_CONF_MAP_PRESSURE_OPACITY   DRAWLAYER_CONF_BASE "map_pressure_opacity"
 
#define DRAWLAYER_CONF_MAP_PRESSURE_FLOW   DRAWLAYER_CONF_BASE "map_pressure_flow"
 
#define DRAWLAYER_CONF_MAP_PRESSURE_SOFTNESS   DRAWLAYER_CONF_BASE "map_pressure_softness"
 
#define DRAWLAYER_CONF_MAP_TILT_SIZE   DRAWLAYER_CONF_BASE "map_tilt_size"
 
#define DRAWLAYER_CONF_MAP_TILT_OPACITY   DRAWLAYER_CONF_BASE "map_tilt_opacity"
 
#define DRAWLAYER_CONF_MAP_TILT_FLOW   DRAWLAYER_CONF_BASE "map_tilt_flow"
 
#define DRAWLAYER_CONF_MAP_TILT_SOFTNESS   DRAWLAYER_CONF_BASE "map_tilt_softness"
 
#define DRAWLAYER_CONF_MAP_ACCEL_SIZE   DRAWLAYER_CONF_BASE "map_acceleration_size"
 
#define DRAWLAYER_CONF_MAP_ACCEL_OPACITY   DRAWLAYER_CONF_BASE "map_acceleration_opacity"
 
#define DRAWLAYER_CONF_MAP_ACCEL_FLOW   DRAWLAYER_CONF_BASE "map_acceleration_flow"
 
#define DRAWLAYER_CONF_MAP_ACCEL_SOFTNESS   DRAWLAYER_CONF_BASE "map_acceleration_hardness"
 
#define DRAWLAYER_CONF_PRESSURE_PROFILE   DRAWLAYER_CONF_BASE "pressure_profile"
 
#define DRAWLAYER_CONF_TILT_PROFILE   DRAWLAYER_CONF_BASE "tilt_profile"
 
#define DRAWLAYER_CONF_ACCEL_PROFILE   DRAWLAYER_CONF_BASE "acceleration_profile"
 

Functions

static void _ensure_gui_conf_defaults (void)
 Ensure all drawlayer GUI config keys exist with sane defaults.
 
static dt_iop_drawlayer_brush_shape_t _conf_brush_shape (void)
 Read and clamp configured brush shape.
 
static dt_iop_drawlayer_brush_mode_t _conf_brush_mode (void)
 Read and clamp configured brush blend mode.
 
static float _conf_size (void)
 Read and clamp configured brush size (px).
 
static float _conf_opacity (void)
 Read and clamp configured stroke opacity (%).
 
static float _conf_flow (void)
 Read and clamp configured flow (%).
 
static float _conf_sprinkles (void)
 Read and clamp configured sprinkles amount (%).
 
static float _conf_sprinkle_size (void)
 Read and clamp configured sprinkle feature size (px).
 
static float _conf_sprinkle_coarseness (void)
 Read and clamp configured sprinkle octave mix (%).
 
static float _conf_distance (void)
 Read and clamp configured distance/sampling parameter (%).
 
static float _conf_smoothing (void)
 Read and clamp configured smoothing parameter (%).
 
static float _conf_softness (void)
 Read configured softness in [0,1].
 
static float _conf_hardness (void)
 Derive hardness as complementary value of softness.
 
static float _conf_hdr_exposure (void)
 Read and clamp HDR picker exposure compensation (EV).
 
static drawlayer_pick_source_t _conf_pick_source (void)
 Read and clamp color picker source selector.
 
static drawlayer_mapping_profile_t _conf_mapping_profile (const char *key)
 Read and clamp one mapping-profile enum key.
 
static void _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.
 
static void _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.
 
static void _remember_display_color (dt_iop_module_t *self, const float display_rgb[3])
 Push current display color to history and trigger swatch redraw.
 
static void _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.
 
static void _sync_color_picker_from_conf (dt_iop_module_t *self)
 Refresh picker widgets from persisted config color.
 
static void _sync_params_from_gui (dt_iop_module_t *self, const gboolean record_history)
 Sync active GUI widget values back into persistent config keys.
 

Detailed Description

Drawlayer configuration read/write helpers (private include unit).

Macro Definition Documentation

◆ DRAWLAYER_CONF_ACCEL_PROFILE

#define DRAWLAYER_CONF_ACCEL_PROFILE   DRAWLAYER_CONF_BASE "acceleration_profile"

◆ DRAWLAYER_CONF_BASE

#define DRAWLAYER_CONF_BASE   "plugins/drawlayer/"

◆ DRAWLAYER_CONF_BRUSH_MODE

#define DRAWLAYER_CONF_BRUSH_MODE   DRAWLAYER_CONF_BASE "brush_mode"

◆ DRAWLAYER_CONF_BRUSH_SHAPE

#define DRAWLAYER_CONF_BRUSH_SHAPE   DRAWLAYER_CONF_BASE "brush_shape"

◆ DRAWLAYER_CONF_COLOR_B

#define DRAWLAYER_CONF_COLOR_B   DRAWLAYER_CONF_BASE "color_b"

◆ DRAWLAYER_CONF_COLOR_G

#define DRAWLAYER_CONF_COLOR_G   DRAWLAYER_CONF_BASE "color_g"

◆ DRAWLAYER_CONF_COLOR_R

#define DRAWLAYER_CONF_COLOR_R   DRAWLAYER_CONF_BASE "color_r"

◆ DRAWLAYER_CONF_DISTANCE

#define DRAWLAYER_CONF_DISTANCE   DRAWLAYER_CONF_BASE "distance"

◆ DRAWLAYER_CONF_FLOW

#define DRAWLAYER_CONF_FLOW   DRAWLAYER_CONF_BASE "flow"

◆ DRAWLAYER_CONF_HDR_EV

#define DRAWLAYER_CONF_HDR_EV   DRAWLAYER_CONF_BASE "hdr_exposure"

◆ DRAWLAYER_CONF_MAP_ACCEL_FLOW

#define DRAWLAYER_CONF_MAP_ACCEL_FLOW   DRAWLAYER_CONF_BASE "map_acceleration_flow"

◆ DRAWLAYER_CONF_MAP_ACCEL_OPACITY

#define DRAWLAYER_CONF_MAP_ACCEL_OPACITY   DRAWLAYER_CONF_BASE "map_acceleration_opacity"

◆ DRAWLAYER_CONF_MAP_ACCEL_SIZE

#define DRAWLAYER_CONF_MAP_ACCEL_SIZE   DRAWLAYER_CONF_BASE "map_acceleration_size"

◆ DRAWLAYER_CONF_MAP_ACCEL_SOFTNESS

#define DRAWLAYER_CONF_MAP_ACCEL_SOFTNESS   DRAWLAYER_CONF_BASE "map_acceleration_hardness"

◆ DRAWLAYER_CONF_MAP_PRESSURE_FLOW

#define DRAWLAYER_CONF_MAP_PRESSURE_FLOW   DRAWLAYER_CONF_BASE "map_pressure_flow"

◆ DRAWLAYER_CONF_MAP_PRESSURE_OPACITY

#define DRAWLAYER_CONF_MAP_PRESSURE_OPACITY   DRAWLAYER_CONF_BASE "map_pressure_opacity"

◆ DRAWLAYER_CONF_MAP_PRESSURE_SIZE

#define DRAWLAYER_CONF_MAP_PRESSURE_SIZE   DRAWLAYER_CONF_BASE "map_pressure_size"

◆ DRAWLAYER_CONF_MAP_PRESSURE_SOFTNESS

#define DRAWLAYER_CONF_MAP_PRESSURE_SOFTNESS   DRAWLAYER_CONF_BASE "map_pressure_softness"

◆ DRAWLAYER_CONF_MAP_TILT_FLOW

#define DRAWLAYER_CONF_MAP_TILT_FLOW   DRAWLAYER_CONF_BASE "map_tilt_flow"

◆ DRAWLAYER_CONF_MAP_TILT_OPACITY

#define DRAWLAYER_CONF_MAP_TILT_OPACITY   DRAWLAYER_CONF_BASE "map_tilt_opacity"

◆ DRAWLAYER_CONF_MAP_TILT_SIZE

#define DRAWLAYER_CONF_MAP_TILT_SIZE   DRAWLAYER_CONF_BASE "map_tilt_size"

◆ DRAWLAYER_CONF_MAP_TILT_SOFTNESS

#define DRAWLAYER_CONF_MAP_TILT_SOFTNESS   DRAWLAYER_CONF_BASE "map_tilt_softness"

◆ DRAWLAYER_CONF_OPACITY

#define DRAWLAYER_CONF_OPACITY   DRAWLAYER_CONF_BASE "opacity"

◆ DRAWLAYER_CONF_PICK_SOURCE

#define DRAWLAYER_CONF_PICK_SOURCE   DRAWLAYER_CONF_BASE "pick_source"

◆ DRAWLAYER_CONF_PRESSURE_PROFILE

#define DRAWLAYER_CONF_PRESSURE_PROFILE   DRAWLAYER_CONF_BASE "pressure_profile"

◆ DRAWLAYER_CONF_SIZE

#define DRAWLAYER_CONF_SIZE   DRAWLAYER_CONF_BASE "size"

◆ DRAWLAYER_CONF_SMOOTHING

#define DRAWLAYER_CONF_SMOOTHING   DRAWLAYER_CONF_BASE "smoothing"

◆ DRAWLAYER_CONF_SOFTNESS

#define DRAWLAYER_CONF_SOFTNESS   DRAWLAYER_CONF_BASE "softness"

◆ DRAWLAYER_CONF_SPRINKLE_COARSENESS

#define DRAWLAYER_CONF_SPRINKLE_COARSENESS   DRAWLAYER_CONF_BASE "sprinkle_coarseness"

◆ DRAWLAYER_CONF_SPRINKLE_SIZE

#define DRAWLAYER_CONF_SPRINKLE_SIZE   DRAWLAYER_CONF_BASE "sprinkle_size"

◆ DRAWLAYER_CONF_SPRINKLES

#define DRAWLAYER_CONF_SPRINKLES   DRAWLAYER_CONF_BASE "sprinkles"

◆ DRAWLAYER_CONF_TILT_PROFILE

#define DRAWLAYER_CONF_TILT_PROFILE   DRAWLAYER_CONF_BASE "tilt_profile"

Function Documentation

◆ _apply_display_brush_color()

static void _apply_display_brush_color ( dt_iop_module_t self,
const float  display_rgb[3],
const gboolean  remember 
)
static

◆ _color_history_key()

static void _color_history_key ( const int  index,
const char  channel,
char *  key,
const size_t  key_size 
)
static

Build config key for one color-history channel entry.

References DRAWLAYER_CONF_BASE, and key.

Referenced by _load_color_history(), and _store_color_history().

◆ _color_history_valid_key()

static void _color_history_valid_key ( const int  index,
char *  key,
const size_t  key_size 
)
static

Build config key for one color-history validity entry.

References DRAWLAYER_CONF_BASE, and key.

Referenced by _load_color_history(), and _store_color_history().

◆ _conf_brush_mode()

◆ _conf_brush_shape()

◆ _conf_display_color()

static void _conf_display_color ( float  rgb[3])
static

◆ _conf_distance()

static float _conf_distance ( void  )
static

Read and clamp configured distance/sampling parameter (%).

References DRAWLAYER_CONF_DISTANCE, and dt_conf_get_float().

Referenced by _fill_input_brush_settings(), and gui_update().

◆ _conf_flow()

static float _conf_flow ( void  )
static

Read and clamp configured flow (%).

References DRAWLAYER_CONF_FLOW, and dt_conf_get_float().

Referenced by _compute_hud_brush_state(), _fill_input_brush_settings(), and gui_update().

◆ _conf_hardness()

static float _conf_hardness ( void  )
static

◆ _conf_hdr_exposure()

static float _conf_hdr_exposure ( void  )
static

Read and clamp HDR picker exposure compensation (EV).

References DRAWLAYER_CONF_HDR_EV, and dt_conf_get_float().

Referenced by _get_brush_colors(), and gui_update().

◆ _conf_mapping_profile()

static drawlayer_mapping_profile_t _conf_mapping_profile ( const char *  key)
static

◆ _conf_opacity()

static float _conf_opacity ( void  )
static

◆ _conf_pick_source()

static drawlayer_pick_source_t _conf_pick_source ( void  )
static

Read and clamp color picker source selector.

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().

◆ _conf_size()

◆ _conf_smoothing()

static float _conf_smoothing ( void  )
static

Read and clamp configured smoothing parameter (%).

References DRAWLAYER_CONF_SMOOTHING, and dt_conf_get_float().

Referenced by _fill_input_brush_settings(), and gui_update().

◆ _conf_softness()

static float _conf_softness ( void  )
static

Read configured softness in [0,1].

References _clamp01(), DRAWLAYER_CONF_SOFTNESS, and dt_conf_get_float().

Referenced by _conf_hardness().

◆ _conf_sprinkle_coarseness()

static float _conf_sprinkle_coarseness ( void  )
static

Read and clamp configured sprinkle octave mix (%).

References DRAWLAYER_CONF_SPRINKLE_COARSENESS, and dt_conf_get_float().

Referenced by _fill_input_brush_settings(), _sync_brush_profile_preview_widget(), and gui_update().

◆ _conf_sprinkle_size()

static float _conf_sprinkle_size ( void  )
static

Read and clamp configured sprinkle feature size (px).

References DRAWLAYER_CONF_SPRINKLE_SIZE, and dt_conf_get_float().

Referenced by _fill_input_brush_settings(), _sync_brush_profile_preview_widget(), and gui_update().

◆ _conf_sprinkles()

static float _conf_sprinkles ( void  )
static

Read and clamp configured sprinkles amount (%).

References DRAWLAYER_CONF_SPRINKLES, and dt_conf_get_float().

Referenced by _fill_input_brush_settings(), _sync_brush_profile_preview_widget(), and gui_update().

◆ _ensure_gui_conf_defaults()

◆ _load_color_history()

static void _load_color_history ( dt_iop_drawlayer_gui_data_t g)
static

◆ _remember_display_color()

static void _remember_display_color ( dt_iop_module_t self,
const float  display_rgb[3] 
)
static

Push current display color to history and trigger swatch redraw.

References _store_color_history(), dt_drawlayer_widgets_push_color_history(), g, and dt_iop_module_t::gui_data.

Referenced by _apply_display_brush_color(), and _color_picker_button_release().

◆ _store_color_history()

static void _store_color_history ( const dt_iop_drawlayer_gui_data_t g)
static

◆ _sync_color_picker_from_conf()

static void _sync_color_picker_from_conf ( dt_iop_module_t self)
static

Refresh picker widgets from persisted config color.

References _conf_display_color(), dt_drawlayer_widgets_set_display_color(), g, and dt_iop_module_t::gui_data.

Referenced by gui_update().

◆ _sync_params_from_gui()