Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
widgets.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#pragma once
20
21#include "iop/drawlayer/brush.h"
22
23#include <gtk/gtk.h>
24
29#define DT_DRAWLAYER_COLOR_PICKER_HEIGHT 184
30#define DT_DRAWLAYER_COLOR_HISTORY_COUNT 10
31#define DT_DRAWLAYER_COLOR_HISTORY_COLS 5
32#define DT_DRAWLAYER_COLOR_HISTORY_ROWS 2
33#define DT_DRAWLAYER_COLOR_HISTORY_HEIGHT 44
34
37
42
44void dt_drawlayer_widgets_set_display_color(dt_drawlayer_widgets_t *widgets, const float display_rgb[3]);
46gboolean dt_drawlayer_widgets_get_display_color(const dt_drawlayer_widgets_t *widgets, float display_rgb[3]);
47
50
53 const float history[DT_DRAWLAYER_COLOR_HISTORY_COUNT][3],
54 const gboolean valid[DT_DRAWLAYER_COLOR_HISTORY_COUNT]);
57 float history[DT_DRAWLAYER_COLOR_HISTORY_COUNT][3],
58 gboolean valid[DT_DRAWLAYER_COLOR_HISTORY_COUNT]);
60gboolean dt_drawlayer_widgets_push_color_history(dt_drawlayer_widgets_t *widgets, const float display_rgb[3]);
61
64 float x, float y, float display_rgb[3]);
66gboolean dt_drawlayer_widgets_finish_picker_drag(dt_drawlayer_widgets_t *widgets, float display_rgb[3]);
69
72 float x, float y, float display_rgb[3]);
73
75gboolean dt_drawlayer_widgets_draw_picker(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr,
76 double pixels_per_dip);
78gboolean dt_drawlayer_widgets_draw_swatch(const dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr);
79
82 float opacity,
83 float hardness,
84 float sprinkles,
85 float sprinkle_size,
86 float sprinkle_coarseness,
87 int selected_shape);
92 cairo_t *cr, double pixels_per_dip);
95 float x, float y, int *shape);
Dab-level brush rasterization API for drawlayer.
static const float x
Definition iop_profile.h:239
struct _GtkWidget GtkWidget
Definition splash.h:29
Runtime state for drawlayer custom color widgets.
Definition widgets.c:51
void dt_drawlayer_widgets_get_color_history(const dt_drawlayer_widgets_t *widgets, float history[10][3], gboolean valid[10])
Read full color-history stack and validity flags.
gboolean dt_drawlayer_widgets_finish_picker_drag(dt_drawlayer_widgets_t *widgets, float display_rgb[3])
End picker drag and return final selected color.
Definition widgets.c:502
gboolean dt_drawlayer_widgets_pick_history_color(const dt_drawlayer_widgets_t *widgets, GtkWidget *widget, float x, float y, float display_rgb[3])
Hit-test and pick color from history swatches.
Definition widgets.c:517
gboolean dt_drawlayer_widgets_update_from_picker_position(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, float x, float y, float display_rgb[3])
Update picker selection from widget coordinates during drag.
Definition widgets.c:443
gboolean dt_drawlayer_widgets_push_color_history(dt_drawlayer_widgets_t *widgets, const float display_rgb[3])
Push one color in history if it differs from current head.
Definition widgets.c:421
dt_drawlayer_widgets_t * dt_drawlayer_widgets_init(void)
Allocate and initialize widget runtime state.
Definition widgets.c:345
void dt_drawlayer_widgets_set_color_history(dt_drawlayer_widgets_t *widgets, const float history[10][3], const gboolean valid[10])
Replace full color-history stack and validity flags.
gboolean dt_drawlayer_widgets_get_display_color(const dt_drawlayer_widgets_t *widgets, float display_rgb[3])
Get current display RGB color.
Definition widgets.c:377
gboolean dt_drawlayer_widgets_is_picker_dragging(const dt_drawlayer_widgets_t *widgets)
Query whether picker drag is currently active.
Definition widgets.c:511
int dt_drawlayer_widgets_get_brush_profile_selection(const dt_drawlayer_widgets_t *widgets)
Read currently selected brush profile.
Definition widgets.c:730
void dt_drawlayer_widgets_set_brush_profile_preview(dt_drawlayer_widgets_t *widgets, float opacity, float hardness, float sprinkles, float sprinkle_size, float sprinkle_coarseness, int selected_shape)
Update cached brush-profile preview parameters and selected profile.
Definition widgets.c:697
#define DT_DRAWLAYER_COLOR_HISTORY_COUNT
Definition widgets.h:30
void dt_drawlayer_widgets_cleanup(dt_drawlayer_widgets_t **widgets)
Destroy widget runtime state and owned surfaces.
Definition widgets.c:360
void dt_drawlayer_widgets_set_display_color(dt_drawlayer_widgets_t *widgets, const float display_rgb[3])
Set current display RGB color and refresh picker state.
Definition widgets.c:369
gboolean dt_drawlayer_widgets_draw_picker(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr, double pixels_per_dip)
Draw full picker UI (map, marker, history swatches).
Definition widgets.c:540
gboolean dt_drawlayer_widgets_draw_swatch(const dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr)
Draw compact current-color swatch widget.
Definition widgets.c:663
gboolean dt_drawlayer_widgets_draw_brush_profiles(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr, double pixels_per_dip)
Draw selectable row of brush-profile previews.
Definition widgets.c:735
void dt_drawlayer_widgets_mark_picker_dirty(dt_drawlayer_widgets_t *widgets)
Mark picker backing surface dirty for redraw/rebuild.
Definition widgets.c:384
gboolean dt_drawlayer_widgets_pick_brush_profile(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, float x, float y, int *shape)
Hit-test and select one brush profile from the preview row.
Definition widgets.c:840