Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
liquify.c File Reference
#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 "develop/develop.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
#include <assert.h>
#include <cairo.h>
#include <complex.h>
#include <stdlib.h>
+ Include dependency graph for liquify.c:

Go to the source code of this file.

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
 
struct  dt_liquify_kernel_descriptor_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; } }
 

Typedefs

typedef cl_mem cl_mem_t
 
typedef cl_int cl_int_t
 

Enumerations

enum  dt_liquify_layer_enum_t {
  DT_LIQUIFY_LAYER_BACKGROUND ,
  DT_LIQUIFY_LAYER_RADIUS ,
  DT_LIQUIFY_LAYER_HARDNESS1 ,
  DT_LIQUIFY_LAYER_HARDNESS2 ,
  DT_LIQUIFY_LAYER_WARPS ,
  DT_LIQUIFY_LAYER_PATH ,
  DT_LIQUIFY_LAYER_CTRLPOINT1_HANDLE ,
  DT_LIQUIFY_LAYER_CTRLPOINT2_HANDLE ,
  DT_LIQUIFY_LAYER_RADIUSPOINT_HANDLE ,
  DT_LIQUIFY_LAYER_HARDNESSPOINT1_HANDLE ,
  DT_LIQUIFY_LAYER_HARDNESSPOINT2_HANDLE ,
  DT_LIQUIFY_LAYER_STRENGTHPOINT_HANDLE ,
  DT_LIQUIFY_LAYER_CENTERPOINT ,
  DT_LIQUIFY_LAYER_CTRLPOINT1 ,
  DT_LIQUIFY_LAYER_CTRLPOINT2 ,
  DT_LIQUIFY_LAYER_RADIUSPOINT ,
  DT_LIQUIFY_LAYER_HARDNESSPOINT1 ,
  DT_LIQUIFY_LAYER_HARDNESSPOINT2 ,
  DT_LIQUIFY_LAYER_STRENGTHPOINT ,
  DT_LIQUIFY_LAYER_LAST
}
 
enum  dt_liquify_layer_flag_enum_t {
  DT_LIQUIFY_LAYER_FLAG_HIT_TEST = 1 ,
  DT_LIQUIFY_LAYER_FLAG_PREV_SELECTED = 2 ,
  DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED = 4 ,
  DT_LIQUIFY_LAYER_FLAG_POINT_TOOL = 8 ,
  DT_LIQUIFY_LAYER_FLAG_LINE_TOOL = 16 ,
  DT_LIQUIFY_LAYER_FLAG_CURVE_TOOL = 32 ,
  DT_LIQUIFY_LAYER_FLAG_NODE_TOOL = 64 ,
  DT_LIQUIFY_LAYER_FLAG_ANY_TOOL = 8 + 16 + 32 + 64
}
 
enum  dt_liquify_ui_width_enum_t {
  DT_LIQUIFY_UI_WIDTH_THINLINE ,
  DT_LIQUIFY_UI_WIDTH_THICKLINE ,
  DT_LIQUIFY_UI_WIDTH_DOUBLELINE ,
  DT_LIQUIFY_UI_WIDTH_GIZMO ,
  DT_LIQUIFY_UI_WIDTH_GIZMO_SMALL ,
  DT_LIQUIFY_UI_WIDTH_DEFAULT_RADIUS ,
  DT_LIQUIFY_UI_WIDTH_DEFAULT_STRENGTH ,
  DT_LIQUIFY_UI_WIDTH_MIN_DRAG ,
  DT_LIQUIFY_UI_WIDTH_LAST
}
 
enum  dt_liquify_warp_type_enum_t {
  DT_LIQUIFY_WARP_TYPE_LINEAR ,
  DT_LIQUIFY_WARP_TYPE_RADIAL_GROW ,
  DT_LIQUIFY_WARP_TYPE_RADIAL_SHRINK ,
  DT_LIQUIFY_WARP_TYPE_LAST
}
 
enum  dt_liquify_node_type_enum_t {
  DT_LIQUIFY_NODE_TYPE_CUSP ,
  DT_LIQUIFY_NODE_TYPE_SMOOTH ,
  DT_LIQUIFY_NODE_TYPE_SYMMETRICAL ,
  DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH ,
  DT_LIQUIFY_NODE_TYPE_LAST
}
 
enum  dt_liquify_status_enum_t {
  DT_LIQUIFY_STATUS_NONE = 0 ,
  DT_LIQUIFY_STATUS_NEW = 1 ,
  DT_LIQUIFY_STATUS_INTERPOLATED = 2 ,
  DT_LIQUIFY_STATUS_PREVIEW = 4 ,
  DT_LIQUIFY_STATUS_LAST
}
 
enum  dt_liquify_path_data_enum_t {
  DT_LIQUIFY_PATH_INVALIDATED = 0 ,
  DT_LIQUIFY_PATH_MOVE_TO_V1 ,
  DT_LIQUIFY_PATH_LINE_TO_V1 ,
  DT_LIQUIFY_PATH_CURVE_TO_V1
}
 

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, const dt_dev_pixelpipe_iop_t *piece)
 
void input_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
 
static float get_rot (const dt_liquify_warp_type_enum_t warp_type)
 
static dt_liquify_path_data_tnode_alloc (dt_iop_liquify_params_t *p, int *node_index)
 
static dt_liquify_path_data_tnode_prev (dt_iop_liquify_params_t *p, const dt_liquify_path_data_t *n)
 
static dt_liquify_path_data_tnode_get (dt_iop_liquify_params_t *p, const int index)
 
static dt_liquify_path_data_tnode_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, const 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 int 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 __DT_CLONE_TARGETS__ void apply_global_distortion_map (struct dt_iop_module_t *module, const 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 int ch, 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_t *pipe, 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, const struct dt_dev_pixelpipe_t *pipe, 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, const struct dt_dev_pixelpipe_t *pipe, 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, const dt_dev_pixelpipe_t *pipe, const 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, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
 
int distort_backtransform (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
 
void distort_mask (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, 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)
 
__DT_CLONE_TARGETS__ int process (struct dt_iop_module_t *module, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const in, void *const out)
 
static float bicubic (const float a, const float x)
 
static float mitchell (const float x)
 
static cl_int_t apply_global_distortion_map_cl (struct dt_iop_module_t *module, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const cl_mem_t dev_in, const cl_mem_t dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out, const float complex *map, const cairo_rectangle_int_t *map_extent)
 
int process_cl (struct dt_iop_module_t *module, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const cl_mem_t dev_in, const cl_mem_t dev_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_tfind_hovered (dt_iop_liquify_params_t *p)
 
static void init_warp (dt_liquify_warp_t *warp, float complex point)
 
static dt_liquify_path_data_talloc_move_to (dt_iop_module_t *module, float complex start_point)
 
static dt_liquify_path_data_talloc_line_to (dt_iop_module_t *module, float complex end_point)
 
static dt_liquify_path_data_talloc_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 (const 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)
 
static gboolean _is_movable_layer (const dt_liquify_layer_enum_t layer)
 
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)
 
int key_pressed (struct dt_iop_module_t *self, GdkEventKey *event)
 
void gui_update (dt_iop_module_t *module)
 Refresh GUI controls from current params and configuration.
 
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 }
 

Macro Definition Documentation

◆ ABCD

#define ABCD (   A,
  B,
  C,
 
)    { { a[i] = A; b[i] = B; c[i] = C; d[i] = D; continue; } }

◆ BG_COLOR

#define BG_COLOR   set_source_rgba(cr, bg_color)

Definition at line 1933 of file liquify.c.

◆ CHECK_HIT_PT

#define CHECK_HIT_PT (   point)
Value:
const float d = cabsf(point - (*pt)); \
if(d < distance) \
{ \
distance = d; \
hit.layer = layer; \
hit.elem = data; \
}

Definition at line 2322 of file liquify.c.

◆ COLOR_DEBUG

#define COLOR_DEBUG   { 0.9, 0.9, 0.0, 1.0 }

Definition at line 135 of file liquify.c.

◆ COLOR_NULL

#define COLOR_NULL   { 0.0, 0.0, 0.0, 0.8 }

Definition at line 132 of file liquify.c.

◆ CONF_ANGLE

#define CONF_ANGLE   "plugins/darkroom/liquify/angle"

Definition at line 86 of file liquify.c.

◆ CONF_RADIUS

#define CONF_RADIUS   "plugins/darkroom/liquify/radius"

Definition at line 85 of file liquify.c.

◆ CONF_STRENGTH

#define CONF_STRENGTH   "plugins/darkroom/liquify/strength"

Definition at line 87 of file liquify.c.

◆ FG_COLOR

#define FG_COLOR   set_source_rgba(cr, fg_color)

Definition at line 1932 of file liquify.c.

◆ GET_UI_WIDTH

#define GET_UI_WIDTH (   a)    (get_ui_width(scale, DT_LIQUIFY_UI_WIDTH_##a))

Definition at line 1825 of file liquify.c.

◆ GREY

#define GREY   { 0.3, 0.3, 0.3, 0.8 }

Definition at line 133 of file liquify.c.

◆ LGREY

#define LGREY   { 0.8, 0.8, 0.8, 1.0 }

Definition at line 134 of file liquify.c.

◆ MAX_NODES

#define MAX_NODES   100

Definition at line 79 of file liquify.c.

◆ THICKLINE

#define THICKLINE   set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THICKLINE)

Definition at line 1936 of file liquify.c.

◆ THINLINE

#define THINLINE   set_line_width (cr, scale, DT_LIQUIFY_UI_WIDTH_THINLINE)

Definition at line 1935 of file liquify.c.

◆ VERYTHINLINE

#define VERYTHINLINE   set_line_width (cr, scale / 2.0f, DT_LIQUIFY_UI_WIDTH_THINLINE)

Definition at line 1934 of file liquify.c.

Typedef Documentation

◆ cl_int_t

typedef cl_int cl_int_t

Definition at line 1576 of file liquify.c.

◆ cl_mem_t

typedef cl_mem cl_mem_t

Definition at line 1575 of file liquify.c.

Enumeration Type Documentation

◆ dt_liquify_layer_enum_t

Enumerator
DT_LIQUIFY_LAYER_BACKGROUND 
DT_LIQUIFY_LAYER_RADIUS 
DT_LIQUIFY_LAYER_HARDNESS1 
DT_LIQUIFY_LAYER_HARDNESS2 
DT_LIQUIFY_LAYER_WARPS 
DT_LIQUIFY_LAYER_PATH 
DT_LIQUIFY_LAYER_CTRLPOINT1_HANDLE 
DT_LIQUIFY_LAYER_CTRLPOINT2_HANDLE 
DT_LIQUIFY_LAYER_RADIUSPOINT_HANDLE 
DT_LIQUIFY_LAYER_HARDNESSPOINT1_HANDLE 
DT_LIQUIFY_LAYER_HARDNESSPOINT2_HANDLE 
DT_LIQUIFY_LAYER_STRENGTHPOINT_HANDLE 
DT_LIQUIFY_LAYER_CENTERPOINT 
DT_LIQUIFY_LAYER_CTRLPOINT1 
DT_LIQUIFY_LAYER_CTRLPOINT2 
DT_LIQUIFY_LAYER_RADIUSPOINT 
DT_LIQUIFY_LAYER_HARDNESSPOINT1 
DT_LIQUIFY_LAYER_HARDNESSPOINT2 
DT_LIQUIFY_LAYER_STRENGTHPOINT 
DT_LIQUIFY_LAYER_LAST 

Definition at line 91 of file liquify.c.

◆ dt_liquify_layer_flag_enum_t

Enumerator
DT_LIQUIFY_LAYER_FLAG_HIT_TEST 

include layer in hit testing

DT_LIQUIFY_LAYER_FLAG_PREV_SELECTED 

show if previous node is selected

DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED 

show if node is selected

DT_LIQUIFY_LAYER_FLAG_POINT_TOOL 

show if point tool active

DT_LIQUIFY_LAYER_FLAG_LINE_TOOL 

show if line tool active

DT_LIQUIFY_LAYER_FLAG_CURVE_TOOL 

show if line tool active

DT_LIQUIFY_LAYER_FLAG_NODE_TOOL 

show if node tool active

DT_LIQUIFY_LAYER_FLAG_ANY_TOOL 

Definition at line 115 of file liquify.c.

◆ dt_liquify_node_type_enum_t

Enumerator
DT_LIQUIFY_NODE_TYPE_CUSP 
DT_LIQUIFY_NODE_TYPE_SMOOTH 
DT_LIQUIFY_NODE_TYPE_SYMMETRICAL 
DT_LIQUIFY_NODE_TYPE_AUTOSMOOTH 
DT_LIQUIFY_NODE_TYPE_LAST 

Definition at line 208 of file liquify.c.

◆ dt_liquify_path_data_enum_t

Enumerator
DT_LIQUIFY_PATH_INVALIDATED 
DT_LIQUIFY_PATH_MOVE_TO_V1 
DT_LIQUIFY_PATH_LINE_TO_V1 
DT_LIQUIFY_PATH_CURVE_TO_V1 

Definition at line 228 of file liquify.c.

◆ dt_liquify_status_enum_t

Enumerator
DT_LIQUIFY_STATUS_NONE 
DT_LIQUIFY_STATUS_NEW 
DT_LIQUIFY_STATUS_INTERPOLATED 
DT_LIQUIFY_STATUS_PREVIEW 
DT_LIQUIFY_STATUS_LAST 

Definition at line 217 of file liquify.c.

◆ dt_liquify_ui_width_enum_t

Enumerator
DT_LIQUIFY_UI_WIDTH_THINLINE 
DT_LIQUIFY_UI_WIDTH_THICKLINE 
DT_LIQUIFY_UI_WIDTH_DOUBLELINE 
DT_LIQUIFY_UI_WIDTH_GIZMO 
DT_LIQUIFY_UI_WIDTH_GIZMO_SMALL 
DT_LIQUIFY_UI_WIDTH_DEFAULT_RADIUS 
DT_LIQUIFY_UI_WIDTH_DEFAULT_STRENGTH 
DT_LIQUIFY_UI_WIDTH_MIN_DRAG 
DT_LIQUIFY_UI_WIDTH_LAST 

Definition at line 174 of file liquify.c.

◆ dt_liquify_warp_type_enum_t

Enumerator
DT_LIQUIFY_WARP_TYPE_LINEAR 
DT_LIQUIFY_WARP_TYPE_RADIAL_GROW 
DT_LIQUIFY_WARP_TYPE_RADIAL_SHRINK 
DT_LIQUIFY_WARP_TYPE_LAST 

Definition at line 200 of file liquify.c.

Function Documentation

◆ _distort_paths()

◆ _distort_xtransform()

static int _distort_xtransform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *const restrict  points,
const size_t  points_count,
const gboolean  inverted 
)
static

◆ _draw_paths()

static void _draw_paths ( dt_iop_module_t module,
cairo_t *  cr,
const float  scale,
dt_iop_liquify_params_t p,
GList *  layers 
)
static

Definition at line 1938 of file liquify.c.

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_free_gpointer(), 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(), g, 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, i, interpolate_paths(), is_dragging(), IS_NULL_PTR, k, MAX_NODES, dt_liquify_path_data_t::node, node_prev(), dt_liquify_path_header_t::node_type, p, 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().

◆ _get_map_extent()

static GSList * _get_map_extent ( const dt_iop_roi_t roi_out,
const GList *  interpolated,
cairo_rectangle_int_t *  map_extent 
)
static

◆ _hit_paths()

◆ _hit_test_paths()

static dt_liquify_hit_t _hit_test_paths ( struct dt_iop_module_t module,
dt_iop_liquify_params_t params,
float complex  pt 
)
static

◆ _is_movable_layer()

◆ _start_new_shape()

◆ add_to_global_distortion_map()

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

Definition at line 1036 of file liquify.c.

References dt_free, and x.

Referenced by create_global_distortion_map().

◆ alloc_curve_to()

static dt_liquify_path_data_t * alloc_curve_to ( dt_iop_module_t module,
float complex  end_point 
)
static

◆ alloc_line_to()

◆ alloc_move_to()

static dt_liquify_path_data_t * alloc_move_to ( dt_iop_module_t module,
float complex  start_point 
)
static

◆ apply_global_distortion_map()

static __DT_CLONE_TARGETS__ void apply_global_distortion_map ( struct dt_iop_module_t module,
const 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 int  ch,
const float complex *const  map,
const cairo_rectangle_int_t *  extent 
)
static

◆ apply_global_distortion_map_cl()

◆ bicubic()

static float bicubic ( const float  a,
const float  x 
)
inlinestatic

Definition at line 1548 of file liquify.c.

References x.

Referenced by apply_global_distortion_map_cl().

◆ btn_make_radio_callback()

static gboolean btn_make_radio_callback ( GtkToggleButton *  btn,
GdkEventButton *  event,
dt_iop_module_t module 
)
static

◆ build_global_distortion_map()

static float complex * build_global_distortion_map ( struct dt_iop_module_t module,
const dt_dev_pixelpipe_t pipe,
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 
)
static

◆ build_lookup_table()

static float * build_lookup_table ( const int  distance,
const float  control1,
const float  control2 
)
static

◆ build_round_stamp()

static int build_round_stamp ( float complex **  pstamp,
cairo_rectangle_int_t *const restrict  stamp_extent,
const dt_liquify_warp_t *const restrict  warp 
)
static

◆ button_pressed()

◆ button_released()

◆ casteljau()

static void casteljau ( const float complex *  p0,
float complex *  p1,
float complex *  p2,
float complex *  p3,
const float  t 
)
static

Definition at line 2306 of file liquify.c.

References t.

Referenced by _hit_paths(), and button_released().

◆ cdot()

static float cdot ( const float complex  p0,
const float complex  p1 
)
static

Definition at line 1773 of file liquify.c.

Referenced by find_nearest_on_line_t().

◆ cleanup_global()

◆ cleanup_pipe()

void cleanup_pipe ( struct dt_iop_module_t module,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

Definition at line 1755 of file liquify.c.

References dt_dev_pixelpipe_iop_t::data, and dt_free_align.

◆ cmix()

static float complex cmix ( const float complex  p0,
const float complex  p1,
const float  t 
)
inlinestatic

Definition at line 713 of file liquify.c.

References t.

Referenced by _draw_paths(), _hit_paths(), button_released(), interpolate_paths(), and point_at_arc_length().

◆ commit_params()

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 
)

Definition at line 1763 of file liquify.c.

References dt_dev_pixelpipe_iop_t::data, and dt_iop_module_t::params_size.

◆ compute_round_stamp_extent()

static void compute_round_stamp_extent ( cairo_rectangle_int_t *const restrict  stamp_extent,
const dt_liquify_warp_t *const restrict  warp 
)
static

Definition at line 907 of file liquify.c.

Referenced by _get_map_extent().

◆ create_global_distortion_map()

static float complex * create_global_distortion_map ( const cairo_rectangle_int_t *  map_extent,
const GSList *  interpolated,
gboolean  inverted 
)
static

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)

Definition at line 347 of file liquify.c.

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

Definition at line 332 of file liquify.c.

References IOP_GROUP_EFFECTS.

◆ description()

const char ** description ( struct dt_iop_module_t self)

Definition at line 322 of file liquify.c.

References dt_iop_set_description().

◆ detect_drag()

static gboolean detect_drag ( const dt_iop_liquify_gui_data_t g,
const double  scale,
const float complex  pt 
)
static

Definition at line 1833 of file liquify.c.

References g, and GET_UI_WIDTH.

Referenced by button_released(), and mouse_moved().

◆ distort_backtransform()

int distort_backtransform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *const restrict  points,
size_t  points_count 
)

Definition at line 1462 of file liquify.c.

References _distort_xtransform(), and FALSE.

◆ distort_mask()

void distort_mask ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
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 
)

◆ distort_paths_raw_to_piece()

static void distort_paths_raw_to_piece ( const struct dt_iop_module_t module,
const dt_dev_pixelpipe_t pipe,
const float  roi_in_scale,
dt_iop_liquify_params_t p,
const gboolean  from_distort_transform 
)
static

Definition at line 684 of file liquify.c.

References _distort_paths(), and p.

Referenced by _distort_xtransform(), build_global_distortion_map(), and modify_roi_in().

◆ distort_transform()

int distort_transform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *const restrict  points,
size_t  points_count 
)

Definition at line 1454 of file liquify.c.

References _distort_xtransform(), and TRUE.

◆ draw_circle()

static void draw_circle ( cairo_t *  cr,
const float complex  pt,
const double  diameter 
)
static

Definition at line 1805 of file liquify.c.

References DT_M_PI, and x.

Referenced by _draw_paths().

◆ draw_paths()

◆ draw_rectangle()

static void draw_rectangle ( cairo_t *  cr,
const float complex  pt,
const double  theta,
const double  size 
)
static

Definition at line 1782 of file liquify.c.

References size, and x.

Referenced by _draw_paths().

◆ draw_triangle()

static void draw_triangle ( cairo_t *  cr,
const float complex  pt,
const double  theta,
const double  size 
)
static

Definition at line 1792 of file liquify.c.

References size, and x.

Referenced by _draw_paths().

◆ dt_conf_get_sanitize_float()

static float dt_conf_get_sanitize_float ( const char *  name,
float  min,
float  max,
float  default_value 
)
static

Definition at line 3154 of file liquify.c.

References dt_conf_get_float(), dt_conf_set_float(), max, min, name(), and value.

Referenced by get_stamp_params().

◆ end_drag()

static void end_drag ( dt_iop_liquify_gui_data_t g)
static

Definition at line 1444 of file liquify.c.

References g, and NOWHERE.

Referenced by button_pressed(), button_released(), and key_pressed().

◆ find_hovered()

static dt_liquify_path_data_t * find_hovered ( dt_iop_liquify_params_t p)
static

Definition at line 2751 of file liquify.c.

References DT_LIQUIFY_PATH_INVALIDATED, k, MAX_NODES, and p.

Referenced by mouse_moved().

◆ find_nearest_on_curve_t()

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

Definition at line 2260 of file liquify.c.

References dist(), i, n, t, and x.

Referenced by _hit_paths(), and button_released().

◆ find_nearest_on_line_t()

static float find_nearest_on_line_t ( const float complex  p0,
const float complex  p1,
const float complex  x 
)
static

Definition at line 2296 of file liquify.c.

References cdot(), and x.

Referenced by _hit_paths(), and button_released().

◆ flags()

int flags ( )

Definition at line 337 of file liquify.c.

References IOP_FLAGS_SUPPORTS_BLENDING.

Referenced by _draw_paths(), _hit_paths(), and _hit_test_paths().

◆ get_arc_length()

static float get_arc_length ( const float complex  points[],
const int  n_points 
)
static

Definition at line 794 of file liquify.c.

References i.

Referenced by interpolate_paths().

◆ get_point_scale()

◆ get_rot()

static float get_rot ( const dt_liquify_warp_type_enum_t  warp_type)
inlinestatic

Definition at line 364 of file liquify.c.

References DT_LIQUIFY_WARP_TYPE_RADIAL_SHRINK, and DT_M_PI_F.

Referenced by _draw_paths().

◆ get_stamp_params()

◆ get_ui_width()

static float get_ui_width ( const float  scale,
const dt_liquify_ui_width_enum_t  w 
)
static

Definition at line 1819 of file liquify.c.

References DT_LIQUIFY_UI_WIDTH_LAST, dt_liquify_ui_widths, and DT_PIXEL_APPLY_DPI.

Referenced by set_line_width().

◆ get_zoom_scale()

static float get_zoom_scale ( const dt_develop_t develop)
static

Definition at line 2821 of file liquify.c.

References dt_dev_get_zoom_scale().

Referenced by get_point_scale(), get_stamp_params(), and gui_post_expose().

◆ gui_cleanup()

void gui_cleanup ( dt_iop_module_t self)

Definition at line 3977 of file liquify.c.

References IOP_GUI_FREE.

◆ gui_focus()

void gui_focus ( struct dt_iop_module_t module,
gboolean  in 
)

◆ gui_init()

◆ gui_post_expose()

◆ gui_reset()

void gui_reset ( dt_iop_module_t self)

Definition at line 3968 of file liquify.c.

References btn_make_radio_callback(), g, dt_iop_module_t::gui_data, and NOWHERE.

◆ gui_update()

void gui_update ( dt_iop_module_t module)

Refresh GUI controls from current params and configuration.

Todo:
check why needed
Todo:
by hand

Definition at line 3888 of file liquify.c.

References g, dt_iop_module_t::gui_data, dt_iop_module_t::params, and update_warp_count().

◆ init()

void init ( dt_iop_module_t module)

Definition at line 1737 of file liquify.c.

◆ init_global()

void init_global ( dt_iop_module_so_t module)

◆ init_pipe()

void init_pipe ( struct dt_iop_module_t module,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

◆ init_warp()

◆ input_format()

◆ interpolate_cubic_bezier()

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

Definition at line 759 of file liquify.c.

References A, B, C, i, n, and t.

Referenced by build_lookup_table(), and interpolate_paths().

◆ interpolate_paths()

◆ is_dragging()

static gboolean is_dragging ( const dt_iop_liquify_gui_data_t g)
static

Definition at line 1449 of file liquify.c.

References g, and IS_NULL_PTR.

Referenced by _draw_paths(), btn_make_radio_callback(), button_pressed(), button_released(), and mouse_moved().

◆ key_pressed()

◆ mitchell()

static float mitchell ( const float  x)
inlinestatic

Definition at line 1559 of file liquify.c.

References x.

Referenced by apply_global_distortion_map_cl().

◆ mix()

static float mix ( const float  a,
const float  b,
const float  t 
)
inlinestatic

◆ mix_warps()

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

◆ modify_roi_in()

◆ modify_roi_out()

void modify_roi_out ( struct dt_iop_module_t module,
const struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece,
dt_iop_roi_t roi_out,
const dt_iop_roi_t roi_in 
)

Definition at line 1293 of file liquify.c.

◆ mouse_moved()

◆ name()

const char * name ( )

Definition at line 317 of file liquify.c.

Referenced by dt_conf_get_sanitize_float().

◆ node_alloc()

static dt_liquify_path_data_t * node_alloc ( dt_iop_liquify_params_t p,
int *  node_index 
)
static

◆ node_delete()

◆ node_gc()

static void node_gc ( dt_iop_liquify_params_t p)
static

Definition at line 419 of file liquify.c.

References DT_LIQUIFY_PATH_INVALIDATED, k, MAX_NODES, and p.

Referenced by node_delete(), and path_delete().

◆ node_get()

static dt_liquify_path_data_t * node_get ( dt_iop_liquify_params_t p,
const int  index 
)
static

Definition at line 394 of file liquify.c.

References MAX_NODES, and p.

Referenced by button_released(), and key_pressed().

◆ node_insert_before()

static void node_insert_before ( dt_iop_liquify_params_t p,
dt_liquify_path_data_t this,
dt_liquify_path_data_t new 
)
static

Definition at line 410 of file liquify.c.

References dt_liquify_path_data_t::header, dt_liquify_path_header_t::next, and p.

Referenced by button_released().

◆ node_next()

static dt_liquify_path_data_t * node_next ( dt_iop_liquify_params_t p,
const dt_liquify_path_data_t n 
)
static

Definition at line 402 of file liquify.c.

References n, and p.

Referenced by mouse_moved(), node_delete(), path_delete(), and smooth_paths_linsys().

◆ node_prev()

◆ normalize()

static float complex normalize ( const float complex  v)
inlinestatic

Definition at line 696 of file liquify.c.

References v.

◆ operation_tags()

int operation_tags ( )

Definition at line 342 of file liquify.c.

References IOP_TAG_DISTORT.

◆ path_delete()

◆ path_length()

static int path_length ( dt_iop_liquify_params_t p,
dt_liquify_path_data_t n 
)
static

Definition at line 2641 of file liquify.c.

References n, and p.

Referenced by smooth_paths_linsys().

◆ point_at_arc_length()

static float complex point_at_arc_length ( const float complex  points[],
const int  n_points,
const float  arc_length,
restart_cookie_t restart 
)
static

Definition at line 815 of file liquify.c.

References cmix(), i, restart_cookie_t::i, IS_NULL_PTR, restart_cookie_t::length, and t.

Referenced by interpolate_paths().

◆ process()

◆ process_cl()

◆ scrolled()

◆ set_line_width()

static void set_line_width ( cairo_t *  cr,
double  scale,
dt_liquify_ui_width_enum_t  w 
)
static

Definition at line 1827 of file liquify.c.

References get_ui_width(), and width.

◆ set_source_rgba()

static void set_source_rgba ( cairo_t *  cr,
dt_liquify_rgba_t  rgba 
)
static

◆ smooth_path_linsys()

static void smooth_path_linsys ( size_t  n,
const float complex *  k,
float complex *  c1,
float complex *  c2,
const int *  equation 
)
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):

\begin{eqnarray}
               2P_{1,i} + P_{1,i+1} &=&  K_i + 2K_{i+1}  \label{1} \\
   P_{1,i-1} + 4P_{1,i} + P_{1,i+1} &=& 4K_i + 2K_{i+1}  \label{2} \\
  2P_{1,i-1} + 7P_{1,i}             &=& 8K_i +  K_{i+1}  \label{3} \\
                P_{1,i}             &=& C1_i             \label{4} \\
                P_{1,i}             &=& C1_i             \label{5} \\
   P_{1,i-1} + 4P_{1,i}             &=& C2_i + 4K_i      \label{6} \\
                P_{1,i}             &=& C1_i             \label{7} \\
               3P_{1,i}             &=& 2K_i +  K_{i+1}  \label{8} \\
               2P_{1,i}             &=&  K_i +  C2_i     \label{9}
\end{eqnarray}

Some of these are the same and differ only in the way we calculate c2. (You may open your eyes again.)

Definition at line 2568 of file liquify.c.

References ABCD, c1, c2, d, dt_free, i, k, m, and n.

Referenced by smooth_paths_linsys().

◆ smooth_paths_linsys()

◆ start_drag()

static void start_drag ( dt_iop_liquify_gui_data_t g,
dt_liquify_layer_enum_t  layer,
dt_liquify_path_data_t elem 
)
static

Definition at line 1438 of file liquify.c.

References g.

Referenced by _start_new_shape(), button_pressed(), button_released(), key_pressed(), and mouse_moved().

◆ sync_pipe()

static void sync_pipe ( struct dt_iop_module_t module,
gboolean  history 
)
static

◆ unselect_all()

static void unselect_all ( dt_iop_liquify_params_t p)
static

Definition at line 2812 of file liquify.c.

References DT_LIQUIFY_PATH_INVALIDATED, k, MAX_NODES, and p.

Referenced by button_released(), and key_pressed().

◆ update_warp_count()

static void update_warp_count ( const dt_iop_liquify_gui_data_t g)
static

Variable Documentation

◆ DT_LIQUIFY_COLOR_HOVER

const dt_liquify_rgba_t DT_LIQUIFY_COLOR_HOVER = { 1.0, 1.0, 1.0, 0.8 }
static

Definition at line 137 of file liquify.c.

Referenced by _draw_paths().

◆ DT_LIQUIFY_COLOR_SELECTED

const dt_liquify_rgba_t DT_LIQUIFY_COLOR_SELECTED = { 1.0, 1.0, 1.0, 1.0 }
static

Definition at line 136 of file liquify.c.

Referenced by _draw_paths().

◆ dt_liquify_layers

dt_liquify_layer_t dt_liquify_layers[]
Initial value:
=
{
{ DT_LIQUIFY_LAYER_BACKGROUND, { 0.0, 0.0, 0.0, 0.8 } , { 0.0, 0.0, 0.0, 0.8 } , 0.0, 0, },
{ DT_LIQUIFY_LAYER_RADIUS, { 0.9, 0.9, 0.0, 1.0 } , { 0.0, 0.0, 0.0, 0.8 } , 0.25, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL, },
{ DT_LIQUIFY_LAYER_HARDNESS1, { 0.9, 0.9, 0.0, 1.0 } , { 0.0, 0.0, 0.0, 0.8 } , 1.0, 0, },
{ DT_LIQUIFY_LAYER_HARDNESS2, { 0.9, 0.9, 0.0, 1.0 } , { 0.0, 0.0, 0.0, 0.8 } , 1.0, 0, },
{ DT_LIQUIFY_LAYER_WARPS, { 0.9, 0.9, 0.0, 1.0 } , { 0.8, 0.8, 0.8, 1.0 } , 0.5, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL, },
{ DT_LIQUIFY_LAYER_PATH, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, },
{ DT_LIQUIFY_LAYER_CTRLPOINT1, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL, },
{ DT_LIQUIFY_LAYER_CTRLPOINT2, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL, },
{ DT_LIQUIFY_LAYER_RADIUSPOINT, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL, },
{ DT_LIQUIFY_LAYER_HARDNESSPOINT1, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL | DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED, },
{ DT_LIQUIFY_LAYER_HARDNESSPOINT2, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL | DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED, },
{ DT_LIQUIFY_LAYER_STRENGTHPOINT, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL, },
{ DT_LIQUIFY_LAYER_CENTERPOINT, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, },
{ DT_LIQUIFY_LAYER_CTRLPOINT1, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, },
{ DT_LIQUIFY_LAYER_CTRLPOINT2, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, },
{ DT_LIQUIFY_LAYER_RADIUSPOINT, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_NODE_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, },
{ DT_LIQUIFY_LAYER_STRENGTHPOINT, { 0.3, 0.3, 0.3, 0.8 } , { 0.8, 0.8, 0.8, 1.0 } , 1.0, DT_LIQUIFY_LAYER_FLAG_ANY_TOOL | DT_LIQUIFY_LAYER_FLAG_HIT_TEST, }
}
@ DT_LIQUIFY_LAYER_FLAG_HIT_TEST
include layer in hit testing
Definition liquify.c:117
@ DT_LIQUIFY_LAYER_FLAG_ANY_TOOL
Definition liquify.c:124
@ DT_LIQUIFY_LAYER_FLAG_NODE_SELECTED
show if node is selected
Definition liquify.c:119
@ DT_LIQUIFY_LAYER_FLAG_NODE_TOOL
show if node tool active
Definition liquify.c:123
@ DT_LIQUIFY_LAYER_STRENGTHPOINT
Definition liquify.c:111
@ DT_LIQUIFY_LAYER_HARDNESSPOINT1
Definition liquify.c:109
@ DT_LIQUIFY_LAYER_HARDNESSPOINT2
Definition liquify.c:110
@ DT_LIQUIFY_LAYER_CTRLPOINT1
Definition liquify.c:106
@ DT_LIQUIFY_LAYER_PATH
Definition liquify.c:98
@ DT_LIQUIFY_LAYER_HARDNESS2
Definition liquify.c:96
@ DT_LIQUIFY_LAYER_HARDNESS1
Definition liquify.c:95
@ DT_LIQUIFY_LAYER_RADIUSPOINT
Definition liquify.c:108
@ DT_LIQUIFY_LAYER_RADIUS
Definition liquify.c:94
@ DT_LIQUIFY_LAYER_WARPS
Definition liquify.c:97
@ DT_LIQUIFY_LAYER_CTRLPOINT2
Definition liquify.c:107
@ DT_LIQUIFY_LAYER_CENTERPOINT
Definition liquify.c:105
@ DT_LIQUIFY_LAYER_BACKGROUND
Definition liquify.c:93

Definition at line 151 of file liquify.c.

Referenced by _draw_paths(), _hit_paths(), _hit_test_paths(), draw_paths(), gui_init(), and mouse_moved().

◆ dt_liquify_ui_widths

float dt_liquify_ui_widths[]
Initial value:
=
{
2.0,
3.0,
3.0,
9.0,
7.0,
100.0,
50.0,
3.0
}

Definition at line 187 of file liquify.c.

Referenced by get_ui_width().

◆ INTERPOLATION_POINTS

const int INTERPOLATION_POINTS = 100

Definition at line 82 of file liquify.c.

Referenced by _hit_paths(), button_released(), and interpolate_paths().

◆ LOOKUP_OVERSAMPLE

const int LOOKUP_OVERSAMPLE = 10

Definition at line 81 of file liquify.c.

Referenced by build_round_stamp().

◆ NOWHERE

◆ STAMP_RELOCATION

const float STAMP_RELOCATION = 0.1

Definition at line 83 of file liquify.c.

Referenced by build_round_stamp(), and interpolate_paths().