Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
brush.h
Go to the documentation of this file.
1/*
2 This file is part of the Ansel project.
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef DT_IOP_DRAWLAYER_BRUSH_H
20#define DT_IOP_DRAWLAYER_BRUSH_H
21
22#include <glib.h>
23#include <stdint.h>
24
25#define OUTER_LOOP 1
26
29
46
55
58
66{
67 float x;
68 float y;
69 float radius;
70 float dir_x;
71 float dir_y;
74 float opacity;
75 float flow;
76 float sprinkles;
79 float hardness;
80 float color[4];
81 float display_color[3];
82 int shape;
83 int mode;
84 uint32_t stroke_batch;
85 uint8_t stroke_pos;
87
89
107 dt_drawlayer_cache_patch_t *patch, float scale,
108 const dt_drawlayer_brush_dab_t *dab,
109 float sample_opacity_scale,
110 dt_drawlayer_cache_patch_t *stroke_mask,
111 struct dt_drawlayer_paint_stroke_t *stroke);
112
128
140gboolean dt_drawlayer_brush_batch_is_uniform(const dt_drawlayer_brush_dab_t *dabs, guint count,
142
164 dt_drawlayer_cache_patch_t *patch, float scale,
165 dt_drawlayer_cache_patch_t *stroke_mask,
166 float *transmittance,
167 float *noise_scratch,
168 dt_drawlayer_damaged_rect_t *batch_damage);
169
187 int width, int height, int stride,
188 float center_x, float center_y,
189 float opacity_multiplier);
190
205 int width, int height,
206 float center_x, float center_y,
207 float opacity_multiplier,
208 const float background_rgb[3]);
209#endif // DT_IOP_DRAWLAYER_BRUSH_H
gboolean dt_drawlayer_brush_rasterize_dab_rgbaf(const dt_drawlayer_brush_dab_t *dab, float *rgba, int width, int height, float center_x, float center_y, float opacity_multiplier, const float background_rgb[3])
Rasterize a single dab preview in linear float RGBA over an opaque background.
dt_drawlayer_brush_mode_t dt_iop_drawlayer_brush_mode_t
Definition brush.h:57
gboolean dt_drawlayer_brush_batch_is_uniform(const dt_drawlayer_brush_dab_t *dabs, guint count, dt_drawlayer_brush_batch_t *out)
Decide whether a run of dabs can take the batch path, and describe it if so.
dt_drawlayer_brush_mode_t
Pixel blending behavior used while stamping a dab.
Definition brush.h:49
@ DT_DRAWLAYER_BRUSH_MODE_ERASE
Definition brush.h:51
@ DT_DRAWLAYER_BRUSH_MODE_PAINT
Definition brush.h:50
@ DT_DRAWLAYER_BRUSH_MODE_BLUR
Definition brush.h:52
@ DT_DRAWLAYER_BRUSH_MODE_SMUDGE
Definition brush.h:53
gboolean dt_drawlayer_brush_rasterize_batch(const dt_drawlayer_brush_batch_t *batch, dt_drawlayer_cache_patch_t *patch, float scale, dt_drawlayer_cache_patch_t *stroke_mask, float *transmittance, float *noise_scratch, dt_drawlayer_damaged_rect_t *batch_damage)
Rasterize a whole batch in two passes: accumulate transmittance, then composite once.
dt_drawlayer_brush_shape_t dt_iop_drawlayer_brush_shape_t
Definition brush.h:56
dt_drawlayer_brush_shape_t
Supported analytic fall-off profiles for brush alpha.
Definition brush.h:40
@ DT_DRAWLAYER_BRUSH_SHAPE_SIGMOIDAL
Definition brush.h:44
@ DT_DRAWLAYER_BRUSH_SHAPE_GAUSSIAN
Definition brush.h:42
@ DT_DRAWLAYER_BRUSH_SHAPE_LINEAR
Definition brush.h:41
@ DT_DRAWLAYER_BRUSH_SHAPE_QUADRATIC
Definition brush.h:43
gboolean dt_drawlayer_brush_rasterize(const dt_drawlayer_cache_patch_t *sample_patch, dt_drawlayer_cache_patch_t *patch, float scale, const dt_drawlayer_brush_dab_t *dab, float sample_opacity_scale, dt_drawlayer_cache_patch_t *stroke_mask, struct dt_drawlayer_paint_stroke_t *stroke)
Rasterize one dab into a float RGBA buffer.
gboolean dt_drawlayer_brush_rasterize_dab_argb8(const dt_drawlayer_brush_dab_t *dab, uint8_t *argb, int width, int height, int stride, float center_x, float center_y, float opacity_multiplier)
Rasterize a single dab preview into ARGB8 for GUI overlays.
const dt_colormatrix_t dt_aligned_pixel_t out
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
A run of dabs that share everything the batch composite needs to be a single step.
Definition brush.h:120
const dt_drawlayer_brush_dab_t * dabs
Definition brush.h:121
Fully resolved input dab descriptor.
Definition brush.h:66
float display_color[3]
Definition brush.h:81
uint32_t stroke_batch
Definition brush.h:84
Generic float RGBA patch stored either in malloc memory or pixel cache.
Integer axis-aligned rectangle in buffer coordinates.
Mutable stroke runtime state owned by worker/backend code.