![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Public color-picker/history widget API for drawlayer GUI. More...
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_t * | dt_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. | |
Public color-picker/history widget API for drawlayer GUI.
| #define DT_DRAWLAYER_COLOR_HISTORY_COLS 5 |
| #define DT_DRAWLAYER_COLOR_HISTORY_COUNT 10 |
| #define DT_DRAWLAYER_COLOR_HISTORY_HEIGHT 44 |
| #define DT_DRAWLAYER_COLOR_HISTORY_ROWS 2 |
| #define DT_DRAWLAYER_COLOR_PICKER_HEIGHT 184 |
| typedef struct dt_drawlayer_widgets_t dt_drawlayer_widgets_t |
Opaque widget runtime state.
| 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().
| 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.
References _brush_profile_cell_rect(), _brush_profile_geometry(), _clear_profile_surface(), _render_brush_profile_cell(), dt_free, FALSE, height, i, MAX, MIN, dt_drawlayer_widgets_t::profile_selected_shape, dt_drawlayer_widgets_t::profile_surface, dt_drawlayer_widgets_t::profile_surface_dirty, dt_drawlayer_widgets_t::profile_surface_height, dt_drawlayer_widgets_t::profile_surface_ppd, dt_drawlayer_widgets_t::profile_surface_width, TRUE, and width.
Referenced by _brush_profile_draw().
| 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).
Draw full picker UI (map, marker, history swatches).
References _clamp01(), _clear_color_picker_surface(), _color_picker_geometry(), _picker_project_opponent_to_display_rgb(), dt_drawlayer_widgets_t::color_surface, dt_drawlayer_widgets_t::color_surface_dirty, dt_drawlayer_widgets_t::color_surface_height, dt_drawlayer_widgets_t::color_surface_ppd, dt_drawlayer_widgets_t::color_surface_width, DT_DRAWLAYER_PICKER_C_MAX, DT_DRAWLAYER_PICKER_U_MAX, DT_DRAWLAYER_PICKER_V_MAX, FALSE, fx, height, m, MAX, dt_drawlayer_widgets_t::picker_chroma, dt_drawlayer_widgets_t::picker_hue, dt_drawlayer_widgets_t::picker_m, dt_drawlayer_widgets_t::picker_u, dt_drawlayer_widgets_t::picker_v, rgb, TRUE, v, and width.
Referenced by _color_picker_draw().
| gboolean dt_drawlayer_widgets_draw_swatch | ( | const dt_drawlayer_widgets_t * | widgets, |
| GtkWidget * | widget, | ||
| cairo_t * | cr | ||
| ) |
Draw compact current-color swatch widget.
Draw compact current-color swatch widget.
References dt_drawlayer_widgets_t::color_history, dt_drawlayer_widgets_t::color_history_valid, DT_DRAWLAYER_COLOR_HISTORY_COLS, DT_DRAWLAYER_COLOR_HISTORY_COUNT, DT_DRAWLAYER_COLOR_HISTORY_ROWS, DT_PIXEL_APPLY_DPI, FALSE, height, i, MAX, row, width, and x.
Referenced by _color_swatch_draw().
| gboolean dt_drawlayer_widgets_finish_picker_drag | ( | dt_drawlayer_widgets_t * | widgets, |
| float | display_rgb[3] | ||
| ) |
End picker drag and return final selected color.
End picker drag and return final selected color.
References _picker_project_opponent_to_display_rgb(), DT_DRAWLAYER_COLOR_DRAG_NONE, FALSE, dt_drawlayer_widgets_t::picker_drag_mode, dt_drawlayer_widgets_t::picker_m, dt_drawlayer_widgets_t::picker_u, and dt_drawlayer_widgets_t::picker_v.
Referenced by _color_picker_button_release().
| 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().
| 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_get_display_color | ( | const dt_drawlayer_widgets_t * | widgets, |
| float | display_rgb[3] | ||
| ) |
Get current display RGB color.
Get current display RGB color.
References _picker_project_opponent_to_display_rgb(), FALSE, dt_drawlayer_widgets_t::picker_m, dt_drawlayer_widgets_t::picker_u, and dt_drawlayer_widgets_t::picker_v.
| dt_drawlayer_widgets_t * dt_drawlayer_widgets_init | ( | void | ) |
Allocate and initialize widget runtime state.
References dt_drawlayer_widgets_t::color_surface_dirty, DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, DT_DRAWLAYER_COLOR_DRAG_NONE, dt_drawlayer_widgets_t::picker_drag_mode, dt_drawlayer_widgets_t::profile_hardness, dt_drawlayer_widgets_t::profile_opacity, dt_drawlayer_widgets_t::profile_selected_shape, dt_drawlayer_widgets_t::profile_sprinkle_coarseness, dt_drawlayer_widgets_t::profile_sprinkle_size, dt_drawlayer_widgets_t::profile_surface_dirty, and TRUE.
Referenced by gui_init().
| 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().
| 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.
| 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.
References _brush_profile_cell_rect(), DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, DT_DRAWLAYER_BRUSH_SHAPE_SIGMOIDAL, FALSE, i, dt_drawlayer_widgets_t::profile_selected_shape, dt_drawlayer_widgets_t::profile_surface_dirty, TRUE, and x.
Referenced by _brush_profile_button_press().
| 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.
Hit-test and pick color from history swatches.
References dt_drawlayer_widgets_t::color_history, dt_drawlayer_widgets_t::color_history_valid, DT_DRAWLAYER_COLOR_HISTORY_COLS, DT_DRAWLAYER_COLOR_HISTORY_COUNT, DT_DRAWLAYER_COLOR_HISTORY_ROWS, FALSE, height, row, TRUE, width, and x.
Referenced by _color_swatch_button_press().
| 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().
| 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.
References _clamp01(), DT_DRAWLAYER_BRUSH_SHAPE_LINEAR, DT_DRAWLAYER_BRUSH_SHAPE_SIGMOIDAL, dt_drawlayer_widgets_t::profile_hardness, dt_drawlayer_widgets_t::profile_opacity, dt_drawlayer_widgets_t::profile_selected_shape, dt_drawlayer_widgets_t::profile_sprinkle_coarseness, dt_drawlayer_widgets_t::profile_sprinkle_size, dt_drawlayer_widgets_t::profile_sprinkles, dt_drawlayer_widgets_t::profile_surface_dirty, and TRUE.
Referenced by _sync_brush_profile_preview_widget().
| 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_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().
| 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.
Update picker selection from widget coordinates during drag.
References _clamp01(), _color_picker_geometry(), _color_picker_hit_margin(), _picker_clamp_state_to_gamut(), _picker_project_opponent_to_display_rgb(), _rect_contains_with_margin(), dt_drawlayer_widgets_t::color_surface_dirty, DT_DRAWLAYER_COLOR_DRAG_DISC, DT_DRAWLAYER_COLOR_DRAG_NONE, DT_DRAWLAYER_COLOR_DRAG_PLANE, DT_DRAWLAYER_PICKER_C_MAX, DT_DRAWLAYER_PICKER_U_MAX, DT_DRAWLAYER_PICKER_V_MAX, FALSE, dt_drawlayer_widgets_t::picker_chroma, dt_drawlayer_widgets_t::picker_drag_mode, dt_drawlayer_widgets_t::picker_hue, dt_drawlayer_widgets_t::picker_m, dt_drawlayer_widgets_t::picker_u, dt_drawlayer_widgets_t::picker_v, TRUE, and x.
Referenced by _color_picker_set_from_position().