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

Public color-picker/history widget API for drawlayer GUI. More...

#include "iop/drawlayer/brush.h"
#include <gtk/gtk.h>
+ Include dependency graph for widgets.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DT_DRAWLAYER_COLOR_PICKER_HEIGHT   184
 
#define DT_DRAWLAYER_COLOR_HISTORY_COUNT   10
 
#define DT_DRAWLAYER_COLOR_HISTORY_COLS   5
 
#define DT_DRAWLAYER_COLOR_HISTORY_ROWS   2
 
#define DT_DRAWLAYER_COLOR_HISTORY_HEIGHT   44
 

Typedefs

typedef struct dt_drawlayer_widgets_t dt_drawlayer_widgets_t
 Opaque widget runtime state.
 

Functions

dt_drawlayer_widgets_tdt_drawlayer_widgets_init (void)
 Allocate and initialize widget runtime state.
 
void dt_drawlayer_widgets_cleanup (dt_drawlayer_widgets_t **widgets)
 Destroy widget runtime state and owned surfaces.
 
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.
 
gboolean dt_drawlayer_widgets_get_display_color (const dt_drawlayer_widgets_t *widgets, float display_rgb[3])
 Get current display RGB color.
 
void dt_drawlayer_widgets_mark_picker_dirty (dt_drawlayer_widgets_t *widgets)
 Mark picker backing surface dirty for redraw/rebuild.
 
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.
 
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_push_color_history (dt_drawlayer_widgets_t *widgets, const float display_rgb[3])
 Push one color in history if it differs from current head.
 
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.
 
gboolean dt_drawlayer_widgets_finish_picker_drag (dt_drawlayer_widgets_t *widgets, float display_rgb[3])
 End picker drag and return final selected color.
 
gboolean dt_drawlayer_widgets_is_picker_dragging (const dt_drawlayer_widgets_t *widgets)
 Query whether picker drag is currently active.
 
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.
 
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).
 
gboolean dt_drawlayer_widgets_draw_swatch (const dt_drawlayer_widgets_t *widgets, GtkWidget *widget, cairo_t *cr)
 Draw compact current-color swatch widget.
 
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.
 
int dt_drawlayer_widgets_get_brush_profile_selection (const dt_drawlayer_widgets_t *widgets)
 Read currently selected brush profile.
 
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.
 
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.
 

Detailed Description

Public color-picker/history widget API for drawlayer GUI.

Macro Definition Documentation

◆ DT_DRAWLAYER_COLOR_HISTORY_COLS

#define DT_DRAWLAYER_COLOR_HISTORY_COLS   5

◆ DT_DRAWLAYER_COLOR_HISTORY_COUNT

#define DT_DRAWLAYER_COLOR_HISTORY_COUNT   10

◆ DT_DRAWLAYER_COLOR_HISTORY_HEIGHT

#define DT_DRAWLAYER_COLOR_HISTORY_HEIGHT   44

◆ DT_DRAWLAYER_COLOR_HISTORY_ROWS

#define DT_DRAWLAYER_COLOR_HISTORY_ROWS   2

◆ DT_DRAWLAYER_COLOR_PICKER_HEIGHT

#define DT_DRAWLAYER_COLOR_PICKER_HEIGHT   184

Typedef Documentation

◆ dt_drawlayer_widgets_t

Opaque widget runtime state.

Function Documentation

◆ dt_drawlayer_widgets_cleanup()

void dt_drawlayer_widgets_cleanup ( dt_drawlayer_widgets_t **  widgets)

Destroy widget runtime state and owned surfaces.

Destroy widget runtime state and owned surfaces.

References _clear_color_picker_surface(), _clear_profile_surface(), and dt_free.

Referenced by gui_cleanup().

◆ dt_drawlayer_widgets_draw_brush_profiles()

◆ dt_drawlayer_widgets_draw_picker()

◆ dt_drawlayer_widgets_draw_swatch()

gboolean dt_drawlayer_widgets_draw_swatch ( const dt_drawlayer_widgets_t widgets,
GtkWidget widget,
cairo_t *  cr 
)

◆ dt_drawlayer_widgets_finish_picker_drag()

gboolean dt_drawlayer_widgets_finish_picker_drag ( dt_drawlayer_widgets_t widgets,
float  display_rgb[3] 
)

◆ dt_drawlayer_widgets_get_brush_profile_selection()

int dt_drawlayer_widgets_get_brush_profile_selection ( const dt_drawlayer_widgets_t widgets)

Read currently selected brush profile.

References DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, and dt_drawlayer_widgets_t::profile_selected_shape.

Referenced by _sync_params_from_gui().

◆ dt_drawlayer_widgets_get_color_history()

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.

◆ dt_drawlayer_widgets_get_display_color()

gboolean dt_drawlayer_widgets_get_display_color ( const dt_drawlayer_widgets_t widgets,
float  display_rgb[3] 
)

◆ dt_drawlayer_widgets_init()

◆ dt_drawlayer_widgets_is_picker_dragging()

gboolean dt_drawlayer_widgets_is_picker_dragging ( const dt_drawlayer_widgets_t widgets)

Query whether picker drag is currently active.

Query whether picker drag is currently active.

References DT_DRAWLAYER_COLOR_DRAG_NONE, and dt_drawlayer_widgets_t::picker_drag_mode.

Referenced by _color_picker_motion().

◆ dt_drawlayer_widgets_mark_picker_dirty()

void dt_drawlayer_widgets_mark_picker_dirty ( dt_drawlayer_widgets_t widgets)

Mark picker backing surface dirty for redraw/rebuild.

Mark picker backing surface dirty for redraw/rebuild.

References dt_drawlayer_widgets_t::color_surface_dirty, and TRUE.

◆ dt_drawlayer_widgets_pick_brush_profile()

gboolean dt_drawlayer_widgets_pick_brush_profile ( dt_drawlayer_widgets_t widgets,
GtkWidget widget,
float  x,
float  y,
int *  shape 
)

◆ dt_drawlayer_widgets_pick_history_color()

gboolean dt_drawlayer_widgets_pick_history_color ( const dt_drawlayer_widgets_t widgets,
GtkWidget widget,
float  x,
float  y,
float  display_rgb[3] 
)

◆ dt_drawlayer_widgets_push_color_history()

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.

Push one color in history if it differs from current head.

References _clamp01(), _display_rgb_equal(), dt_drawlayer_widgets_t::color_history, dt_drawlayer_widgets_t::color_history_valid, DT_DRAWLAYER_COLOR_HISTORY_COUNT, FALSE, i, and TRUE.

Referenced by _remember_display_color().

◆ dt_drawlayer_widgets_set_brush_profile_preview()

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 
)

◆ dt_drawlayer_widgets_set_color_history()

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.

◆ dt_drawlayer_widgets_set_display_color()

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.

Set current display RGB color and refresh picker state.

References _sync_picker_from_display_rgb(), dt_drawlayer_widgets_t::color_surface_dirty, and TRUE.

Referenced by _apply_display_brush_color(), and _sync_color_picker_from_conf().

◆ dt_drawlayer_widgets_update_from_picker_position()