![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"
#include "common/interpolation.h"
#include "common/opencl.h"
#include "common/math.h"
#include "common/collection.h"
#include "control/conf.h"
#include "control/control.h"
#include "develop/imageop.h"
#include "develop/imageop_gui.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
#include <assert.h>
#include <cairo.h>
#include <complex.h>
#include <stdlib.h>
Data Structures | |
struct | dt_liquify_rgba_t |
struct | dt_liquify_layer_t |
struct | dt_liquify_path_header_t |
struct | dt_liquify_warp_t |
struct | dt_liquify_node_t |
struct | dt_liquify_path_data_t |
struct | dt_liquify_hit_t |
struct | dt_iop_liquify_params_t |
struct | dt_iop_liquify_global_data_t |
struct | dt_iop_liquify_gui_data_t |
struct | distort_params_t |
struct | restart_cookie_t |
Macros | |
#define | MAX_NODES 100 |
#define | CONF_RADIUS "plugins/darkroom/liquify/radius" |
#define | CONF_ANGLE "plugins/darkroom/liquify/angle" |
#define | CONF_STRENGTH "plugins/darkroom/liquify/strength" |
#define | COLOR_NULL { 0.0, 0.0, 0.0, 0.8 } |
#define | GREY { 0.3, 0.3, 0.3, 0.8 } |
#define | LGREY { 0.8, 0.8, 0.8, 1.0 } |
#define | COLOR_DEBUG { 0.9, 0.9, 0.0, 1.0 } |
#define | GET_UI_WIDTH(a) (get_ui_width(scale, DT_LIQUIFY_UI_WIDTH_##a)) |
#define | FG_COLOR set_source_rgba(cr, fg_color) |
#define | BG_COLOR set_source_rgba(cr, bg_color) |
#define | VERYTHINLINE set_line_width (cr, scale / 2.0f, DT_LIQUIFY_UI_WIDTH_THINLINE) |
#define | THINLINE set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THINLINE) |
#define | THICKLINE set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THICKLINE) |
#define | CHECK_HIT_PT(point) |
#define | ABCD(A, B, C, D) { { a[i] = A; b[i] = B; c[i] = C; d[i] = D; continue; } } |
#define | PREAMBLE |
#define | POSTAMBLE |
Functions | |
const char * | name () |
const char ** | description (struct dt_iop_module_t *self) |
int | default_group () |
int | flags () |
int | operation_tags () |
int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
static float | get_rot (const dt_liquify_warp_type_enum_t warp_type) |
static dt_liquify_path_data_t * | node_alloc (dt_iop_liquify_params_t *p, int *node_index) |
static dt_liquify_path_data_t * | node_prev (dt_iop_liquify_params_t *p, const dt_liquify_path_data_t *n) |
static dt_liquify_path_data_t * | node_get (dt_iop_liquify_params_t *p, const int index) |
static dt_liquify_path_data_t * | node_next (dt_iop_liquify_params_t *p, const dt_liquify_path_data_t *n) |
static void | node_insert_before (dt_iop_liquify_params_t *p, dt_liquify_path_data_t *this, dt_liquify_path_data_t *new) |
static void | node_gc (dt_iop_liquify_params_t *p) |
static void | node_delete (dt_iop_liquify_params_t *p, dt_liquify_path_data_t *this) |
static void | path_delete (dt_iop_liquify_params_t *p, dt_liquify_path_data_t *this) |
static void | _distort_paths (const struct dt_iop_module_t *module, const distort_params_t *params, const dt_iop_liquify_params_t *p) |
static void | distort_paths_raw_to_piece (const struct dt_iop_module_t *module, dt_dev_pixelpipe_t *pipe, const float roi_in_scale, dt_iop_liquify_params_t *p, const gboolean from_distort_transform) |
static float complex | normalize (const float complex v) |
static float | mix (const float a, const float b, const float t) |
static float complex | cmix (const float complex p0, const float complex p1, const float t) |
static void | mix_warps (dt_liquify_warp_t *result, const dt_liquify_warp_t *warp1, const dt_liquify_warp_t *warp2, const complex float pt, const float t) |
static void | interpolate_cubic_bezier (const float complex p0, const float complex p1, const float complex p2, const float complex p3, float complex buffer[], const int n) |
static GList * | interpolate_paths (dt_iop_liquify_params_t *p) |
static float | get_arc_length (const float complex points[], const int n_points) |
static float complex | point_at_arc_length (const float complex points[], const int n_points, const float arc_length, restart_cookie_t *restart) |
static float * | build_lookup_table (const int distance, const float control1, const float control2) |
static void | compute_round_stamp_extent (cairo_rectangle_int_t *const restrict stamp_extent, const dt_liquify_warp_t *const restrict warp) |
static void | build_round_stamp (float complex **pstamp, cairo_rectangle_int_t *const restrict stamp_extent, const dt_liquify_warp_t *const restrict warp) |
static void | add_to_global_distortion_map (float complex *global_map, const cairo_rectangle_int_t *const restrict global_map_extent, const dt_liquify_warp_t *const restrict warp, const float complex *const restrict stamp, const cairo_rectangle_int_t *stamp_extent) |
static void | apply_global_distortion_map (struct dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, const float *const restrict in, float *const restrict out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const float complex *const map, const cairo_rectangle_int_t *extent) |
static GSList * | _get_map_extent (const dt_iop_roi_t *roi_out, const GList *interpolated, cairo_rectangle_int_t *map_extent) |
static float complex * | create_global_distortion_map (const cairo_rectangle_int_t *map_extent, const GSList *interpolated, gboolean inverted) |
static float complex * | build_global_distortion_map (struct dt_iop_module_t *module, const dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out, cairo_rectangle_int_t *map_extent) |
void | modify_roi_out (struct dt_iop_module_t *module, struct dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *roi_in) |
void | modify_roi_in (struct dt_iop_module_t *module, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_out, dt_iop_roi_t *roi_in) |
static int | _distort_xtransform (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *const restrict points, const size_t points_count, const gboolean inverted) |
static void | start_drag (dt_iop_liquify_gui_data_t *g, dt_liquify_layer_enum_t layer, dt_liquify_path_data_t *elem) |
static void | end_drag (dt_iop_liquify_gui_data_t *g) |
static gboolean | is_dragging (const dt_iop_liquify_gui_data_t *g) |
int | distort_transform (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count) |
int | distort_backtransform (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count) |
void | distort_mask (struct dt_iop_module_t *self, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) |
void | process (struct dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, const void *const in, void *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) |
void | init_global (dt_iop_module_so_t *module) |
void | cleanup_global (dt_iop_module_so_t *module) |
void | init (dt_iop_module_t *module) |
void | init_pipe (struct dt_iop_module_t *module, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
void | cleanup_pipe (struct dt_iop_module_t *module, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
void | commit_params (struct dt_iop_module_t *module, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
static float | cdot (const float complex p0, const float complex p1) |
static void | draw_rectangle (cairo_t *cr, const float complex pt, const double theta, const double size) |
static void | draw_triangle (cairo_t *cr, const float complex pt, const double theta, const double size) |
static void | draw_circle (cairo_t *cr, const float complex pt, const double diameter) |
static void | set_source_rgba (cairo_t *cr, dt_liquify_rgba_t rgba) |
static float | get_ui_width (const float scale, const dt_liquify_ui_width_enum_t w) |
static void | set_line_width (cairo_t *cr, double scale, dt_liquify_ui_width_enum_t w) |
static gboolean | detect_drag (const dt_iop_liquify_gui_data_t *g, const double scale, const float complex pt) |
static void | update_warp_count (const dt_iop_liquify_gui_data_t *g) |
static void | _draw_paths (dt_iop_module_t *module, cairo_t *cr, const float scale, dt_iop_liquify_params_t *p, GList *layers) |
static float | find_nearest_on_curve_t (const float complex p0, const float complex p1, const float complex p2, const float complex p3, const float complex x, const int n) |
static float | find_nearest_on_line_t (const float complex p0, const float complex p1, const float complex x) |
static void | casteljau (const float complex *p0, float complex *p1, float complex *p2, float complex *p3, const float t) |
static dt_liquify_hit_t | _hit_paths (dt_iop_module_t *module, dt_iop_liquify_params_t *p, GList *layers, const float complex *pt) |
static void | draw_paths (struct dt_iop_module_t *module, cairo_t *cr, const float scale, dt_iop_liquify_params_t *params) |
static dt_liquify_hit_t | _hit_test_paths (struct dt_iop_module_t *module, dt_iop_liquify_params_t *params, float complex pt) |
static void | smooth_path_linsys (size_t n, const float complex *k, float complex *c1, float complex *c2, const int *equation) |
static int | path_length (dt_iop_liquify_params_t *p, dt_liquify_path_data_t *n) |
static void | smooth_paths_linsys (dt_iop_liquify_params_t *params) |
static dt_liquify_path_data_t * | find_hovered (dt_iop_liquify_params_t *p) |
static void | init_warp (dt_liquify_warp_t *warp, float complex point) |
static dt_liquify_path_data_t * | alloc_move_to (dt_iop_module_t *module, float complex start_point) |
static dt_liquify_path_data_t * | alloc_line_to (dt_iop_module_t *module, float complex end_point) |
static dt_liquify_path_data_t * | alloc_curve_to (dt_iop_module_t *module, float complex end_point) |
static void | unselect_all (dt_iop_liquify_params_t *p) |
static float | get_zoom_scale (dt_develop_t *develop) |
void | gui_post_expose (struct dt_iop_module_t *module, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery) |
static gboolean | btn_make_radio_callback (GtkToggleButton *btn, GdkEventButton *event, dt_iop_module_t *module) |
void | gui_focus (struct dt_iop_module_t *module, gboolean in) |
static void | sync_pipe (struct dt_iop_module_t *module, gboolean history) |
static void | get_point_scale (struct dt_iop_module_t *module, float x, float y, float complex *pt, float *scale) |
int | mouse_moved (struct dt_iop_module_t *module, double x, double y, double pressure, int which) |
static float | dt_conf_get_sanitize_float (const char *name, float min, float max, float default_value) |
static void | get_stamp_params (dt_iop_module_t *module, float *radius, float *r_strength, float *phi) |
int | scrolled (struct dt_iop_module_t *module, double x, double y, int up, uint32_t state) |
int | button_pressed (struct dt_iop_module_t *module, double x, double y, double pressure, int which, int type, uint32_t state) |
static void | _start_new_shape (dt_iop_module_t *module) |
int | button_released (struct dt_iop_module_t *module, double x, double y, int which, uint32_t state) |
static void | _liquify_cairo_paint_point_tool (cairo_t *cr, const gint x, const gint y, const gint w, const gint h, const gint flags, void *data) |
static void | _liquify_cairo_paint_line_tool (cairo_t *cr, const gint x, const gint y, const gint w, const gint h, const gint flags, void *data) |
static void | _liquify_cairo_paint_curve_tool (cairo_t *cr, const gint x, const gint y, const gint w, const gint h, const gint flags, void *data) |
static void | _liquify_cairo_paint_node_tool (cairo_t *cr, const gint x, const gint y, const gint w, const gint h, const gint flags, void *data) |
void | gui_update (dt_iop_module_t *module) |
void | gui_init (dt_iop_module_t *self) |
void | gui_reset (dt_iop_module_t *self) |
void | gui_cleanup (dt_iop_module_t *self) |
Variables | |
const int | LOOKUP_OVERSAMPLE = 10 |
const int | INTERPOLATION_POINTS = 100 |
const float | STAMP_RELOCATION = 0.1 |
static const dt_liquify_rgba_t | DT_LIQUIFY_COLOR_SELECTED = { 1.0, 1.0, 1.0, 1.0 } |
static const dt_liquify_rgba_t | DT_LIQUIFY_COLOR_HOVER = { 1.0, 1.0, 1.0, 0.8 } |
dt_liquify_layer_t | dt_liquify_layers [] |
float | dt_liquify_ui_widths [] |
static const dt_liquify_hit_t | NOWHERE = { DT_LIQUIFY_LAYER_BACKGROUND, NULL } |
#define BG_COLOR set_source_rgba(cr, bg_color) |
#define CHECK_HIT_PT | ( | point | ) |
#define COLOR_DEBUG { 0.9, 0.9, 0.0, 1.0 } |
#define COLOR_NULL { 0.0, 0.0, 0.0, 0.8 } |
#define CONF_ANGLE "plugins/darkroom/liquify/angle" |
#define CONF_RADIUS "plugins/darkroom/liquify/radius" |
#define CONF_STRENGTH "plugins/darkroom/liquify/strength" |
#define FG_COLOR set_source_rgba(cr, fg_color) |
#define GET_UI_WIDTH | ( | a | ) | (get_ui_width(scale, DT_LIQUIFY_UI_WIDTH_##a)) |
#define GREY { 0.3, 0.3, 0.3, 0.8 } |
#define LGREY { 0.8, 0.8, 0.8, 1.0 } |
#define MAX_NODES 100 |
#define POSTAMBLE |
#define PREAMBLE |
#define THICKLINE set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THICKLINE) |
#define THINLINE set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THINLINE) |
#define VERYTHINLINE set_line_width (cr, scale / 2.0f, DT_LIQUIFY_UI_WIDTH_THINLINE) |
|
static |
References dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, dt_dev_distort_transform_locked(), dt_dev_distort_transform_plus(), DT_DEV_TRANSFORM_DIR_ALL, DT_DEV_TRANSFORM_DIR_BACK_EXCL, DT_DEV_TRANSFORM_DIR_FORW_EXCL, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_PATH_MOVE_TO_V1, dt_liquify_path_data_t::header, dt_iop_module_t::iop_order, MAX_NODES, dt_liquify_path_data_t::node, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, dt_liquify_warp_t::strength, dt_liquify_path_header_t::type, and dt_liquify_path_data_t::warp.
Referenced by distort_paths_raw_to_piece(), and gui_post_expose().
|
static |
References _get_map_extent(), create_global_distortion_map(), dt_dev_pixelpipe_iop_t::data, dist(), distort_paths_raw_to_piece(), dt_free_align, interpolate_paths(), dt_dev_pixelpipe_iop_t::iscale, dt_dev_pixelpipe_iop_t::pipe, TRUE, and dt_iop_roi_t::x.
Referenced by distort_backtransform(), and distort_transform().
|
static |
References dt_liquify_layer_t::bg, BG_COLOR, cmix(), dt_liquify_warp_t::control1, dt_liquify_warp_t::control2, dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, draw_circle(), draw_rectangle(), draw_triangle(), DT_LIQUIFY_COLOR_HOVER, DT_LIQUIFY_COLOR_SELECTED, DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_CTRLPOINT1, DT_LIQUIFY_LAYER_CTRLPOINT1_HANDLE, DT_LIQUIFY_LAYER_CTRLPOINT2, DT_LIQUIFY_LAYER_CTRLPOINT2_HANDLE, DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED, DT_LIQUIFY_LAYER_FLAG_PREV_SELECTED, DT_LIQUIFY_LAYER_HARDNESS1, DT_LIQUIFY_LAYER_HARDNESS2, DT_LIQUIFY_LAYER_HARDNESSPOINT1, DT_LIQUIFY_LAYER_HARDNESSPOINT1_HANDLE, DT_LIQUIFY_LAYER_HARDNESSPOINT2, DT_LIQUIFY_LAYER_HARDNESSPOINT2_HANDLE, DT_LIQUIFY_LAYER_PATH, DT_LIQUIFY_LAYER_RADIUS, DT_LIQUIFY_LAYER_RADIUSPOINT, DT_LIQUIFY_LAYER_RADIUSPOINT_HANDLE, DT_LIQUIFY_LAYER_STRENGTHPOINT, DT_LIQUIFY_LAYER_STRENGTHPOINT_HANDLE, DT_LIQUIFY_LAYER_WARPS, dt_liquify_layers, DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_NODE_TYPE_CUSP, DT_LIQUIFY_NODE_TYPE_SMOOTH, DT_LIQUIFY_NODE_TYPE_SYMMETRICAL, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_PATH_MOVE_TO_V1, DT_LIQUIFY_WARP_TYPE_LINEAR, DT_M_PI, dt_liquify_layer_t::fg, FG_COLOR, flags(), get_rot(), GET_UI_WIDTH, dt_iop_module_t::gui_data, dt_liquify_path_data_t::header, dt_liquify_layer_t::hover_master, dt_liquify_path_header_t::hovered, interpolate_paths(), is_dragging(), MAX_NODES, dt_liquify_path_data_t::node, node_prev(), dt_liquify_path_header_t::node_type, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, dt_liquify_path_header_t::selected, dt_liquify_warp_t::strength, THICKLINE, THINLINE, dt_liquify_path_header_t::type, dt_liquify_warp_t::type, VERYTHINLINE, and dt_liquify_path_data_t::warp.
Referenced by draw_paths().
|
static |
References compute_round_stamp_extent(), dt_iop_roi_t::height, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
Referenced by _distort_xtransform(), build_global_distortion_map(), and modify_roi_in().
|
static |
References casteljau(), CHECK_HIT_PT, cmix(), dt_liquify_warp_t::control1, dt_liquify_warp_t::control2, dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_CTRLPOINT1, DT_LIQUIFY_LAYER_CTRLPOINT2, DT_LIQUIFY_LAYER_FLAG_HIT_TEST, DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED, DT_LIQUIFY_LAYER_FLAG_PREV_SELECTED, DT_LIQUIFY_LAYER_HARDNESSPOINT1, DT_LIQUIFY_LAYER_HARDNESSPOINT2, DT_LIQUIFY_LAYER_PATH, DT_LIQUIFY_LAYER_RADIUSPOINT, DT_LIQUIFY_LAYER_STRENGTHPOINT, dt_liquify_layers, DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_PATH_MOVE_TO_V1, DT_PIXEL_APPLY_DPI, dt_liquify_hit_t::elem, find_nearest_on_curve_t(), find_nearest_on_line_t(), flags(), dt_liquify_path_data_t::header, INTERPOLATION_POINTS, dt_liquify_hit_t::layer, MAX_NODES, dt_liquify_path_data_t::node, node_prev(), dt_liquify_path_header_t::node_type, NOWHERE, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, dt_liquify_path_header_t::selected, dt_liquify_warp_t::strength, dt_liquify_path_header_t::type, and dt_liquify_path_data_t::warp.
Referenced by _hit_test_paths().
|
static |
References _hit_paths(), DT_LIQUIFY_LAYER_FLAG_HIT_TEST, DT_LIQUIFY_LAYER_LAST, dt_liquify_layers, flags(), and NOWHERE.
Referenced by button_pressed(), and mouse_moved().
|
static |
References POSTAMBLE, and PREAMBLE.
Referenced by gui_init().
|
static |
References POSTAMBLE, and PREAMBLE.
Referenced by gui_init().
|
static |
References POSTAMBLE, and PREAMBLE.
Referenced by gui_init().
|
static |
References DT_M_PI, POSTAMBLE, and PREAMBLE.
Referenced by gui_init().
|
static |
References alloc_move_to(), darktable, darktable_t::develop, DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_STATUS_NEW, DT_LIQUIFY_STATUS_PREVIEW, get_point_scale(), get_stamp_params(), dt_iop_module_t::gui_data, dt_develop_t::height, NOWHERE, start_drag(), TRUE, and dt_develop_t::width.
Referenced by btn_make_radio_callback().
|
static |
Referenced by create_global_distortion_map().
|
static |
References DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_PATH_CURVE_TO_V1, dt_iop_module_t::gui_data, init_warp(), and node_alloc().
Referenced by button_released().
|
static |
|
static |
References DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_PATH_MOVE_TO_V1, dt_iop_module_t::gui_data, dt_liquify_path_data_t::header, init_warp(), m, node_alloc(), and dt_liquify_path_header_t::type.
Referenced by _start_new_shape().
|
static |
|
static |
References _start_new_shape(), darktable_t::control, darktable, dt_control_hinter_message(), dt_iop_request_focus(), DT_LIQUIFY_STATUS_PREVIEW, FALSE, dt_iop_module_t::gui_data, is_dragging(), node_delete(), node_prev(), sync_pipe(), and TRUE.
Referenced by button_released(), gui_focus(), gui_init(), and gui_reset().
|
static |
References _get_map_extent(), create_global_distortion_map(), dt_dev_pixelpipe_iop_t::data, distort_paths_raw_to_piece(), FALSE, interpolate_paths(), dt_dev_pixelpipe_iop_t::pipe, and dt_iop_roi_t::scale.
Referenced by distort_mask(), and process().
|
static |
References dt_alloc_align, dt_alloc_align_float(), dt_free_align, interpolate_cubic_bezier(), and lookup().
Referenced by build_round_stamp().
|
static |
int button_pressed | ( | struct dt_iop_module_t * | module, |
double | x, | ||
double | y, | ||
double | pressure, | ||
int | which, | ||
int | type, | ||
uint32_t | state | ||
) |
References _hit_test_paths(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_CTRLPOINT1, DT_LIQUIFY_LAYER_STRENGTHPOINT, DT_LIQUIFY_NODE_TYPE_LAST, DT_LIQUIFY_PATH_MOVE_TO_V1, DT_LIQUIFY_STATUS_NEW, DT_LIQUIFY_WARP_TYPE_LAST, dt_modifier_is(), end_drag(), get_point_scale(), dt_iop_module_t::gui_data, dt_liquify_path_data_t::header, is_dragging(), dt_liquify_path_header_t::node_type, NOWHERE, start_drag(), and dt_liquify_warp_t::type.
int button_released | ( | struct dt_iop_module_t * | module, |
double | x, | ||
double | y, | ||
int | which, | ||
uint32_t | state | ||
) |
References alloc_curve_to(), alloc_line_to(), btn_make_radio_callback(), casteljau(), cmix(), darktable_t::control, dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, darktable, detect_drag(), dt_control_hinter_message(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_LIQUIFY_LAYER_BACKGROUND, DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_PATH, DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_STATUS_NEW, dt_modifier_is(), end_drag(), FALSE, find_nearest_on_curve_t(), find_nearest_on_line_t(), get_point_scale(), dt_iop_module_t::gui_data, dt_liquify_path_data_t::header, dt_liquify_path_header_t::hovered, INTERPOLATION_POINTS, is_dragging(), mix_warps(), dt_liquify_path_header_t::next, dt_liquify_path_data_t::node, node_delete(), node_get(), node_insert_before(), node_prev(), dt_liquify_path_header_t::node_type, NOWHERE, path_delete(), dt_liquify_warp_t::point, dt_liquify_path_header_t::selected, start_drag(), strength(), sync_pipe(), dt_liquify_path_header_t::type, unselect_all(), update_warp_count(), and dt_liquify_path_data_t::warp.
|
static |
Referenced by _hit_paths(), and button_released().
|
static |
Referenced by find_nearest_on_line_t().
void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
void cleanup_pipe | ( | struct dt_iop_module_t * | module, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data.
|
inlinestatic |
Referenced by _draw_paths(), _hit_paths(), button_released(), interpolate_paths(), and point_at_arc_length().
void commit_params | ( | struct dt_iop_module_t * | module, |
dt_iop_params_t * | params, | ||
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References dt_dev_pixelpipe_iop_t::data, and dt_iop_module_t::params_size.
|
static |
Referenced by _get_map_extent().
|
static |
References add_to_global_distortion_map(), build_round_stamp(), dt_alloc_align, dt_free_align, height, and width.
Referenced by _distort_xtransform(), and build_global_distortion_map().
int default_colorspace | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
References IOP_CS_RGB.
int default_group | ( | ) |
References IOP_GROUP_EFFECTS.
const char ** description | ( | struct dt_iop_module_t * | self | ) |
References dt_iop_set_description().
|
static |
References GET_UI_WIDTH.
Referenced by button_released(), and mouse_moved().
int distort_backtransform | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_iop_t * | piece, | ||
float *const restrict | points, | ||
size_t | points_count | ||
) |
References _distort_xtransform(), and FALSE.
void distort_mask | ( | struct dt_iop_module_t * | self, |
struct dt_dev_pixelpipe_iop_t * | piece, | ||
const float *const | in, | ||
float *const | out, | ||
const dt_iop_roi_t *const | roi_in, | ||
const dt_iop_roi_t *const | roi_out | ||
) |
|
static |
References _distort_paths().
Referenced by _distort_xtransform(), build_global_distortion_map(), and modify_roi_in().
int distort_transform | ( | dt_iop_module_t * | self, |
dt_dev_pixelpipe_iop_t * | piece, | ||
float *const restrict | points, | ||
size_t | points_count | ||
) |
References _distort_xtransform(), and TRUE.
References DT_M_PI.
Referenced by _draw_paths().
|
static |
|
static |
References size.
Referenced by _draw_paths().
|
static |
References size.
Referenced by _draw_paths().
|
static |
References dt_conf_get_float(), dt_conf_set_float(), and name().
Referenced by get_stamp_params().
|
static |
References NOWHERE.
Referenced by button_pressed(), and button_released().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, and MAX_NODES.
Referenced by mouse_moved().
|
static |
References dist().
Referenced by _hit_paths(), and button_released().
|
static |
References cdot().
Referenced by _hit_paths(), and button_released().
int flags | ( | ) |
References IOP_FLAGS_SUPPORTS_BLENDING.
Referenced by _draw_paths(), _hit_paths(), and _hit_test_paths().
|
static |
Referenced by interpolate_paths().
|
static |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, darktable, dt_iop_module_t::dev, darktable_t::develop, dt_dev_distort_backtransform_plus(), dt_dev_get_pointer_zoom_pos(), DT_DEV_TRANSFORM_DIR_BACK_EXCL, DT_DEV_TRANSFORM_DIR_FORW_EXCL, get_zoom_scale(), dt_dev_pixelpipe_t::iheight, dt_iop_module_t::iop_order, dt_dev_pixelpipe_t::iscale, dt_dev_pixelpipe_t::iwidth, dt_develop_t::pipe, and dt_develop_t::preview_pipe.
Referenced by _start_new_shape(), button_pressed(), button_released(), and mouse_moved().
|
inlinestatic |
References DT_LIQUIFY_WARP_TYPE_RADIAL_SHRINK, and DT_M_PI_F.
Referenced by _draw_paths().
|
static |
References CONF_ANGLE, CONF_RADIUS, CONF_STRENGTH, darktable, dt_iop_module_t::dev, darktable_t::develop, dt_conf_get_sanitize_float(), dt_ui_main_window(), get_zoom_scale(), darktable_t::gui, dt_dev_pixelpipe_t::iheight, dt_dev_pixelpipe_t::iscale, dt_dev_pixelpipe_t::iwidth, M_PI, MIN, dt_develop_t::preview_pipe, dt_dev_pixelpipe_t::processed_height, dt_dev_pixelpipe_t::processed_width, and dt_gui_gtk_t::ui.
Referenced by _start_new_shape(), and scrolled().
|
static |
References DT_LIQUIFY_UI_WIDTH_LAST, dt_liquify_ui_widths, and DT_PIXEL_APPLY_DPI.
Referenced by set_line_width().
|
static |
References dt_control_get_dev_closeup(), dt_control_get_dev_zoom(), and dt_dev_get_zoom_scale().
Referenced by get_point_scale(), get_stamp_params(), and gui_post_expose().
void gui_cleanup | ( | dt_iop_module_t * | self | ) |
References IOP_GUI_FREE.
void gui_focus | ( | struct dt_iop_module_t * | module, |
gboolean | in | ||
) |
References btn_make_radio_callback(), darktable_t::collection, darktable, and dt_collection_hint_message().
void gui_init | ( | dt_iop_module_t * | self | ) |
References _liquify_cairo_paint_curve_tool(), _liquify_cairo_paint_line_tool(), _liquify_cairo_paint_node_tool(), _liquify_cairo_paint_point_tool(), btn_make_radio_callback(), dt_iop_togglebutton_new(), DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_CTRLPOINT1, DT_LIQUIFY_LAYER_CTRLPOINT2, DT_LIQUIFY_LAYER_HARDNESSPOINT1, DT_LIQUIFY_LAYER_HARDNESSPOINT2, DT_LIQUIFY_LAYER_PATH, DT_LIQUIFY_LAYER_RADIUSPOINT, DT_LIQUIFY_LAYER_STRENGTHPOINT, dt_liquify_layers, dt_ui_label_new(), FALSE, dt_liquify_layer_t::hint, IOP_GUI_ALLOC, NOWHERE, TRUE, and dt_iop_module_t::widget.
void gui_post_expose | ( | struct dt_iop_module_t * | module, |
cairo_t * | cr, | ||
int32_t | width, | ||
int32_t | height, | ||
int32_t | pointerx, | ||
int32_t | pointery | ||
) |
References _distort_paths(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_dev_pixelpipe_t::busy_mutex, draw_paths(), dt_control_get_dev_zoom_x(), dt_control_get_dev_zoom_y(), DT_DEV_TRANSFORM_DIR_ALL, dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, get_zoom_scale(), dt_iop_module_t::gui_data, height, iscale, dt_dev_pixelpipe_t::iscale, MAX, dt_develop_t::preview_pipe, smooth_paths_linsys(), update_warp_count(), and width.
void gui_reset | ( | dt_iop_module_t * | self | ) |
References btn_make_radio_callback(), dt_iop_module_t::gui_data, and NOWHERE.
void gui_update | ( | dt_iop_module_t * | module | ) |
References dt_iop_module_t::gui_data, dt_iop_module_t::params, and update_warp_count().
void init | ( | dt_iop_module_t * | module | ) |
void init_global | ( | dt_iop_module_so_t * | module | ) |
References dt_opencl_create_kernel(), and dt_iop_liquify_global_data_t::warp_kernel.
void init_pipe | ( | struct dt_iop_module_t * | module, |
dt_dev_pixelpipe_t * | pipe, | ||
dt_dev_pixelpipe_iop_t * | piece | ||
) |
|
static |
References dt_liquify_warp_t::control1, dt_liquify_warp_t::control2, DT_LIQUIFY_STATUS_NONE, DT_LIQUIFY_WARP_TYPE_LINEAR, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, dt_liquify_warp_t::status, dt_liquify_warp_t::strength, and dt_liquify_warp_t::type.
Referenced by alloc_curve_to(), alloc_line_to(), and alloc_move_to().
|
static |
Referenced by build_lookup_table(), and interpolate_paths().
|
static |
References cmix(), dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_PATH_MOVE_TO_V1, DT_LIQUIFY_STATUS_INTERPOLATED, get_arc_length(), dt_liquify_path_data_t::header, interpolate_cubic_bezier(), INTERPOLATION_POINTS, MAX_NODES, mix_warps(), dt_liquify_path_header_t::next, dt_liquify_path_data_t::node, node_prev(), dt_liquify_warp_t::point, point_at_arc_length(), dt_liquify_warp_t::radius, STAMP_RELOCATION, dt_liquify_warp_t::status, dt_liquify_path_header_t::type, and dt_liquify_path_data_t::warp.
Referenced by _distort_xtransform(), _draw_paths(), build_global_distortion_map(), and modify_roi_in().
|
static |
Referenced by _draw_paths(), btn_make_radio_callback(), button_pressed(), button_released(), and mouse_moved().
|
inlinestatic |
Referenced by _apply_mix(), area_draw(), auto_adjust_contrast_boost(), auto_adjust_exposure_boost(), luma_chroma(), mix_warps(), and process().
|
static |
References dt_liquify_warp_t::control1, dt_liquify_warp_t::control2, FALSE, M_PI_F, mix(), dt_liquify_warp_t::point, dt_liquify_warp_t::radius, dt_liquify_warp_t::strength, TRUE, and dt_liquify_warp_t::type.
Referenced by button_released(), and interpolate_paths().
void modify_roi_in | ( | struct dt_iop_module_t * | module, |
struct dt_dev_pixelpipe_iop_t * | piece, | ||
const dt_iop_roi_t * | roi_out, | ||
dt_iop_roi_t * | roi_in | ||
) |
void modify_roi_out | ( | struct dt_iop_module_t * | module, |
struct dt_dev_pixelpipe_iop_t * | piece, | ||
dt_iop_roi_t * | roi_out, | ||
const dt_iop_roi_t * | roi_in | ||
) |
int mouse_moved | ( | struct dt_iop_module_t * | module, |
double | x, | ||
double | y, | ||
double | pressure, | ||
int | which | ||
) |
References _hit_test_paths(), CONF_ANGLE, CONF_RADIUS, CONF_STRENGTH, darktable_t::control, dt_liquify_warp_t::control1, dt_liquify_warp_t::control2, dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, darktable, detect_drag(), dt_conf_set_float(), dt_control_hinter_message(), dt_iop_gui_enter_critical_section(), dt_iop_gui_leave_critical_section(), DT_LIQUIFY_LAYER_CENTERPOINT, DT_LIQUIFY_LAYER_CTRLPOINT1, DT_LIQUIFY_LAYER_CTRLPOINT2, DT_LIQUIFY_LAYER_HARDNESSPOINT1, DT_LIQUIFY_LAYER_HARDNESSPOINT2, DT_LIQUIFY_LAYER_RADIUSPOINT, DT_LIQUIFY_LAYER_STRENGTHPOINT, dt_liquify_layers, DT_LIQUIFY_NODE_TYPE_SMOOTH, DT_LIQUIFY_NODE_TYPE_SYMMETRICAL, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_LINE_TO_V1, DT_LIQUIFY_PATH_MOVE_TO_V1, dt_liquify_hit_t::elem, FALSE, find_hovered(), get_point_scale(), dt_iop_module_t::gui_data, dt_liquify_path_data_t::header, dt_liquify_layer_t::hint, dt_liquify_path_header_t::hovered, is_dragging(), dt_liquify_hit_t::layer, MIN, dt_liquify_path_data_t::node, node_next(), node_prev(), dt_liquify_path_header_t::node_type, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, start_drag(), dt_liquify_warp_t::strength, sync_pipe(), TRUE, dt_liquify_path_header_t::type, and dt_liquify_path_data_t::warp.
const char * name | ( | ) |
Referenced by dt_conf_get_sanitize_float().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, and MAX_NODES.
Referenced by alloc_curve_to(), alloc_line_to(), and alloc_move_to().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_MOVE_TO_V1, dt_liquify_path_data_t::header, dt_liquify_path_header_t::idx, dt_liquify_path_header_t::next, node_gc(), node_next(), node_prev(), dt_liquify_path_header_t::prev, and dt_liquify_path_header_t::type.
Referenced by btn_make_radio_callback(), and button_released().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, and MAX_NODES.
Referenced by node_delete(), and path_delete().
|
static |
References MAX_NODES.
Referenced by button_released().
|
static |
Referenced by button_released().
|
static |
References dt_liquify_path_data_t::header, and dt_liquify_path_header_t::next.
Referenced by mouse_moved(), node_delete(), path_delete(), and smooth_paths_linsys().
|
static |
References dt_liquify_path_data_t::header, and dt_liquify_path_header_t::prev.
Referenced by _draw_paths(), _hit_paths(), btn_make_radio_callback(), button_released(), interpolate_paths(), mouse_moved(), node_delete(), path_delete(), and smooth_paths_linsys().
|
inlinestatic |
int operation_tags | ( | ) |
References IOP_TAG_DISTORT.
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, dt_liquify_path_data_t::header, node_gc(), node_next(), node_prev(), and dt_liquify_path_header_t::type.
Referenced by button_released().
|
static |
References dt_liquify_path_data_t::header, and dt_liquify_path_header_t::next.
Referenced by smooth_paths_linsys().
|
static |
References cmix(), restart_cookie_t::i, and restart_cookie_t::length.
Referenced by interpolate_paths().
void process | ( | struct dt_iop_module_t * | module, |
dt_dev_pixelpipe_iop_t * | piece, | ||
const void *const | in, | ||
void *const | out, | ||
const dt_iop_roi_t *const | roi_in, | ||
const dt_iop_roi_t *const | roi_out | ||
) |
int scrolled | ( | struct dt_iop_module_t * | module, |
double | x, | ||
double | y, | ||
int | up, | ||
uint32_t | state | ||
) |
References CONF_ANGLE, CONF_RADIUS, CONF_STRENGTH, dt_develop_t::darkroom_skip_mouse_events, darktable, darktable_t::develop, dt_conf_set_float(), DT_M_PI_F, dt_mask_scroll_increases(), dt_modifier_is(), factor, get_stamp_params(), dt_iop_module_t::gui_data, dt_liquify_warp_t::point, dt_liquify_warp_t::radius, and dt_liquify_warp_t::strength.
|
static |
References get_ui_width(), and width.
|
static |
|
static |
Smooth a bezier spline through prescribed points.
Smooth a bezier spline through prescribed points by solving a linear system. First we build a tridiagonal matrix and then we solve it using the Thomas algorithm. (FIXME: A tridiagonal matrix is easy to solve in O(n) but you cannot write a closed path as a tridiagonal. To solve closed paths we will have to use a different solver. Use the GSL?)
Here is an article that explains the math: http://www.particleincell.com/blog/2012/bezier-splines/
Basically we find all the ctrl1 points when we solve the linear system, then we calculate each ctrl2 from the ctrl1.
We build the linear system choosing for each segment of the path an equation among following 9 equations. "Straight" is a path that goes straight in to the knot (2nd derivative == 0 at the knot). "Smooth" means a path that goes smoothly through the knot, makes no corner and curves the same amount just before and just after the knot (1st and 2nd derivatives are constant around the knot.) "Keep" means to keep the control point as the user set it.
start | end of path | |
---|---|---|
1 | straight | smooth |
2 | smooth | smooth |
3 | smooth | straight |
4 | keep | smooth |
5 | keep | keep |
6 | smooth | keep |
7 | keep | straight |
8 | straight | straight (yields a line) |
9 | straight | keep |
The equations are (close your eyes):
Some of these are the same and differ only in the way we calculate c2. (You may open your eyes again.)
References ABCD, c1, c2, and m.
Referenced by smooth_paths_linsys().
|
static |
References c1, c2, dt_liquify_node_t::ctrl1, dt_liquify_node_t::ctrl2, DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH, DT_LIQUIFY_PATH_CURVE_TO_V1, DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_LINE_TO_V1, dt_liquify_path_data_t::header, MAX_NODES, dt_liquify_path_data_t::node, node_next(), node_prev(), dt_liquify_path_header_t::node_type, path_length(), dt_liquify_warp_t::point, smooth_path_linsys(), dt_liquify_path_header_t::type, and dt_liquify_path_data_t::warp.
Referenced by gui_post_expose().
|
static |
Referenced by _start_new_shape(), button_pressed(), button_released(), and mouse_moved().
|
static |
References darktable, darktable_t::develop, dt_control_queue_redraw_center(), dt_dev_add_history_item, dt_iop_module_t::gui_data, dt_iop_module_t::params, and TRUE.
Referenced by btn_make_radio_callback(), button_released(), and mouse_moved().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, and MAX_NODES.
Referenced by button_released().
|
static |
References DT_LIQUIFY_PATH_INVALIDATED, DT_LIQUIFY_PATH_MOVE_TO_V1, and MAX_NODES.
Referenced by button_released(), gui_post_expose(), and gui_update().
|
static |
Referenced by _draw_paths().
|
static |
Referenced by _draw_paths().
dt_liquify_layer_t dt_liquify_layers[] |
Referenced by _draw_paths(), _hit_paths(), _hit_test_paths(), draw_paths(), gui_init(), and mouse_moved().
float dt_liquify_ui_widths[] |
Referenced by get_ui_width().
const int INTERPOLATION_POINTS = 100 |
Referenced by _hit_paths(), button_released(), and interpolate_paths().
const int LOOKUP_OVERSAMPLE = 10 |
Referenced by build_round_stamp().
|
static |
Referenced by _hit_paths(), _hit_test_paths(), _start_new_shape(), button_pressed(), button_released(), end_drag(), gui_init(), and gui_reset().
const float STAMP_RELOCATION = 0.1 |
Referenced by build_round_stamp(), and interpolate_paths().