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

Drawlayer module entrypoints and runtime orchestration. More...

#include "bauhaus/bauhaus.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/dtpthread.h"
#include "common/image.h"
#include "common/imagebuf.h"
#include "common/imageio.h"
#include "common/imageio_module.h"
#include "common/iop_profile.h"
#include "common/opencl.h"
#include "control/conf.h"
#include "control/control.h"
#include "control/jobs.h"
#include "develop/blend.h"
#include "develop/dev_history.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/imageop_gui.h"
#include "develop/imageop_math.h"
#include "develop/noise_generator.h"
#include "develop/pixelpipe_cache.h"
#include "gui/color_picker_proxy.h"
#include "gui/gtk.h"
#include "gui/gui_throttle.h"
#include "iop/drawlayer/brush.h"
#include "iop/drawlayer/cache.h"
#include "iop/drawlayer/common.h"
#include "iop/drawlayer/coordinates.h"
#include "iop/drawlayer/io.h"
#include "iop/drawlayer/module.h"
#include "iop/drawlayer/paint.h"
#include "iop/drawlayer/runtime.h"
#include "iop/drawlayer/widgets.h"
#include "iop/drawlayer/worker.h"
#include "iop/iop_api.h"
#include <glib/gstdio.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <sched.h>
#include <stdlib.h>
#include <string.h>
#include "drawlayer/conf.c"
#include "drawlayer/coordinates.c"
#include "drawlayer/worker.c"
#include "drawlayer/layers.c"
+ Include dependency graph for drawlayer.c:

Data Structures

struct  dt_iop_drawlayer_global_data_t
 
struct  drawlayer_preview_background_t
 
struct  drawlayer_wait_dialog_t
 
struct  drawlayer_process_scratch_t
 
struct  drawlayer_cl_image_handle_t
 
struct  drawlayer_modal_wait_state_t
 
struct  drawlayer_hud_brush_state_t
 

Macros

#define _commit_dabs   dt_drawlayer_commit_dabs
 
#define _flush_layer_cache   dt_drawlayer_flush_layer_cache
 
#define _sync_widget_cache   dt_drawlayer_sync_widget_cache
 
#define _set_drawlayer_pipeline_realtime_mode   dt_drawlayer_set_pipeline_realtime_mode
 
#define _ensure_layer_cache   dt_drawlayer_ensure_layer_cache
 
#define _release_all_base_patch_extra_refs   dt_drawlayer_release_all_base_patch_extra_refs
 
#define _drawlayer_wait_for_rasterization_modal   dt_drawlayer_wait_for_rasterization_modal
 
#define _set_drawlayer_os_cursor_hidden   dt_drawlayer_set_os_cursor_hidden
 
#define _current_live_padding   dt_drawlayer_current_live_padding
 
#define _layer_to_widget_coords   dt_drawlayer_layer_to_widget_coords
 
#define _touch_stroke_commit_hash   dt_drawlayer_touch_stroke_commit_hash
 
#define _drawlayer_runtime_collect_inputs   NULL
 
#define _drawlayer_runtime_perform_action   NULL
 

Typedefs

typedef struct dt_iop_drawlayer_global_data_t dt_iop_drawlayer_global_data_t
 
typedef struct drawlayer_preview_background_t drawlayer_preview_background_t
 
typedef dt_drawlayer_runtime_request_t drawlayer_runtime_request_t
 
typedef dt_drawlayer_runtime_context_t drawlayer_runtime_host_context_t
 
typedef struct drawlayer_wait_dialog_t drawlayer_wait_dialog_t
 
typedef struct drawlayer_process_scratch_t drawlayer_process_scratch_t
 
typedef struct drawlayer_cl_image_handle_t drawlayer_cl_image_handle_t
 
typedef struct drawlayer_modal_wait_state_t drawlayer_modal_wait_state_t
 
typedef struct drawlayer_hud_brush_state_t drawlayer_hud_brush_state_t
 

Functions

gboolean dt_drawlayer_commit_dabs (dt_iop_module_t *self, gboolean record_history)
 
gboolean dt_drawlayer_flush_layer_cache (dt_iop_module_t *self)
 
static void _sync_mode_sensitive_widgets (dt_iop_module_t *self)
 
static void _refresh_layer_widgets (dt_iop_module_t *self)
 
static void _sync_layer_controls (dt_iop_module_t *self)
 
static void _sanitize_requested_layer_name (const char *requested, char *name, size_t name_size)
 
static gboolean _prompt_layer_name_dialog (const char *title, const char *message, const char *initial_name, char *name, size_t name_size)
 
gboolean dt_drawlayer_sync_widget_cache (dt_iop_module_t *self)
 
void dt_drawlayer_set_pipeline_realtime_mode (dt_iop_module_t *self, gboolean state)
 
static gboolean _background_layer_job_done_idle (gpointer user_data)
 
static dt_drawlayer_runtime_result_t _update_gui_runtime_manager (dt_iop_module_t *self, dt_iop_drawlayer_gui_data_t *g, dt_drawlayer_runtime_event_t event, gboolean flush_pending)
 
static void _sync_cached_brush_colors (dt_iop_module_t *self, const float display_rgb[3])
 Cache brush colors in GUI state so stroke input snapshots don't re-transform per event.
 
static void _brush_pipeline_color_from_display (dt_iop_module_t *self, const float display_rgb[3], float pipeline_rgb[3])
 Convert one display-space brush color snapshot to pipeline space.
 
static void _fill_input_brush_settings (dt_iop_module_t *self, dt_drawlayer_paint_raw_input_t *input)
 
static void _fill_input_layer_coords (dt_iop_module_t *self, dt_drawlayer_paint_raw_input_t *input)
 
static gboolean _layer_name_non_empty (const char *name)
 
static gboolean _get_current_work_profile_key (dt_iop_module_t *self, GList *iop_list, dt_dev_pixelpipe_t *pipe, char *key, const size_t key_size)
 
static void _destroy_process_scratch (gpointer data)
 
static drawlayer_process_scratch_t_get_process_scratch (void)
 
static __attribute__ ((always_inline))
 
static gboolean _rekey_shared_base_patch (drawlayer_patch_t *patch, const int32_t imgid, const dt_iop_drawlayer_params_t *params)
 
static void _retain_base_patch_loaded_ref (dt_iop_drawlayer_gui_data_t *g)
 
static void _retain_base_patch_stroke_ref (dt_iop_drawlayer_gui_data_t *g)
 
void dt_drawlayer_release_all_base_patch_extra_refs (dt_iop_drawlayer_gui_data_t *g)
 
static __DT_CLONE_TARGETS__ void _blend_layer_over_input (float *output, const float *input, const float *layerbuf, const size_t pixels, const gboolean use_preview_bg, const float preview_bg)
 
static gboolean _drawlayer_sync_host_image_to_device (const int devid, cl_mem device_image, void *host_pixels, const int width, const int height, const int bpp, const dt_drawlayer_damaged_rect_t *dirty_rect)
 
static gboolean _drawlayer_acquire_source_image (const int devid, const float *layer_pixels, dt_pixel_cache_entry_t *resolved_entry, const gboolean force_device_copy, const gboolean realtime_reuse, const int source_w, const int source_h, dt_drawlayer_process_state_t *process, drawlayer_cl_image_handle_t *source)
 
static int _drawlayer_copy_or_resample_layer_roi (const int devid, cl_mem dev_source_rgba, cl_mem dev_layer_rgba, const int source_w, const int source_h, const dt_iop_roi_t *const target_roi, const dt_iop_roi_t *const source_roi)
 
static gboolean _drawlayer_acquire_layer_image (const int devid, dt_pixel_cache_entry_t *resolved_entry, const gboolean realtime_reuse, const gboolean direct_copy, cl_mem dev_source_rgba, const int source_w, const int source_h, const dt_iop_roi_t *const target_roi, const dt_iop_roi_t *const source_roi, drawlayer_cl_image_handle_t *layer, int *err)
 
static int _drawlayer_run_premult_over_kernel (const int devid, const int kernel_premult_over, cl_mem dev_background, cl_mem dev_layer_rgba, cl_mem dev_out, const int width, const int height, const int background_offset_x, const int background_offset_y)
 
static int _blend_layer_over_input_cl (const int devid, const int kernel_premult_over, cl_mem dev_out, cl_mem dev_in, drawlayer_process_scratch_t *scratch, const float *layer_pixels, dt_pixel_cache_entry_t *source_entry, cl_mem source_mem_override, const int source_w, const int source_h, dt_drawlayer_process_state_t *process, const dt_iop_roi_t *const target_roi, const dt_iop_roi_t *const source_roi, const gboolean direct_copy, const gboolean use_preview_bg, const float preview_bg, const gboolean realtime_reuse, const gboolean force_device_copy)
 
static gboolean _profile_key_is_sane (const char *value)
 
static int64_t _sidecar_timestamp_from_path (const char *path)
 
static void _ensure_cursor_stamp_surface (dt_iop_module_t *self, const float widget_radius, const float opacity, const float hardness)
 
void dt_drawlayer_set_os_cursor_hidden (const gboolean hidden)
 
static drawlayer_wait_dialog_t _show_drawlayer_wait_dialog (const char *title, const char *message)
 
static gboolean _drawlayer_modal_wait_tick (gpointer user_data)
 
void dt_drawlayer_wait_for_rasterization_modal (const dt_iop_drawlayer_gui_data_t *g, const char *title, const char *message)
 
static void _show_drawlayer_modal_message (const GtkMessageType type, const char *primary, const char *secondary)
 
static gboolean _color_picker_set_from_position (dt_iop_module_t *self, const float x, const float y)
 
static gboolean _color_picker_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 
static gboolean _color_swatch_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 
static gboolean _color_swatch_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static void _sync_brush_profile_preview_widget (dt_iop_module_t *self)
 
static gboolean _brush_profile_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 
static gboolean _brush_profile_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean _working_rgb_to_display_rgb (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const float working_rgb[3], float display_rgb[3])
 
void color_picker_apply (dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 Apply selected picker color to drawlayer brush color.
 
static gboolean _color_picker_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean _color_picker_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean _color_picker_motion (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 
static void _sanitize_params (dt_iop_module_t *self, dt_iop_drawlayer_params_t *params)
 
void dt_drawlayer_touch_stroke_commit_hash (dt_iop_drawlayer_params_t *params, const int dab_count, const gboolean have_last_dab, const float last_dab_x, const float last_dab_y, const uint32_t publish_serial)
 
static void _sync_preview_bg_buttons (dt_iop_module_t *self)
 
static void _develop_ui_pipe_finished_callback (gpointer instance, gpointer user_data)
 
static gboolean _delete_current_layer (dt_iop_module_t *self)
 
static gboolean _confirm_delete_layer (dt_iop_module_t *self, const gboolean removing_module)
 
static gboolean _rename_current_layer_from_gui (dt_iop_module_t *self, const char *requested_name)
 
static gboolean _create_new_layer (dt_iop_module_t *self, const char *requested_name)
 
static void _build_pre_module_filter_string (dt_iop_module_t *self, char *filter, const size_t filter_size)
 
static gboolean _create_background_layer_from_input (dt_iop_module_t *self)
 
static void _widget_changed (GtkWidget *widget, gpointer user_data)
 
static gboolean _apply_selected_layer_attachment (dt_iop_module_t *self, dt_iop_drawlayer_gui_data_t *g, dt_iop_drawlayer_params_t *params, const char *layer_name, const int layer_order)
 Apply one selected on-disk layer from the combobox to module params/history.
 
static void _layer_selected (GtkWidget *widget, gpointer user_data)
 
static void _attach_selected_layer_clicked (GtkButton *button, gpointer user_data)
 
static void _rename_layer_clicked (GtkButton *button, gpointer user_data)
 
static void _delete_layer_clicked (GtkButton *button, gpointer user_data)
 
static gboolean _fill_current_layer (dt_iop_module_t *self, const float value)
 
static gboolean _clear_current_layer (dt_iop_module_t *self)
 
static void _fill_white_clicked (GtkButton *button, gpointer user_data)
 
static void _fill_black_clicked (GtkButton *button, gpointer user_data)
 
static void _fill_transparent_clicked (GtkButton *button, gpointer user_data)
 
static void _save_layer_clicked (GtkButton *button, gpointer user_data)
 
static void _create_layer_clicked (GtkButton *button, gpointer user_data)
 
static void _create_background_clicked (GtkButton *button, gpointer user_data)
 
static void _preview_bg_toggled (GtkToggleButton *button, gpointer user_data)
 
static gboolean _build_raw_input_event (dt_iop_module_t *self, const double wx, const double wy, const double pressure, const dt_drawlayer_paint_stroke_pos_t stroke_pos, dt_drawlayer_paint_raw_input_t *input)
 
void dt_drawlayer_begin_gui_stroke_capture (dt_iop_module_t *self, const dt_drawlayer_paint_raw_input_t *first_input)
 
void dt_drawlayer_end_gui_stroke_capture (dt_iop_module_t *self)
 
void dt_drawlayer_show_runtime_feedback (const dt_iop_drawlayer_gui_data_t *g, const dt_drawlayer_runtime_feedback_t feedback)
 
const char * name ()
 Module display name.
 
const char ** description (struct dt_iop_module_t *self)
 Module description strings used by UI/help.
 
void init_global (dt_iop_module_so_t *module)
 Initialize global OpenCL resources for drawlayer kernels.
 
void cleanup_global (dt_iop_module_so_t *module)
 Release global OpenCL resources for drawlayer.
 
int default_group ()
 Return default iop group for drawlayer module.
 
int flags ()
 Return module capability flags.
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 Return default colorspace expected by drawlayer process paths.
 
void init (dt_iop_module_t *module)
 Allocate and initialize module parameter blocks.
 
void init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 Cleanup per-pipe runtime data.
 
void commit_params (dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 Commit params to runtime piece and refresh base cache state.
 
void gui_reset (dt_iop_module_t *self)
 Reset GUI/session state for current drawlayer instance.
 
gboolean module_will_remove (dt_iop_module_t *self)
 Hook called before module removal from history stack.
 
void gui_init (dt_iop_module_t *self)
 Build GUI widgets and initialize worker/caches.
 
void gui_update (dt_iop_module_t *self)
 Refresh GUI controls from current params and configuration.
 
void change_image (dt_iop_module_t *self)
 Invalidate module state when active image changes.
 
void gui_focus (dt_iop_module_t *self, gboolean in)
 Focus transition hook (enter/leave) for drawlayer GUI mode.
 
void gui_cleanup (dt_iop_module_t *self)
 Destroy GUI resources and stop background worker.
 
static void _compute_hud_brush_state (const dt_control_pointer_input_t *pointer_input, drawlayer_hud_brush_state_t *state)
 
static void _draw_brush_hud (cairo_t *cr, const drawlayer_hud_brush_state_t *state)
 
void gui_post_expose (dt_iop_module_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
 Draw post-expose overlay (cursor, HUD, temp preview).
 
int mouse_leave (dt_iop_module_t *self)
 Mouse leave handler.
 
int mouse_moved (dt_iop_module_t *self, double x, double y, double pressure, int which)
 Mouse motion handler.
 
int button_pressed (dt_iop_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state)
 Button press handler (starts stroke capture on left button).
 
int button_released (dt_iop_module_t *self, double x, double y, int which, uint32_t state)
 Button release handler (ends current stroke).
 
int scrolled (dt_iop_module_t *self, double x, double y, int up, uint32_t state)
 Scroll handler used for interactive brush-size changes.
 
int process_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
 OpenCL processing path for layer-over-input compositing.
 
__DT_CLONE_TARGETS__ int process (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
 CPU processing path for layer-over-input compositing.
 

Variables

static GPrivate _drawlayer_process_scratch_key = G_PRIVATE_INIT(_destroy_process_scratch)
 

Detailed Description

Drawlayer module entrypoints and runtime orchestration.

Macro Definition Documentation

◆ _commit_dabs

#define _commit_dabs   dt_drawlayer_commit_dabs

◆ _current_live_padding

#define _current_live_padding   dt_drawlayer_current_live_padding

◆ _drawlayer_runtime_collect_inputs

#define _drawlayer_runtime_collect_inputs   NULL

◆ _drawlayer_runtime_perform_action

#define _drawlayer_runtime_perform_action   NULL

◆ _drawlayer_wait_for_rasterization_modal

#define _drawlayer_wait_for_rasterization_modal   dt_drawlayer_wait_for_rasterization_modal

◆ _ensure_layer_cache

#define _ensure_layer_cache   dt_drawlayer_ensure_layer_cache

◆ _flush_layer_cache

#define _flush_layer_cache   dt_drawlayer_flush_layer_cache

◆ _layer_to_widget_coords

#define _layer_to_widget_coords   dt_drawlayer_layer_to_widget_coords

◆ _release_all_base_patch_extra_refs

#define _release_all_base_patch_extra_refs   dt_drawlayer_release_all_base_patch_extra_refs

◆ _set_drawlayer_os_cursor_hidden

#define _set_drawlayer_os_cursor_hidden   dt_drawlayer_set_os_cursor_hidden

◆ _set_drawlayer_pipeline_realtime_mode

#define _set_drawlayer_pipeline_realtime_mode   dt_drawlayer_set_pipeline_realtime_mode

◆ _sync_widget_cache

#define _sync_widget_cache   dt_drawlayer_sync_widget_cache

◆ _touch_stroke_commit_hash

#define _touch_stroke_commit_hash   dt_drawlayer_touch_stroke_commit_hash

Typedef Documentation

◆ drawlayer_cl_image_handle_t

◆ drawlayer_hud_brush_state_t

◆ drawlayer_modal_wait_state_t

◆ drawlayer_preview_background_t

◆ drawlayer_process_scratch_t

◆ drawlayer_runtime_host_context_t

◆ drawlayer_runtime_request_t

◆ drawlayer_wait_dialog_t

◆ dt_iop_drawlayer_global_data_t

Function Documentation

◆ __attribute__()

◆ _apply_selected_layer_attachment()

static gboolean _apply_selected_layer_attachment ( dt_iop_module_t self,
dt_iop_drawlayer_gui_data_t g,
dt_iop_drawlayer_params_t params,
const char *  layer_name,
const int  layer_order 
)
static

◆ _attach_selected_layer_clicked()

static void _attach_selected_layer_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _background_layer_job_done_idle()

◆ _blend_layer_over_input()

static __DT_CLONE_TARGETS__ void _blend_layer_over_input ( float *  output,
const float *  input,
const float *  layerbuf,
const size_t  pixels,
const gboolean  use_preview_bg,
const float  preview_bg 
)
static

◆ _blend_layer_over_input_cl()

◆ _brush_pipeline_color_from_display()

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

◆ _brush_profile_button_press()

◆ _brush_profile_draw()

static gboolean _brush_profile_draw ( GtkWidget widget,
cairo_t *  cr,
gpointer  user_data 
)
static

◆ _build_pre_module_filter_string()

static void _build_pre_module_filter_string ( dt_iop_module_t self,
char *  filter,
const size_t  filter_size 
)
static

◆ _build_raw_input_event()

◆ _clear_current_layer()

◆ _color_picker_button_press()

static gboolean _color_picker_button_press ( GtkWidget widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ _color_picker_button_release()

static gboolean _color_picker_button_release ( GtkWidget widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ _color_picker_draw()

static gboolean _color_picker_draw ( GtkWidget widget,
cairo_t *  cr,
gpointer  user_data 
)
static

◆ _color_picker_motion()

static gboolean _color_picker_motion ( GtkWidget widget,
GdkEventMotion *  event,
gpointer  user_data 
)
static

◆ _color_picker_set_from_position()

static gboolean _color_picker_set_from_position ( dt_iop_module_t self,
const float  x,
const float  y 
)
static

◆ _color_swatch_button_press()

static gboolean _color_swatch_button_press ( GtkWidget widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ _color_swatch_draw()

static gboolean _color_swatch_draw ( GtkWidget widget,
cairo_t *  cr,
gpointer  user_data 
)
static

◆ _compute_hud_brush_state()

◆ _confirm_delete_layer()

◆ _create_background_clicked()

static void _create_background_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _create_background_layer_from_input()

static gboolean _create_background_layer_from_input ( dt_iop_module_t self)
static

References _background_layer_job_done_idle(), _build_pre_module_filter_string(), _commit_dabs, _ensure_layer_cache, _flush_layer_cache, _layer_name_non_empty(), darktable_t::control, dt_drawlayer_io_layer_info_t::count, drawlayer_dir_info_t::count, darktable, dt_iop_module_t::dev, dt_drawlayer_io_background_job_params_t::done_idle, dt_drawlayer_io_background_job_params_t::dst_x, dt_drawlayer_io_background_job_params_t::dst_y, dt_control_add_job(), dt_control_job_add_progress(), dt_control_job_create(), dt_control_job_set_params(), dt_dev_distort_get_iop_pipe(), dt_drawlayer_io_background_layer_job_run(), dt_drawlayer_io_find_layer(), dt_drawlayer_io_sidecar_path(), dt_free, DT_JOB_QUEUE_USER_BG, FALSE, dt_drawlayer_io_background_job_params_t::filter, dt_drawlayer_io_layer_info_t::found, drawlayer_dir_info_t::found, g, dt_iop_module_t::gui_data, dt_drawlayer_io_layer_info_t::height, drawlayer_dir_info_t::height, dt_image_t::id, dt_develop_t::image_storage, dt_drawlayer_io_background_job_params_t::imgid, dt_drawlayer_io_layer_info_t::index, drawlayer_dir_info_t::index, dt_drawlayer_io_background_job_params_t::initiator_layer_name, dt_drawlayer_io_background_job_params_t::initiator_layer_order, dt_drawlayer_io_background_job_params_t::insert_after_order, IS_NULL_PTR, dt_drawlayer_io_background_job_params_t::layer_height, dt_drawlayer_io_background_job_params_t::layer_width, dt_drawlayer_io_layer_info_t::name, drawlayer_dir_info_t::name, dt_iop_module_t::params, PATH_MAX, dt_develop_t::pipe, dt_drawlayer_io_background_job_params_t::requested_bg_name, dt_drawlayer_io_background_job_params_t::sidecar_path, TRUE, dt_drawlayer_io_layer_info_t::width, drawlayer_dir_info_t::width, dt_drawlayer_io_layer_info_t::work_profile, dt_drawlayer_io_background_job_params_t::work_profile, and drawlayer_dir_info_t::work_profile.

Referenced by _create_background_clicked().

◆ _create_layer_clicked()

static void _create_layer_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _create_new_layer()

◆ _delete_current_layer()

◆ _delete_layer_clicked()

static void _delete_layer_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _destroy_process_scratch()

◆ _develop_ui_pipe_finished_callback()

◆ _draw_brush_hud()

static void _draw_brush_hud ( cairo_t *  cr,
const drawlayer_hud_brush_state_t state 
)
static

References DT_PIXEL_APPLY_DPI, i, IS_NULL_PTR, state, and x.

Referenced by gui_post_expose().

◆ _drawlayer_acquire_layer_image()

static gboolean _drawlayer_acquire_layer_image ( const int  devid,
dt_pixel_cache_entry_t resolved_entry,
const gboolean  realtime_reuse,
const gboolean  direct_copy,
cl_mem  dev_source_rgba,
const int  source_w,
const int  source_h,
const dt_iop_roi_t *const  target_roi,
const dt_iop_roi_t *const  source_roi,
drawlayer_cl_image_handle_t layer,
int *  err 
)
static

◆ _drawlayer_acquire_source_image()

◆ _drawlayer_copy_or_resample_layer_roi()

static int _drawlayer_copy_or_resample_layer_roi ( const int  devid,
cl_mem  dev_source_rgba,
cl_mem  dev_layer_rgba,
const int  source_w,
const int  source_h,
const dt_iop_roi_t *const  target_roi,
const dt_iop_roi_t *const  source_roi 
)
static

◆ _drawlayer_modal_wait_tick()

static gboolean _drawlayer_modal_wait_tick ( gpointer  user_data)
static

◆ _drawlayer_run_premult_over_kernel()

static int _drawlayer_run_premult_over_kernel ( const int  devid,
const int  kernel_premult_over,
cl_mem  dev_background,
cl_mem  dev_layer_rgba,
cl_mem  dev_out,
const int  width,
const int  height,
const int  background_offset_x,
const int  background_offset_y 
)
static

◆ _drawlayer_sync_host_image_to_device()

static gboolean _drawlayer_sync_host_image_to_device ( const int  devid,
cl_mem  device_image,
void host_pixels,
const int  width,
const int  height,
const int  bpp,
const dt_drawlayer_damaged_rect_t dirty_rect 
)
static

◆ _ensure_cursor_stamp_surface()

static void _ensure_cursor_stamp_surface ( dt_iop_module_t self,
const float  widget_radius,
const float  opacity,
const float  hardness 
)
static

◆ _fill_black_clicked()

static void _fill_black_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

References _fill_current_layer(), dt_control_log(), and void().

Referenced by gui_init().

◆ _fill_current_layer()

◆ _fill_input_brush_settings()

static void _fill_input_brush_settings ( dt_iop_module_t self,
dt_drawlayer_paint_raw_input_t input 
)
static

References _brush_pipeline_color_from_display(), _clamp01(), _conf_brush_mode(), _conf_brush_shape(), _conf_display_color(), _conf_distance(), _conf_flow(), _conf_hardness(), _conf_mapping_profile(), _conf_opacity(), _conf_size(), _conf_smoothing(), _conf_sprinkle_coarseness(), _conf_sprinkle_size(), _conf_sprinkles(), _sync_cached_brush_colors(), dt_drawlayer_paint_raw_input_t::accel_profile, dt_drawlayer_paint_raw_input_t::brush_flow, dt_drawlayer_paint_raw_input_t::brush_hardness, dt_drawlayer_paint_raw_input_t::brush_mode, dt_drawlayer_paint_raw_input_t::brush_opacity, dt_drawlayer_paint_raw_input_t::brush_radius, dt_drawlayer_paint_raw_input_t::brush_shape, dt_drawlayer_paint_raw_input_t::brush_sprinkle_coarseness, dt_drawlayer_paint_raw_input_t::brush_sprinkle_size, dt_drawlayer_paint_raw_input_t::brush_sprinkles, dt_drawlayer_paint_raw_input_t::color, dt_drawlayer_paint_raw_input_t::display_color, dt_drawlayer_paint_raw_input_t::distance_percent, 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, DRAWLAYER_INPUT_MAP_ACCEL_FLOW, DRAWLAYER_INPUT_MAP_ACCEL_OPACITY, DRAWLAYER_INPUT_MAP_ACCEL_SIZE, DRAWLAYER_INPUT_MAP_ACCEL_SOFTNESS, DRAWLAYER_INPUT_MAP_PRESSURE_FLOW, DRAWLAYER_INPUT_MAP_PRESSURE_OPACITY, DRAWLAYER_INPUT_MAP_PRESSURE_SIZE, DRAWLAYER_INPUT_MAP_PRESSURE_SOFTNESS, DRAWLAYER_INPUT_MAP_TILT_FLOW, DRAWLAYER_INPUT_MAP_TILT_OPACITY, DRAWLAYER_INPUT_MAP_TILT_SIZE, DRAWLAYER_INPUT_MAP_TILT_SOFTNESS, dt_conf_get_bool(), g, dt_iop_module_t::gui_data, IS_NULL_PTR, dt_drawlayer_paint_raw_input_t::map_flags, dt_drawlayer_paint_raw_input_t::pressure_profile, dt_drawlayer_paint_raw_input_t::smoothing_percent, and dt_drawlayer_paint_raw_input_t::tilt_profile.

Referenced by _build_raw_input_event(), button_pressed(), and button_released().

◆ _fill_input_layer_coords()

◆ _fill_transparent_clicked()

static void _fill_transparent_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

References _clear_current_layer(), dt_control_log(), and void().

Referenced by gui_init().

◆ _fill_white_clicked()

static void _fill_white_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

References _fill_current_layer(), dt_control_log(), and void().

Referenced by gui_init().

◆ _get_current_work_profile_key()

static gboolean _get_current_work_profile_key ( dt_iop_module_t self,
GList *  iop_list,
dt_dev_pixelpipe_t pipe,
char *  key,
const size_t  key_size 
)
static

◆ _get_process_scratch()

static drawlayer_process_scratch_t * _get_process_scratch ( void  )
static

References _drawlayer_process_scratch_key, and IS_NULL_PTR.

Referenced by process(), and process_cl().

◆ _layer_name_non_empty()

◆ _layer_selected()

◆ _preview_bg_toggled()

◆ _profile_key_is_sane()

static gboolean _profile_key_is_sane ( const char *  value)
static

References FALSE, IS_NULL_PTR, and value.

Referenced by _sanitize_params().

◆ _prompt_layer_name_dialog()

static gboolean _prompt_layer_name_dialog ( const char *  title,
const char *  message,
const char *  initial_name,
char *  name,
size_t  name_size 
)
static

◆ _refresh_layer_widgets()

◆ _rekey_shared_base_patch()

◆ _rename_current_layer_from_gui()

◆ _rename_layer_clicked()

◆ _retain_base_patch_loaded_ref()

◆ _retain_base_patch_stroke_ref()

◆ _sanitize_params()

◆ _sanitize_requested_layer_name()

static void _sanitize_requested_layer_name ( const char *  requested,
char *  name,
size_t  name_size 
)
static

◆ _save_layer_clicked()

◆ _show_drawlayer_modal_message()

static void _show_drawlayer_modal_message ( const GtkMessageType  type,
const char *  primary,
const char *  secondary 
)
static

◆ _show_drawlayer_wait_dialog()

static drawlayer_wait_dialog_t _show_drawlayer_wait_dialog ( const char *  title,
const char *  message 
)
static

◆ _sidecar_timestamp_from_path()

static int64_t _sidecar_timestamp_from_path ( const char *  path)
static

◆ _sync_brush_profile_preview_widget()

◆ _sync_cached_brush_colors()

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

Cache brush colors in GUI state so stroke input snapshots don't re-transform per event.

References _brush_pipeline_color_from_display(), _clamp01(), g, dt_iop_module_t::gui_data, IS_NULL_PTR, and TRUE.

Referenced by _apply_display_brush_color(), _fill_input_brush_settings(), _sync_color_picker_from_conf(), and _widget_changed().

◆ _sync_layer_controls()

◆ _sync_mode_sensitive_widgets()

◆ _sync_preview_bg_buttons()

◆ _update_gui_runtime_manager()

◆ _widget_changed()

◆ _working_rgb_to_display_rgb()

static gboolean _working_rgb_to_display_rgb ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const float  working_rgb[3],
float  display_rgb[3] 
)
static

◆ button_pressed()

◆ button_released()

◆ change_image()

◆ cleanup_global()

void cleanup_global ( dt_iop_module_so_t module)

◆ cleanup_pipe()

◆ color_picker_apply()

◆ commit_params()

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)

Return default colorspace expected by drawlayer process paths.

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

Return default iop group for drawlayer module.

References IOP_GROUP_EFFECTS.

◆ description()

const char ** description ( struct dt_iop_module_t self)

Module description strings used by UI/help.

References dt_iop_set_description().

◆ dt_drawlayer_begin_gui_stroke_capture()

◆ dt_drawlayer_commit_dabs()

◆ dt_drawlayer_end_gui_stroke_capture()

void dt_drawlayer_end_gui_stroke_capture ( dt_iop_module_t self)

◆ dt_drawlayer_flush_layer_cache()

◆ dt_drawlayer_release_all_base_patch_extra_refs()

◆ dt_drawlayer_set_os_cursor_hidden()

void dt_drawlayer_set_os_cursor_hidden ( const gboolean  hidden)

◆ dt_drawlayer_set_pipeline_realtime_mode()

◆ dt_drawlayer_show_runtime_feedback()

◆ dt_drawlayer_sync_widget_cache()

◆ dt_drawlayer_touch_stroke_commit_hash()

void dt_drawlayer_touch_stroke_commit_hash ( dt_iop_drawlayer_params_t params,
const int  dab_count,
const gboolean  have_last_dab,
const float  last_dab_x,
const float  last_dab_y,
const uint32_t  publish_serial 
)

References dt_hash(), and IS_NULL_PTR.

Referenced by _publish_backend_progress().

◆ dt_drawlayer_wait_for_rasterization_modal()

void dt_drawlayer_wait_for_rasterization_modal ( const dt_iop_drawlayer_gui_data_t g,
const char *  title,
const char *  message 
)

◆ flags()

int flags ( )

Return module capability flags.

References IOP_FLAGS_SUPPORTS_BLENDING.

◆ gui_cleanup()

◆ gui_focus()

◆ gui_init()

void gui_init ( dt_iop_module_t self)

Build GUI widgets and initialize worker/caches.

References _attach_selected_layer_clicked(), _brush_profile_button_press(), _brush_profile_draw(), _color_picker_button_press(), _color_picker_button_release(), _color_picker_draw(), _color_picker_motion(), _color_swatch_button_press(), _color_swatch_draw(), _create_background_clicked(), _create_layer_clicked(), _delete_layer_clicked(), _develop_ui_pipe_finished_callback(), _drawlayer_runtime_collect_inputs, _drawlayer_runtime_perform_action, _ensure_gui_conf_defaults(), _fill_black_clicked(), _fill_transparent_clicked(), _fill_white_clicked(), _layer_selected(), _load_color_history(), _preview_bg_toggled(), _rename_layer_clicked(), _sanitize_params(), _save_layer_clicked(), _widget_changed(), darktable_t::bauhaus, darktable, dt_iop_module_t::dev, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), dt_color_picker_new_with_cst(), DT_COLOR_PICKER_POINT_AREA, DT_DEBUG_CONTROL_SIGNAL_CONNECT, DT_DRAWLAYER_COLOR_HISTORY_HEIGHT, DT_DRAWLAYER_COLOR_PICKER_HEIGHT, dt_drawlayer_process_state_init(), dt_drawlayer_runtime_manager_init(), dt_drawlayer_runtime_manager_update(), dt_drawlayer_widgets_init(), dt_drawlayer_worker_init(), dt_gui_add_class(), DT_GUI_IOP_MODULE_CONTROL_SPACING, DT_GUI_MODULE, DT_PIXEL_APPLY_DPI, DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED, FALSE, g, dt_iop_module_t::gui_data, IOP_CS_NONE, IOP_GUI_ALLOC, dt_iop_module_t::params, r, dt_iop_module_t::reset_button, dt_develop_t::roi, dt_drawlayer_runtime_context_t::runtime, dt_develop_t::scaling, dt_drawlayer_runtime_request_t::self, darktable_t::signals, TRUE, dt_drawlayer_runtime_host_t::user_data, dt_iop_module_t::widget, dt_develop_t::x, and dt_develop_t::y.

◆ gui_post_expose()

◆ gui_reset()

◆ gui_update()

void gui_update ( dt_iop_module_t self)

Refresh GUI controls from current params and configuration.

Todo:
check why needed
Todo:
by hand

References _conf_brush_mode(), _conf_distance(), _conf_flow(), _conf_hardness(), _conf_hdr_exposure(), _conf_mapping_profile(), _conf_opacity(), _conf_pick_source(), _conf_size(), _conf_smoothing(), _conf_sprinkle_coarseness(), _conf_sprinkle_size(), _conf_sprinkles(), _drawlayer_runtime_collect_inputs, _drawlayer_runtime_perform_action, _populate_layer_list(), _sanitize_params(), _sync_brush_profile_preview_widget(), _sync_color_picker_from_conf(), _sync_layer_controls(), _sync_mode_sensitive_widgets(), _sync_preview_bg_buttons(), dt_iop_module_t::dev, 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, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), dt_conf_get_bool(), dt_drawlayer_runtime_manager_update(), g, dt_iop_module_t::gui_data, IS_NULL_PTR, dt_iop_module_t::params, dt_drawlayer_runtime_context_t::runtime, dt_drawlayer_runtime_request_t::self, and dt_drawlayer_runtime_host_t::user_data.

Referenced by _apply_selected_layer_attachment(), _create_new_layer(), and _delete_layer_clicked().

◆ init()

void init ( dt_iop_module_t module)

Allocate and initialize module parameter blocks.

References dt_iop_module_t::default_params, and dt_iop_module_t::params.

◆ init_global()

void init_global ( dt_iop_module_so_t module)

Initialize global OpenCL resources for drawlayer kernels.

References dt_opencl_create_kernel(), IS_NULL_PTR, and dt_iop_drawlayer_global_data_t::kernel_premult_over.

◆ init_pipe()

◆ module_will_remove()

gboolean module_will_remove ( dt_iop_module_t self)

Hook called before module removal from history stack.

References _commit_dabs, _confirm_delete_layer(), _flush_layer_cache, dt_iop_module_t::dev, FALSE, IS_NULL_PTR, and TRUE.

◆ mouse_leave()

◆ mouse_moved()

◆ name()

const char * name ( )

◆ process()

__DT_CLONE_TARGETS__ int process ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid 
)

CPU processing path for layer-over-input compositing.

References _blend_layer_over_input(), _drawlayer_runtime_collect_inputs, _drawlayer_runtime_perform_action, _get_process_scratch(), darktable, dt_dev_pixelpipe_iop_t::data, dt_iop_module_t::dev, dt_drawlayer_runtime_source_t::direct_copy, DT_DEBUG_PERF, DT_DEBUG_VERBOSE, dt_drawlayer_cache_ensure_scratch_buffer(), DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CPU_AFTER, DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CPU_BEFORE, dt_drawlayer_runtime_manager_bind_piece(), dt_drawlayer_runtime_manager_update(), DT_DRAWLAYER_RUNTIME_RAW_INPUT_NONE, dt_iop_clip_and_zoom(), dt_iop_image_copy_by_size(), dt_print(), drawlayer_preview_background_t::enabled, dt_drawlayer_runtime_update_request_t::event, FALSE, dt_iop_module_t::gui_data, dt_iop_roi_t::height, IS_NULL_PTR, dt_iop_drawlayer_params_t::layer_name, drawlayer_process_scratch_t::layerbuf, drawlayer_process_scratch_t::layerbuf_pixels, dt_iop_drawlayer_gui_data_t::manager, dt_drawlayer_runtime_request_t::manager, ovoid, dt_iop_drawlayer_data_t::params, dt_develop_t::pipe, dt_drawlayer_runtime_source_t::pixels, dt_develop_t::preview_pipe, dt_iop_drawlayer_gui_data_t::process, dt_drawlayer_runtime_release_t::process, dt_drawlayer_runtime_request_t::process_state, dt_drawlayer_runtime_update_request_t::release, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_drawlayer_runtime_context_t::runtime, dt_iop_drawlayer_data_t::runtime_display_pipe, dt_iop_drawlayer_data_t::runtime_manager, dt_iop_drawlayer_data_t::runtime_process, dt_drawlayer_runtime_request_t::self, dt_drawlayer_runtime_source_t::source_roi, dt_drawlayer_runtime_source_t::target_roi, TRUE, darktable_t::unmuted, dt_drawlayer_runtime_host_t::user_data, drawlayer_preview_background_t::value, dt_iop_roi_t::width, and dt_drawlayer_runtime_source_t::width.

Referenced by _blend_layer_over_input_cl(), and _drawlayer_acquire_source_image().

◆ process_cl()

int process_cl ( struct dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
cl_mem  dev_in,
cl_mem  dev_out 
)

OpenCL processing path for layer-over-input compositing.

References _blend_layer_over_input_cl(), _drawlayer_runtime_collect_inputs, _drawlayer_runtime_perform_action, _get_process_scratch(), dt_drawlayer_runtime_source_t::cache_entry, darktable, dt_dev_pixelpipe_iop_t::data, dt_iop_module_t::dev, dt_dev_pixelpipe_t::devid, dt_drawlayer_runtime_source_t::direct_copy, DT_DEBUG_PERF, DT_DEBUG_VERBOSE, dt_dev_pixelpipe_get_realtime(), DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CL_AFTER, DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CL_BEFORE, dt_drawlayer_runtime_manager_bind_piece(), dt_drawlayer_runtime_manager_update(), DT_DRAWLAYER_RUNTIME_RAW_INPUT_NONE, dt_iop_clip_and_zoom_roi_cl(), dt_print(), drawlayer_preview_background_t::enabled, dt_drawlayer_runtime_update_request_t::event, FALSE, dt_iop_module_t::global_data, dt_iop_module_t::gui_data, dt_drawlayer_runtime_source_t::height, IS_NULL_PTR, dt_iop_drawlayer_global_data_t::kernel_premult_over, dt_iop_drawlayer_params_t::layer_name, dt_iop_drawlayer_gui_data_t::manager, dt_drawlayer_runtime_request_t::manager, dt_iop_drawlayer_data_t::params, dt_develop_t::pipe, dt_drawlayer_runtime_source_t::pixels, dt_develop_t::preview_pipe, dt_iop_drawlayer_gui_data_t::process, dt_drawlayer_runtime_release_t::process, dt_drawlayer_runtime_request_t::process_state, dt_drawlayer_runtime_update_request_t::release, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_drawlayer_runtime_context_t::runtime, dt_iop_drawlayer_data_t::runtime_display_pipe, dt_iop_drawlayer_data_t::runtime_manager, dt_iop_drawlayer_data_t::runtime_process, dt_drawlayer_runtime_request_t::self, dt_drawlayer_runtime_source_t::source_roi, dt_drawlayer_runtime_source_t::target_roi, TRUE, darktable_t::unmuted, dt_drawlayer_runtime_host_t::user_data, drawlayer_preview_background_t::value, and dt_drawlayer_runtime_source_t::width.

◆ scrolled()

Variable Documentation

◆ _drawlayer_process_scratch_key

GPrivate _drawlayer_process_scratch_key = G_PRIVATE_INIT(_destroy_process_scratch)
static

Referenced by _get_process_scratch().