![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "common/debug.h"
#include "common/imagebuf.h"
#include "common/undo.h"
#include "control/conf.h"
#include "develop/blend.h"
#include "develop/imageop.h"
#include "develop/masks.h"
#include "develop/openmp_maths.h"
#include <assert.h>
Functions | |
static void | _path_bounding_box_raw (const float *const points, const float *border, const int nb_corner, const int num_points, int num_borders, float *x_min, float *x_max, float *y_min, float *y_max) |
static void | _path_get_XY (float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float t, float *x, float *y) |
static void | _path_border_get_XY (float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float t, float rad, float *xc, float *yc, float *xb, float *yb) |
static void | _path_ctrl2_to_feather (float ptx, float pty, float ctrlx, float ctrly, float *fx, float *fy, gboolean clockwise) |
static void | _path_feather_to_ctrl (float ptx, float pty, float fx, float fy, float *ctrl1x, float *ctrl1y, float *ctrl2x, float *ctrl2y, gboolean clockwise) |
static void | _path_catmull_to_bezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float *bx1, float *by1, float *bx2, float *by2) |
static void | _path_init_ctrl_points (dt_masks_form_t *form) |
static gboolean | _path_is_clockwise (dt_masks_form_t *form) |
static int | _path_fill_gaps (int lastx, int lasty, int x, int y, dt_masks_dynbuf_t *points) |
static void | _path_points_recurs_border_gaps (float *cmax, float *bmin, float *bmin2, float *bmax, dt_masks_dynbuf_t *dpoints, dt_masks_dynbuf_t *dborder, gboolean clockwise) |
static void | _path_points_recurs (float *p1, float *p2, double tmin, double tmax, float *path_min, float *path_max, float *border_min, float *border_max, float *rpath, float *rborder, dt_masks_dynbuf_t *dpoints, dt_masks_dynbuf_t *dborder, int withborder) |
static int | _path_find_self_intersection (dt_masks_dynbuf_t *inter, int nb_corners, float *border, int border_count) |
static int | _path_get_pts_border (dt_develop_t *dev, dt_masks_form_t *form, const double iop_order, const int transf_direction, dt_dev_pixelpipe_t *pipe, float **points, int *points_count, float **border, int *border_count, gboolean source) |
static void | _path_get_distance (float x, float y, float as, dt_masks_form_gui_t *gui, int index, int corner_count, int *inside, int *inside_border, int *near, int *inside_source, float *dist) |
static int | _path_get_points_border (dt_develop_t *dev, dt_masks_form_t *form, float **points, int *points_count, float **border, int *border_count, int source, const dt_iop_module_t *module) |
static void | _path_get_sizes (struct dt_iop_module_t *module, dt_masks_form_t *form, dt_masks_form_gui_t *gui, int index, float *masks_size, float *feather_size) |
static int | _path_events_mouse_scrolled (struct dt_iop_module_t *module, float pzx, float pzy, int up, uint32_t state, dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui, int index, dt_masks_interaction_t interaction) |
static int | _path_events_button_pressed (struct dt_iop_module_t *module, float pzx, float pzy, double pressure, int which, int type, uint32_t state, dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui, int index) |
static int | _path_events_button_released (struct dt_iop_module_t *module, float pzx, float pzy, int which, uint32_t state, dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui, int index) |
static int | _path_events_mouse_moved (struct dt_iop_module_t *module, float pzx, float pzy, double pressure, int which, dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui, int index) |
static void | _path_events_post_expose (cairo_t *cr, float zoom_scale, dt_masks_form_gui_t *gui, int index, int nb) |
static void | _path_bounding_box (const float *const points, const float *border, const int nb_corner, const int num_points, int num_borders, int *width, int *height, int *posx, int *posy) |
static int | _get_area (const dt_iop_module_t *const module, const dt_dev_pixelpipe_iop_t *const piece, dt_masks_form_t *const form, int *width, int *height, int *posx, int *posy, gboolean get_source) |
static int | _path_get_source_area (dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, dt_masks_form_t *form, int *width, int *height, int *posx, int *posy) |
static int | _path_get_area (const dt_iop_module_t *const module, const dt_dev_pixelpipe_iop_t *const piece, dt_masks_form_t *const form, int *width, int *height, int *posx, int *posy) |
void | _path_falloff (float *const restrict buffer, int *p0, int *p1, int posx, int posy, int bw) |
static int | _path_get_mask (const dt_iop_module_t *const module, const dt_dev_pixelpipe_iop_t *const piece, dt_masks_form_t *const form, float **buffer, int *width, int *height, int *posx, int *posy) |
static int | _path_crop_to_roi (float *path, const int point_count, float xmin, float xmax, float ymin, float ymax) |
static void | _path_falloff_roi (float *buffer, int *p0, int *p1, int bw, int bh) |
static int | _path_get_mask_roi (const dt_iop_module_t *const module, const dt_dev_pixelpipe_iop_t *const piece, dt_masks_form_t *const form, const dt_iop_roi_t *roi, float *buffer) |
static void | _path_sanitize_config (dt_masks_type_t type) |
static void | _path_set_form_name (struct dt_masks_form_t *const form, const size_t nb) |
static void | _path_set_hint_message (const dt_masks_form_gui_t *const gui, const dt_masks_form_t *const form, const int opacity, char *const restrict msgbuf, const size_t msgbuf_len) |
static void | _path_duplicate_points (dt_develop_t *const dev, dt_masks_form_t *const base, dt_masks_form_t *const dest) |
static void | _path_initial_source_pos (const float iwd, const float iht, float *x, float *y) |
Variables | |
const dt_masks_functions_t | dt_masks_functions_path |
|
static |
|
static |
get the point of the path at pos t [0,1] AND the corresponding border point
References _path_get_XY(), and double().
Referenced by _path_get_pts_border(), and _path_points_recurs().
|
static |
References _path_bounding_box_raw(), height, and width.
Referenced by _get_area(), and _path_get_mask().
|
static |
Referenced by _path_bounding_box(), and _path_get_mask_roi().
|
static |
Get the control points of a segment to match exactly a catmull-rom spline
Referenced by _path_init_ctrl_points().
|
static |
crop path to roi given by xmin, xmax, ymin, ymax. path segments outside of roi are replaced by nodes lying on roi borders.
Referenced by _path_get_mask_roi().
|
static |
get feather extremity from the control point n°2 the values should be in orthonormal space
Referenced by _path_events_mouse_moved(), and _path_events_post_expose().
|
static |
References dt_masks_form_t::points, and void().
|
static |
References _path_init_ctrl_points(), _path_is_clockwise(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_masks_point_path_t::border, dt_masks_form_gui_points_t::clockwise, dt_masks_point_path_t::corner, dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_closing_form, dt_masks_form_gui_t::creation_module, dt_masks_point_path_t::ctrl1, dt_masks_point_path_t::ctrl2, darktable, darktable_t::develop, dt_conf_get_float(), dt_dev_distort_backtransform(), dt_dev_masks_list_remove(), dt_dev_masks_selection_change(), dt_masks_change_form_gui(), dt_masks_clear_form_gui(), DT_MASKS_CLONE, DT_MASKS_EDIT_FULL, dt_masks_form_remove(), dt_masks_get_from_id(), DT_MASKS_GROUP, dt_masks_gui_form_create(), dt_masks_gui_form_remove(), dt_masks_gui_form_save_creation(), dt_masks_iop_update(), DT_MASKS_NON_CLONE, DT_MASKS_PATH, DT_MASKS_POINT_STATE_NORMAL, DT_MASKS_POINT_STATE_USER, dt_masks_select_form(), dt_masks_set_edit_mode(), dt_masks_set_source_pos_initial_state(), dt_masks_set_source_pos_initial_value(), dt_modifier_is(), dt_masks_form_gui_t::dx, dt_masks_form_gui_t::dy, dt_masks_form_gui_t::edit_mode, dt_masks_form_gui_t::feather_dragging, dt_masks_form_gui_t::feather_selected, dt_masks_form_gui_t::form_dragging, dt_develop_t::form_gui, dt_masks_form_gui_t::form_selected, dt_develop_t::form_visible, dt_masks_point_group_t::formid, dt_masks_form_t::formid, g_list_next_wraparound(), g_list_shorter_than(), dt_masks_form_gui_t::group_selected, dt_dev_pixelpipe_t::iheight, dt_dev_pixelpipe_t::iwidth, MAX, MIN, dt_masks_form_gui_t::point_border_dragging, dt_masks_form_gui_t::point_border_selected, dt_masks_form_gui_t::point_dragging, dt_masks_form_gui_t::point_edited, dt_masks_form_gui_t::point_selected, dt_masks_form_t::points, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_gui_t::posx, dt_masks_form_gui_t::posy, dt_develop_t::preview_pipe, dt_masks_form_gui_t::scrollx, dt_masks_form_gui_t::scrolly, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_selected, dt_masks_form_t::source, dt_masks_form_gui_points_t::source, dt_masks_form_gui_t::source_dragging, dt_masks_form_gui_t::source_selected, dt_masks_point_path_t::state, TRUE, type, and dt_masks_form_t::type.
|
static |
References _path_feather_to_ctrl(), _path_init_ctrl_points(), _path_is_clockwise(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_masks_form_gui_points_t::clockwise, dt_masks_form_gui_t::creation, darktable, darktable_t::develop, dt_dev_distort_backtransform(), dt_masks_gui_form_create(), dt_masks_gui_form_remove(), DT_MASKS_POINT_STATE_USER, dt_masks_form_gui_t::dx, dt_masks_form_gui_t::dy, FALSE, dt_masks_form_gui_t::feather_dragging, dt_masks_form_gui_t::form_dragging, dt_dev_pixelpipe_t::iheight, dt_dev_pixelpipe_t::iwidth, dt_masks_form_gui_t::point_border_dragging, dt_masks_form_gui_t::point_dragging, dt_masks_form_t::points, dt_masks_form_gui_t::points, dt_develop_t::preview_pipe, dt_masks_form_gui_t::scrollx, dt_masks_form_gui_t::scrolly, dt_masks_form_gui_t::seg_dragging, dt_masks_form_t::source, and dt_masks_form_gui_t::source_dragging.
|
static |
References _path_ctrl2_to_feather(), _path_feather_to_ctrl(), _path_get_distance(), _path_init_ctrl_points(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_masks_form_gui_points_t::border, dt_masks_form_gui_t::border_selected, dt_masks_form_gui_points_t::clockwise, dt_masks_point_path_t::corner, dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_closing_form, dt_masks_point_path_t::ctrl1, dt_masks_point_path_t::ctrl2, darktable, darktable_t::develop, dist(), dt_control_get_dev_closeup(), dt_control_get_dev_zoom(), dt_dev_distort_backtransform(), dt_dev_get_zoom_scale(), DT_MASKS_CLONE, DT_MASKS_EDIT_FULL, dt_masks_gui_form_create(), dt_masks_gui_form_remove(), DT_MASKS_POINT_STATE_USER, DT_PIXEL_APPLY_DPI, dt_masks_form_gui_t::dx, dt_masks_form_gui_t::dy, dt_masks_form_gui_t::edit_mode, FALSE, dt_masks_form_gui_t::feather_dragging, dt_masks_form_gui_t::feather_selected, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::form_selected, g_list_next_wraparound(), g_list_shorter_than(), dt_masks_form_gui_t::group_selected, dt_dev_pixelpipe_t::iheight, dt_dev_pixelpipe_t::iwidth, dt_masks_form_gui_t::point_border_dragging, dt_masks_form_gui_t::point_border_selected, dt_masks_form_gui_t::point_dragging, dt_masks_form_gui_t::point_edited, dt_masks_form_gui_t::point_selected, dt_masks_form_t::points, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_develop_t::preview_pipe, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_selected, dt_masks_form_t::source, dt_masks_form_gui_t::source_dragging, dt_masks_form_gui_t::source_selected, TRUE, and dt_masks_form_t::type.
|
static |
References _path_get_sizes(), _path_init_ctrl_points(), dt_masks_point_path_t::corner, dt_conf_get_float(), dt_conf_set_float(), DT_MASKS_CLONE, DT_MASKS_EDIT_FULL, dt_masks_form_change_opacity(), dt_masks_gui_form_create(), dt_masks_gui_form_remove(), DT_MASKS_NON_CLONE, dt_modifier_is(), dt_toast_log(), dt_masks_form_gui_t::edit_mode, dt_masks_form_gui_t::feather_selected, dt_masks_form_gui_t::form_selected, g_list_next_wraparound(), MAX, MIN, dt_masks_form_gui_t::point_border_selected, dt_masks_form_gui_t::point_selected, dt_masks_form_t::points, dt_masks_form_gui_t::scrollx, dt_masks_form_gui_t::scrolly, dt_masks_form_gui_t::seg_selected, and dt_masks_form_t::type.
|
static |
References _path_ctrl2_to_feather(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_masks_form_gui_points_t::border, dt_masks_form_gui_points_t::border_count, dt_masks_form_gui_t::border_selected, dt_masks_form_gui_points_t::clockwise, dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_closing_form, darktable, darktable_t::develop, dt_control_get_dev_zoom_x(), dt_control_get_dev_zoom_y(), dt_draw_set_color_overlay(), dt_masks_calculate_source_pos_value(), DT_MASKS_CLONE, dt_masks_draw_clone_source_pos(), DT_MASKS_PATH, FALSE, dt_masks_form_gui_t::feather_dragging, dt_masks_form_gui_t::feather_selected, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::form_selected, dt_develop_t::form_visible, dt_masks_form_gui_t::group_selected, M_PI, dt_masks_form_gui_t::mouse_leaved_center, dt_masks_form_gui_t::point_border_selected, dt_masks_form_gui_t::point_dragging, dt_masks_form_gui_t::point_edited, dt_masks_form_gui_t::point_selected, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_gui_points_t::points_count, dt_masks_form_gui_t::posx, dt_masks_form_gui_t::posy, dt_develop_t::preview_pipe, dt_masks_form_gui_t::seg_selected, dt_masks_form_gui_points_t::source, dt_masks_form_gui_points_t::source_count, TRUE, and dt_masks_form_t::type.
void _path_falloff | ( | float *const restrict | buffer, |
int * | p0, | ||
int * | p1, | ||
int | posx, | ||
int | posy, | ||
int | bw | ||
) |
|
static |
we write a falloff segment respecting limits of buffer
References MAX.
Referenced by _path_get_mask_roi().
|
static |
get bezier control points from feather extremity the values should be in orthonormal space
Referenced by _path_events_button_released(), and _path_events_mouse_moved().
|
static |
fill eventual gaps between 2 points with a line
References dt_masks_dynbuf_add_2(), dt_masks_dynbuf_get(), and dt_masks_dynbuf_reset().
Referenced by _path_find_self_intersection().
|
static |
find all self intersections in a path
References _path_fill_gaps(), dt_alloc_align, dt_free_align, dt_masks_dynbuf_add_2(), dt_masks_dynbuf_buffer(), dt_masks_dynbuf_free(), dt_masks_dynbuf_get(), dt_masks_dynbuf_init(), dt_masks_dynbuf_position(), and dt_masks_dynbuf_set().
Referenced by _path_get_pts_border().
|
static |
References _get_area(), FALSE, height, and width.
|
static |
get the distance between point (x,y) and the path
References dt_masks_form_gui_points_t::border, dt_masks_form_gui_points_t::border_count, dist(), dt_masks_point_in_form_exact(), dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_gui_points_t::points_count, dt_masks_form_gui_points_t::source, dt_masks_form_gui_points_t::source_count, and sqf().
Referenced by _path_events_mouse_moved().
|
static |
References _path_bounding_box(), _path_falloff(), _path_get_pts_border(), darktable, dt_iop_module_t::dev, dt_calloc_align_float(), DT_DEBUG_MASKS, DT_DEBUG_PERF, DT_DEV_TRANSFORM_DIR_BACK_INCL, dt_free_align, dt_get_wtime(), dt_print(), FALSE, height, dt_iop_module_t::iop_order, dt_masks_form_t::name, dt_dev_pixelpipe_iop_t::pipe, dt_masks_form_t::points, darktable_t::unmuted, and width.
|
static |
References _path_bounding_box_raw(), _path_crop_to_roi(), _path_falloff_roi(), _path_get_pts_border(), darktable, dt_iop_module_t::dev, dt_alloc_align, dt_alloc_align_float(), DT_DEBUG_MASKS, DT_DEBUG_PERF, DT_DEV_TRANSFORM_DIR_BACK_INCL, dt_free_align, dt_get_wtime(), dt_print(), FALSE, height, dt_iop_roi_t::height, dt_iop_module_t::iop_order, m, MAX, MIN, dt_masks_form_t::name, dt_dev_pixelpipe_iop_t::pipe, dt_masks_form_t::points, dt_iop_roi_t::scale, darktable_t::unmuted, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
|
static |
|
static |
get all points of the path and the border this take care of gaps and self-intersection and iop distortions
References _path_border_get_XY(), _path_find_self_intersection(), _path_is_clockwise(), _path_points_recurs(), _path_points_recurs_border_gaps(), dt_masks_point_path_t::border, dt_masks_point_path_t::corner, dt_masks_point_path_t::ctrl1, dt_masks_point_path_t::ctrl2, darktable, dt_alloc_align_float(), DT_DEBUG_MASKS, DT_DEBUG_PERF, dt_dev_distort_transform_plus(), DT_DEV_TRANSFORM_DIR_ALL, DT_DEV_TRANSFORM_DIR_BACK_EXCL, DT_DEV_TRANSFORM_DIR_FORW_INCL, dt_free_align, dt_get_wtime(), dt_masks_dynbuf_add_2(), dt_masks_dynbuf_add_zeros(), dt_masks_dynbuf_buffer(), dt_masks_dynbuf_free(), dt_masks_dynbuf_get(), dt_masks_dynbuf_harvest(), dt_masks_dynbuf_init(), dt_masks_dynbuf_position(), dt_masks_dynbuf_reserve_n(), dt_masks_dynbuf_set(), dt_print(), g_list_next_wraparound(), dt_dev_pixelpipe_t::iheight, dt_dev_pixelpipe_t::iwidth, MAX, MIN, dt_masks_form_t::name, dt_masks_form_t::points, dt_masks_form_t::source, and darktable_t::unmuted.
Referenced by _get_area(), _path_get_mask(), _path_get_mask_roi(), and _path_get_points_border().
|
static |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_masks_form_gui_points_t::border, darktable, darktable_t::develop, dt_masks_form_t::points, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_gui_points_t::points_count, and dt_develop_t::preview_pipe.
Referenced by _path_events_mouse_scrolled().
|
static |
References _get_area(), height, TRUE, and width.
|
static |
get the point of the path at pos t [0,1]
Referenced by _path_border_get_XY().
|
static |
initialise all control points to eventually match a catmull-rom like spline
References _path_catmull_to_bezier(), dt_masks_point_path_t::corner, dt_masks_point_path_t::ctrl1, dt_masks_point_path_t::ctrl2, DT_MASKS_POINT_STATE_NORMAL, g_list_next_wraparound(), g_list_prev_wraparound(), dt_masks_form_t::points, and dt_masks_point_path_t::state.
Referenced by _path_events_button_pressed(), _path_events_button_released(), _path_events_mouse_moved(), and _path_events_mouse_scrolled().
|
static |
|
static |
References dt_masks_point_path_t::corner, g_list_next_wraparound(), g_list_shorter_than(), dt_masks_form_t::points, and TRUE.
Referenced by _path_events_button_pressed(), _path_events_button_released(), and _path_get_pts_border().
|
static |
recursive function to get all points of the path AND all point of the border the function take care to avoid big gaps between points
References _path_border_get_XY(), _path_points_recurs(), and dt_masks_dynbuf_add_2().
Referenced by _path_get_pts_border(), and _path_points_recurs().
|
static |
fill the gap between 2 points with an arc of circle this function is here because we can have gap in border, esp. if the corner is very sharp
References dt_masks_dynbuf_reserve_n(), and M_PI.
Referenced by _path_get_pts_border().
|
static |
|
static |
References dt_masks_form_t::name.
|
static |
const dt_masks_functions_t dt_masks_functions_path |
Referenced by dt_masks_calculate_source_pos_value(), and dt_masks_create().