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#ifndef DT_IOP_DRAWLAYER_WIDGETS_H
20#define DT_IOP_DRAWLAYER_WIDGETS_H
21
22#include <gtk/gtk.h>
23
28#define DT_DRAWLAYER_COLOR_PICKER_HEIGHT 184
29#define DT_DRAWLAYER_COLOR_HISTORY_COUNT 10
30#define DT_DRAWLAYER_COLOR_HISTORY_COLS 5
31#define DT_DRAWLAYER_COLOR_HISTORY_ROWS 2
32#define DT_DRAWLAYER_COLOR_HISTORY_HEIGHT 44
33
36
41
43void dt_drawlayer_widgets_set_display_color(dt_drawlayer_widgets_t *widgets, const float display_rgb[3]);
45gboolean dt_drawlayer_widgets_get_display_color(const dt_drawlayer_widgets_t *widgets, float display_rgb[3]);
46
49 const float history[DT_DRAWLAYER_COLOR_HISTORY_COUNT][3],
50 const gboolean valid[DT_DRAWLAYER_COLOR_HISTORY_COUNT]);
53 float history[DT_DRAWLAYER_COLOR_HISTORY_COUNT][3],
54 gboolean valid[DT_DRAWLAYER_COLOR_HISTORY_COUNT]);
56gboolean dt_drawlayer_widgets_push_color_history(dt_drawlayer_widgets_t *widgets, const float display_rgb[3]);
57
60 float x, float y, float display_rgb[3]);
62gboolean dt_drawlayer_widgets_finish_picker_drag(dt_drawlayer_widgets_t *widgets, float display_rgb[3]);
65
68 float x, float y, float display_rgb[3]);
69
71gboolean dt_drawlayer_widgets_draw_picker(dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr,
72 double pixels_per_dip);
74gboolean dt_drawlayer_widgets_draw_swatch(const dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr);
75
78 float opacity,
79 float hardness,
80 float sprinkles,
81 float sprinkle_size,
82 float sprinkle_coarseness,
83 int selected_shape);
88 cairo_t *cr, double pixels_per_dip);
91 float x, float y, int *shape);
92#endif // DT_IOP_DRAWLAYER_WIDGETS_H
static const float x
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
Runtime state for drawlayer custom color widgets.
Definition widgets.c:53
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:495
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:510
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:436
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:414
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:504
int dt_drawlayer_widgets_get_brush_profile_selection(const dt_drawlayer_widgets_t *widgets)
Read currently selected brush profile.
Definition widgets.c:723
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:690
#define DT_DRAWLAYER_COLOR_HISTORY_COUNT
Definition widgets.h:29
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:533
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:656
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:728
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:833