![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Stroke-level path sampling and runtime-state API for drawlayer. More...
Include dependency graph for iop/drawlayer/paint.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | dt_drawlayer_paint_raw_input_t |
| One raw pointer event queued to stroke processing. More... | |
| struct | dt_drawlayer_damaged_rect_t |
| Integer axis-aligned rectangle in buffer coordinates. More... | |
| struct | dt_drawlayer_paint_stroke_t |
| Mutable stroke runtime state owned by worker/backend code. More... | |
| struct | dt_drawlayer_paint_callbacks_t |
| Callback bundle used by stroke processing entry points. More... | |
Typedefs | |
| typedef enum dt_drawlayer_paint_stroke_pos_t | dt_drawlayer_paint_stroke_pos_t |
| Position of a raw input event inside a stroke lifecycle. | |
| typedef struct dt_drawlayer_paint_raw_input_t | dt_drawlayer_paint_raw_input_t |
| One raw pointer event queued to stroke processing. | |
| typedef struct dt_drawlayer_damaged_rect_t | dt_drawlayer_damaged_rect_t |
| Integer axis-aligned rectangle in buffer coordinates. | |
| typedef struct dt_drawlayer_paint_stroke_t | dt_drawlayer_paint_stroke_t |
| Mutable stroke runtime state owned by worker/backend code. | |
| typedef gboolean(* | dt_drawlayer_paint_build_dab_cb) (void *user_data, dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input, dt_drawlayer_brush_dab_t *out_dab) |
| Build a resolved dab from one raw input event. | |
| typedef gboolean(* | dt_drawlayer_paint_layer_to_widget_cb) (void *user_data, float lx, float ly, float *wx, float *wy) |
| Convert layer-space coordinates back to widget-space (for HUD/preview alignment). | |
| typedef void(* | dt_drawlayer_paint_stroke_seed_cb) (void *user_data, uint64_t stroke_seed) |
| Notify caller when a new stroke seed is started. | |
| typedef struct dt_drawlayer_paint_callbacks_t | dt_drawlayer_paint_callbacks_t |
| Callback bundle used by stroke processing entry points. | |
Enumerations | |
| enum | dt_drawlayer_paint_stroke_pos_t { DT_DRAWLAYER_PAINT_STROKE_FIRST = 0 , DT_DRAWLAYER_PAINT_STROKE_MIDDLE = 1 , DT_DRAWLAYER_PAINT_STROKE_END = 2 } |
| Position of a raw input event inside a stroke lifecycle. More... | |
Stroke-level path sampling and runtime-state API for drawlayer.
This layer consumes raw pointer input events and emits evenly spaced, optionally smoothed dabs. Rasterization is delegated to brush.h.
| typedef struct dt_drawlayer_damaged_rect_t dt_drawlayer_damaged_rect_t |
Integer axis-aligned rectangle in buffer coordinates.
Convention: nw is inclusive, se is exclusive.
| typedef gboolean(* dt_drawlayer_paint_build_dab_cb) (void *user_data, dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input, dt_drawlayer_brush_dab_t *out_dab) |
Build a resolved dab from one raw input event.
| user_data | Opaque caller context. |
| state | Mutable stroke runtime state. |
| input | Raw input event. |
| out_dab | Output resolved dab. |
| typedef struct dt_drawlayer_paint_callbacks_t dt_drawlayer_paint_callbacks_t |
Callback bundle used by stroke processing entry points.
| typedef gboolean(* dt_drawlayer_paint_layer_to_widget_cb) (void *user_data, float lx, float ly, float *wx, float *wy) |
Convert layer-space coordinates back to widget-space (for HUD/preview alignment).
| typedef struct dt_drawlayer_paint_raw_input_t dt_drawlayer_paint_raw_input_t |
One raw pointer event queued to stroke processing.
All brush/user settings are snapshotted per event so asynchronous processing does not depend on mutable GUI state.
Position of a raw input event inside a stroke lifecycle.
Notify caller when a new stroke seed is started.
| typedef struct dt_drawlayer_paint_stroke_t dt_drawlayer_paint_stroke_t |
Mutable stroke runtime state owned by worker/backend code.
The same object carries path generation state and raster-time transient data. It is reset at stroke boundaries by the worker lifecycle.
| void dt_drawlayer_paint_finalize_path | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Force emission of a pending initial dab when a stroke had no emitted samples yet.
Force emission of a pending initial dab when a stroke had no emitted samples yet.
References _clamp01(), _emit_dab(), _ensure_pending_dabs(), _freeze_emitted_dab_raster_state(), _paint_dab_sample_spacing(), DT_DRAWLAYER_PAINT_STROKE_FIRST, IS_NULL_PTR, state, and dt_drawlayer_brush_dab_t::stroke_pos.
Referenced by _backend_worker_process_stroke_end(), and _flush_pending_initial_if_needed().
| void dt_drawlayer_paint_interpolate_path | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_paint_callbacks_t * | callbacks, | ||
| void * | user_data | ||
| ) |
Drain queued raw input events and append evenly spaced dabs to state->pending_dabs.
References _paint_compact_raw_input_queue(), _paint_process_one_raw_input(), IS_NULL_PTR, and state.
Referenced by _process_backend_input().
| gboolean dt_drawlayer_paint_merge_runtime_stroke_damage | ( | dt_drawlayer_damaged_rect_t * | path_state, |
| dt_drawlayer_damaged_rect_t * | target_rect | ||
| ) |
Merge path-state damage into target rectangle and clear path-state accumulator.
References _paint_union_damage_rect(), dt_drawlayer_paint_runtime_get_stroke_damage(), dt_drawlayer_paint_runtime_state_reset(), FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_drawlayer_worker_publish_backend_stroke_damage().
| void dt_drawlayer_paint_path_state_reset | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Reset stroke path state and pending raw queue for a new stroke.
Reset stroke path state and pending raw queue for a new stroke.
References _paint_reset_path_runtime_state(), IS_NULL_PTR, and state.
Referenced by _stroke_begin(), and _stroke_clear().
| gboolean dt_drawlayer_paint_queue_raw_input | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_paint_raw_input_t * | input | ||
| ) |
Queue one raw input event (FIFO).
References _ensure_raw_inputs(), FALSE, IS_NULL_PTR, state, and TRUE.
Referenced by _process_backend_input().
| gboolean dt_drawlayer_paint_rasterize_segment_to_buffer | ( | const dt_drawlayer_brush_dab_t * | dab, |
| float | distance_percent, | ||
| const dt_drawlayer_cache_patch_t * | sample_patch, | ||
| dt_drawlayer_cache_patch_t * | patch, | ||
| float | scale, | ||
| dt_drawlayer_cache_patch_t * | stroke_mask, | ||
| dt_drawlayer_damaged_rect_t * | runtime_state, | ||
| dt_drawlayer_paint_stroke_t * | runtime_private | ||
| ) |
Replay one emitted dab segment into a float buffer through brush API.
| dab | Input dab sample from path stream. |
| distance_percent | Sampling distance parameter in [0,1]. |
| sample_patch | Optional read-only source patch used by blur/smudge sampling. When NULL, sampling falls back to patch. |
| patch | Destination float RGBA patch. |
| scale | Layer-to-buffer scale factor. |
| stroke_mask | Optional stroke-local alpha mask patch. |
| runtime_state | Accumulated stroke damage output. |
| runtime_private | Mutable stroke runtime payload. |
References _advance_smudge_pickup_state(), _clamp01(), _paint_dab_sample_spacing(), _paint_stroke_sample_opacity_scale(), dt_drawlayer_paint_stroke_t::bounds, dt_drawlayer_paint_stroke_t::dab_window, darktable, DT_DEBUG_PERF, DT_DEBUG_VERBOSE, DT_DRAWLAYER_BRUSH_MODE_SMUDGE, dt_drawlayer_brush_rasterize(), dt_drawlayer_paint_runtime_note_dab_damage(), dt_drawlayer_paint_runtime_set_smudge_pickup(), DT_DRAWLAYER_PAINT_STROKE_FIRST, dt_get_wtime(), dt_print(), FALSE, IS_NULL_PTR, MIN, dt_drawlayer_brush_dab_t::mode, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_brush_dab_t::sample_opacity_scale, dt_drawlayer_brush_dab_t::sample_spacing, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_brush_dab_t::stroke_pos, TRUE, darktable_t::unmuted, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _process_backend_dab().
| gboolean dt_drawlayer_paint_runtime_ensure_smudge_pixels | ( | dt_drawlayer_paint_stroke_t * | state, |
| int | width, | ||
| int | height | ||
| ) |
Ensure smudge carry buffer allocation for given footprint dimensions.
References FALSE, height, IS_NULL_PTR, state, TRUE, and width.
Referenced by dt_drawlayer_brush_rasterize().
| void dt_drawlayer_paint_runtime_get_smudge_pickup | ( | const dt_drawlayer_paint_stroke_t * | state, |
| float * | x, | ||
| float * | y | ||
| ) |
Read smudge pickup coordinates.
References IS_NULL_PTR, state, and x.
Referenced by _advance_smudge_pickup_state(), and _apply_smudge_stroke_mode().
| gboolean dt_drawlayer_paint_runtime_get_stroke_damage | ( | const dt_drawlayer_damaged_rect_t * | state, |
| dt_drawlayer_damaged_rect_t * | out_rect | ||
| ) |
Read accumulated stroke damage rectangle.
References FALSE, IS_NULL_PTR, state, and TRUE.
Referenced by dt_drawlayer_paint_merge_runtime_stroke_damage().
| uint64_t dt_drawlayer_paint_runtime_get_stroke_seed | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Get current deterministic stroke seed.
References state.
| gboolean dt_drawlayer_paint_runtime_have_smudge_pickup | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Query whether smudge pickup coordinates are initialized.
References state.
Referenced by _advance_smudge_pickup_state(), and _apply_smudge_stroke_mode().
| void dt_drawlayer_paint_runtime_note_dab_damage | ( | dt_drawlayer_damaged_rect_t * | state, |
| const dt_drawlayer_damaged_rect_t * | dab_rect | ||
| ) |
Merge one dab rectangle into an accumulator rectangle.
References IS_NULL_PTR, MAX, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, state, TRUE, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _collect_batch_bounds(), _process_backend_dab(), _rasterize_pending_dab_batch(), dt_drawlayer_paint_rasterize_segment_to_buffer(), and dt_drawlayer_worker_publish_backend_stroke_damage().
| gboolean dt_drawlayer_paint_runtime_prepare_dab_context | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_brush_dab_t * | dab, | ||
| int | width, | ||
| int | height, | ||
| int | origin_x, | ||
| int | origin_y, | ||
| float | scale | ||
| ) |
Compute current dab footprint bounds in target buffer coordinates.
References FALSE, height, IS_NULL_PTR, MAX, MIN, dt_drawlayer_brush_dab_t::opacity, dt_drawlayer_brush_dab_t::radius, state, TRUE, width, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by dt_drawlayer_brush_rasterize().
| dt_drawlayer_paint_stroke_t * dt_drawlayer_paint_runtime_private_create | ( | void | ) |
Allocate stroke runtime payload object used by paint+brush internals.
References dt_drawlayer_paint_runtime_private_reset(), IS_NULL_PTR, and state.
Referenced by _stroke_create().
| void dt_drawlayer_paint_runtime_private_destroy | ( | dt_drawlayer_paint_stroke_t ** | state | ) |
Destroy stroke runtime payload and null pointer.
References dt_free, IS_NULL_PTR, state, and TRUE.
Referenced by _stroke_create(), and _stroke_destroy().
| void dt_drawlayer_paint_runtime_private_reset | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Reset transient stroke runtime payload between strokes.
References FALSE, IS_NULL_PTR, and state.
Referenced by _stroke_begin(), _stroke_clear(), and dt_drawlayer_paint_runtime_private_create().
| void dt_drawlayer_paint_runtime_set_smudge_pickup | ( | dt_drawlayer_paint_stroke_t * | state, |
| float | x, | ||
| float | y, | ||
| gboolean | have_pickup | ||
| ) |
Write smudge pickup coordinates and validity flag.
References IS_NULL_PTR, state, and x.
Referenced by _advance_smudge_pickup_state(), and dt_drawlayer_paint_rasterize_segment_to_buffer().
| void dt_drawlayer_paint_runtime_set_stroke_seed | ( | dt_drawlayer_paint_stroke_t * | state, |
| uint64_t | seed | ||
| ) |
Set deterministic stroke seed for noise-derived effects.
References IS_NULL_PTR, and state.
Referenced by _paint_stroke_seed_cb().
| int dt_drawlayer_paint_runtime_smudge_height | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Get smudge carry buffer height.
References state.
| float * dt_drawlayer_paint_runtime_smudge_pixels | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Get smudge carry buffer pointer (RGBA float).
References state.
Referenced by _apply_smudge_stroke_mode().
| int dt_drawlayer_paint_runtime_smudge_width | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
| dt_drawlayer_damaged_rect_t * dt_drawlayer_paint_runtime_state_create | ( | void | ) |
Allocate zero-initialized stroke-damage accumulator state.
References dt_drawlayer_paint_runtime_state_reset(), IS_NULL_PTR, and state.
Referenced by _rt_init_state().
| void dt_drawlayer_paint_runtime_state_destroy | ( | dt_drawlayer_damaged_rect_t ** | state | ) |
Destroy stroke-damage accumulator state and null pointer.
References dt_free, IS_NULL_PTR, and state.
Referenced by _rt_destroy_state().
| void dt_drawlayer_paint_runtime_state_reset | ( | dt_drawlayer_damaged_rect_t * | state | ) |
Reset stroke-damage accumulator to empty/invalid.
References FALSE, IS_NULL_PTR, and state.
Referenced by _delete_current_layer(), _drawlayer_acquire_source_image(), _publish_backend_progress(), _reset_backend_path(), _reset_live_publish(), dt_drawlayer_cache_flush_process_patch_to_base(), dt_drawlayer_cache_invalidate_process_patch_state(), dt_drawlayer_cache_populate_process_patch_from_base(), dt_drawlayer_ensure_layer_cache(), dt_drawlayer_flush_layer_cache(), dt_drawlayer_paint_merge_runtime_stroke_damage(), dt_drawlayer_paint_runtime_state_create(), and dt_drawlayer_runtime_manager_update().