![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "widgets/bauhaus.h"#include "system/openmp.h"#include "system/target_clones.h"#include "system/mem_alloc.h"#include "system/simd.h"#include "common/logging.h"#include "common/module_versioning.h"#include "common/imagebuf.h"#include "common/opencl.h"#include "develop/develop.h"#include "develop/geometry/geometry.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "gui/color_picker_proxy.h"#include "gui/presets.h"#include "iop/iop_api.h"#include <gdk/gdkkeysyms.h>#include <gtk/gtk.h>#include <inttypes.h>#include <math.h>#include <stdlib.h>#include <string.h>
Include dependency graph for borders.c:Go to the source code of this file.
Data Structures | |
| struct | dt_iop_borders_params_t |
| struct | dt_iop_borders_gui_data_t |
| struct | dt_iop_borders_global_data_t |
| struct | border_positions_t |
Macros | |
| #define | DT_IOP_BORDERS_ASPECT_COUNT 12 |
| #define | DT_IOP_BORDERS_ASPECT_IMAGE_IDX 0 |
| #define | DT_IOP_BORDERS_ASPECT_CONSTANT_IDX 11 |
| #define | DT_IOP_BORDERS_ASPECT_IMAGE_VALUE 0.0f |
| #define | DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE -1.0f |
| #define | DT_IOP_BORDERS_ASPECT_ORIENTATION_AUTO 0 |
| #define | DT_IOP_BORDERS_ASPECT_ORIENTATION_PORTRAIT 1 |
| #define | DT_IOP_BORDERS_ASPECT_ORIENTATION_LANDSCAPE 2 |
| #define | DT_IOP_BORDERS_POSITION_H_COUNT 5 |
| #define | DT_IOP_BORDERS_POSITION_V_COUNT 5 |
Typedefs | |
| typedef struct dt_iop_borders_params_t | dt_iop_borders_params_t |
| typedef struct dt_iop_borders_gui_data_t | dt_iop_borders_gui_data_t |
| typedef struct dt_iop_borders_global_data_t | dt_iop_borders_global_data_t |
| typedef struct dt_iop_borders_params_t | dt_iop_borders_data_t |
Functions | |
| int | legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version) |
| const char * | name () |
| const char ** | description (struct dt_iop_module_t *self) |
| int | default_group () |
| int | operation_tags () |
| int | flags () |
| int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece) |
| static void | _borders_offset (const dt_iop_borders_data_t *const d, const dt_iop_roi_t *const in, const dt_iop_roi_t *const out, int *left, int *top) |
| The translation the border applies, from the two rects it sits between. | |
| 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) |
| static void | _borders_map_size (const dt_iop_borders_data_t *const d, const dt_iop_roi_t *const roi_in, dt_iop_roi_t *roi_out) |
| Input rect -> output rect. THE size evaluator: modify_roi_out() below and the geometry record both call it, so the frame the pipe renders and the frame the GUI measures are the same frame. | |
| void | modify_roi_out (struct dt_iop_module_t *self, 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 *self, 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 void | set_pixels (float *buf, const dt_aligned_pixel_t color, const int npixels) |
| static void | copy_pixels (float *out, const float *const in, const int npixels) |
| __DT_CLONE_TARGETS__ void | copy_image_with_border (float *out, const float *const in, const struct border_positions_t *binfo) |
| int | process (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid) |
| int | process_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out) |
| void | init_global (dt_iop_module_so_t *module) |
| void | cleanup_global (dt_iop_module_so_t *module) |
| static void | _borders_geometry_map_size (const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out) |
| static int | _borders_geometry_transform (const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count) |
| static int | _borders_geometry_backtransform (const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count) |
| gboolean | geometry_record (dt_iop_module_t *self, const void *params, dt_geometry_record_t *record) |
| void | commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | init_presets (dt_iop_module_so_t *self) |
| void | color_picker_apply (dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| static void | aspect_changed (GtkWidget *combo, dt_iop_module_t *self) |
| static void | position_h_changed (GtkWidget *combo, dt_iop_module_t *self) |
| static void | position_v_changed (GtkWidget *combo, dt_iop_module_t *self) |
| void | gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous) |
| static void | colorpick_color_set (GtkColorButton *widget, dt_iop_module_t *self) |
| static void | frame_colorpick_color_set (GtkColorButton *widget, dt_iop_module_t *self) |
| void | gui_update (struct dt_iop_module_t *self) |
| static void | gui_init_aspect (struct dt_iop_module_t *self) |
| static void | gui_init_positions (struct dt_iop_module_t *self) |
| void | gui_init (struct dt_iop_module_t *self) |
| void | init (dt_iop_module_t *self) |
Variables | |
| static const dt_geometry_vtable_t | _borders_geometry_vtable |
| typedef struct dt_iop_borders_params_t dt_iop_borders_data_t |
| typedef struct dt_iop_borders_global_data_t dt_iop_borders_global_data_t |
| typedef struct dt_iop_borders_gui_data_t dt_iop_borders_gui_data_t |
| typedef struct dt_iop_borders_params_t dt_iop_borders_params_t |
|
static |
Definition at line 742 of file borders.c.
References _borders_offset(), i, dt_geometry_record_t::in, dt_geometry_record_t::out, and top.
|
static |
Definition at line 723 of file borders.c.
References _borders_map_size(), and out.
|
static |
Definition at line 728 of file borders.c.
References _borders_offset(), i, dt_geometry_record_t::in, dt_geometry_record_t::out, and top.
|
static |
Input rect -> output rect. THE size evaluator: modify_roi_out() below and the geometry record both call it, so the frame the pipe renders and the frame the GUI measures are the same frame.
Definition at line 330 of file borders.c.
References dt_iop_borders_params_t::aspect, d, DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE, DT_IOP_BORDERS_ASPECT_IMAGE_VALUE, DT_IOP_BORDERS_ASPECT_ORIENTATION_AUTO, DT_IOP_BORDERS_ASPECT_ORIENTATION_LANDSCAPE, DT_IOP_BORDERS_ASPECT_ORIENTATION_PORTRAIT, dt_iop_roi_t::height, size, and dt_iop_roi_t::width.
Referenced by _borders_geometry_map_size(), and modify_roi_out().
|
static |
The translation the border applies, from the two rects it sits between.
Definition at line 252 of file borders.c.
References d, dt_iop_roi_t::height, out, top, and dt_iop_roi_t::width.
Referenced by _borders_geometry_backtransform(), _borders_geometry_transform(), distort_backtransform(), and distort_transform().
|
static |
Definition at line 864 of file borders.c.
References dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_get_text(), dt_bauhaus_combobox_length(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, DT_IOP_BORDERS_ASPECT_COUNT, dt_iop_color_picker_reset(), dt_iop_gui_data(), g, p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
| void cleanup_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 713 of file borders.c.
References dt_iop_module_so_t::data, dt_free, dt_opencl_free_kernel(), and dt_iop_borders_global_data_t::kernel_borders_fill.
| void cleanup_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 790 of file borders.c.
References dt_dev_pixelpipe_iop_t::data, and dt_free_align.
| void color_picker_apply | ( | dt_iop_module_t * | self, |
| GtkWidget * | picker, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 820 of file borders.c.
References dt_iop_module_t::dev, dt_dev_add_history_item, dt_iop_gui_data(), g, p, dt_iop_module_t::params, dt_iop_module_t::picked_color, and TRUE.
|
static |
Definition at line 948 of file borders.c.
References dt_iop_module_t::dev, dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
| void commit_params | ( | struct dt_iop_module_t * | self, |
| dt_iop_params_t * | p1, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 776 of file borders.c.
References d, dt_dev_pixelpipe_iop_t::data, and p.
| __DT_CLONE_TARGETS__ void copy_image_with_border | ( | float * | out, |
| const float *const | in, | ||
| const struct border_positions_t * | binfo | ||
| ) |
Definition at line 464 of file borders.c.
References __OMP_PARALLEL_FOR__, border_positions_t::bcolor, border_positions_t::border_bot, border_positions_t::border_left, border_positions_t::border_right, copy_pixels(), border_positions_t::fl_bot, border_positions_t::fl_left, border_positions_t::fl_right, border_positions_t::flcolor, border_positions_t::height, border_positions_t::image_bot, border_positions_t::image_left, border_positions_t::image_right, border_positions_t::image_top, out, row, set_pixels(), border_positions_t::stride, and border_positions_t::width.
Referenced by process().
|
inlinestatic |
Definition at line 451 of file borders.c.
References __OMP_SIMD__, i, and out.
Referenced by copy_image_with_border().
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 238 of file borders.c.
References IOP_CS_RGB.
| int default_group | ( | ) |
Definition at line 223 of file borders.c.
References IOP_GROUP_EFFECTS.
| const char ** description | ( | struct dt_iop_module_t * | self | ) |
Definition at line 213 of file borders.c.
References dt_iop_set_description().
| 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 278 of file borders.c.
References __OMP_PARALLEL_FOR_SIMD__, _borders_offset(), dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, d, dt_dev_pixelpipe_iop_t::data, and i.
| 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 | ||
| ) |
Definition at line 298 of file borders.c.
References __OMP_PARALLEL_FOR__, dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, d, dt_dev_pixelpipe_iop_t::data, dt_iop_image_fill(), dt_iop_roi_t::height, MAX, out, dt_iop_roi_t::scale, void(), dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| 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 259 of file borders.c.
References __OMP_PARALLEL_FOR_SIMD__, _borders_offset(), dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, d, dt_dev_pixelpipe_iop_t::data, and i.
| int flags | ( | ) |
Definition at line 233 of file borders.c.
References IOP_FLAGS_ALLOW_TILING, and IOP_FLAGS_TILING_FULL_ROI.
|
static |
Definition at line 966 of file borders.c.
References dt_iop_module_t::dev, dt_dev_add_history_item, dt_gui_widgets_suppressed(), dt_iop_color_picker_reset(), p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
| gboolean geometry_record | ( | dt_iop_module_t * | self, |
| const void * | params, | ||
| dt_geometry_record_t * | record | ||
| ) |
Definition at line 762 of file borders.c.
References _borders_geometry_vtable, dt_geometry_record_t::data, dt_free_gpointer(), FALSE, dt_geometry_record_t::free_data, IS_NULL_PTR, TRUE, and dt_geometry_record_t::vtable.
| void gui_changed | ( | dt_iop_module_t * | self, |
| GtkWidget * | w, | ||
| void * | previous | ||
| ) |
Definition at line 930 of file borders.c.
References dt_bauhaus_combobox_set(), DT_IOP_BORDERS_ASPECT_COUNT, DT_IOP_BORDERS_POSITION_H_COUNT, DT_IOP_BORDERS_POSITION_V_COUNT, dt_iop_gui_data(), and g.
| void gui_init | ( | struct dt_iop_module_t * | self | ) |
Definition at line 1107 of file borders.c.
References aspect_changed(), color, colorpick_color_set(), dt_iop_module_t::default_params, dt_bauhaus_combobox_add(), dt_bauhaus_combobox_from_params(), dt_bauhaus_combobox_new(), dt_bauhaus_combobox_set_editable(), dt_bauhaus_get_global(), dt_bauhaus_slider_from_params(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_format(), dt_bauhaus_widget_set_label(), dt_color_picker_new(), DT_COLOR_PICKER_POINT, DT_GUI_BOX_SPACING, DT_GUI_MODULE, dt_iop_gui_reset_label_new(), FALSE, frame_colorpick_color_set(), g, dt_iop_module_t::gui, gui_init_aspect(), gui_init_positions(), IOP_GUI_ALLOC, p, position_h_changed(), position_v_changed(), TRUE, and dt_iop_module_gui_t::widget.
|
static |
Definition at line 1043 of file borders.c.
References dt_bauhaus_combobox_add(), DT_IOP_BORDERS_ASPECT_CONSTANT_IDX, DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE, DT_IOP_BORDERS_ASPECT_IMAGE_IDX, DT_IOP_BORDERS_ASPECT_IMAGE_VALUE, dt_iop_gui_data(), g, i, and PHI.
Referenced by gui_init().
|
static |
Definition at line 1076 of file borders.c.
References dt_bauhaus_combobox_add(), dt_iop_gui_data(), g, and i.
Referenced by gui_init().
| void gui_update | ( | struct dt_iop_module_t * | self | ) |
Definition at line 983 of file borders.c.
References dt_bauhaus_combobox_set(), DT_IOP_BORDERS_ASPECT_COUNT, DT_IOP_BORDERS_POSITION_H_COUNT, DT_IOP_BORDERS_POSITION_V_COUNT, dt_iop_gui_data(), fc, g, k, p, and dt_iop_module_t::params.
| void init | ( | dt_iop_module_t * | self | ) |
Definition at line 1195 of file borders.c.
References dt_iop_borders_params_t::aspect_text, dt_iop_module_t::default_params, dt_iop_default_init(), dt_iop_borders_params_t::pos_h_text, and dt_iop_borders_params_t::pos_v_text.
| void init_global | ( | dt_iop_module_so_t * | module | ) |
Definition at line 703 of file borders.c.
References dt_opencl_create_kernel(), and dt_iop_borders_global_data_t::kernel_borders_fill.
| void init_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 784 of file borders.c.
References dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
| void init_presets | ( | dt_iop_module_so_t * | self | ) |
Definition at line 796 of file borders.c.
References dt_gui_presets_add_generic(), dt_iop_module_so_t::op, p, and TRUE.
| int legacy_params | ( | dt_iop_module_t * | self, |
| const void *const | old_params, | ||
| const int | old_version, | ||
| void * | new_params, | ||
| const int | new_version | ||
| ) |
Definition at line 143 of file borders.c.
References color, d, dt_iop_module_t::default_params, DT_IOP_BORDERS_ASPECT_ORIENTATION_LANDSCAPE, DT_IOP_BORDERS_ASPECT_ORIENTATION_PORTRAIT, FALSE, n, and size.
| void modify_roi_in | ( | struct dt_iop_module_t * | self, |
| 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 | ||
| ) |
Definition at line 388 of file borders.c.
References dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, d, dt_dev_pixelpipe_iop_t::data, dt_iop_roi_t::height, MAX, MIN, dt_iop_roi_t::scale, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| void modify_roi_out | ( | struct dt_iop_module_t * | self, |
| 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 380 of file borders.c.
References _borders_map_size(), and dt_dev_pixelpipe_iop_t::data.
| int operation_tags | ( | ) |
Definition at line 228 of file borders.c.
References IOP_TAG_DECORATION, and IOP_TAG_DISTORT.
|
static |
Definition at line 886 of file borders.c.
References dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_get_text(), dt_bauhaus_combobox_length(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, DT_IOP_BORDERS_POSITION_H_COUNT, dt_iop_color_picker_reset(), dt_iop_gui_data(), g, p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
|
static |
Definition at line 908 of file borders.c.
References dt_iop_module_t::dev, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_get_text(), dt_bauhaus_combobox_length(), dt_bauhaus_slider_set(), dt_dev_add_history_item, dt_gui_freeze_begin, dt_gui_freeze_end, DT_IOP_BORDERS_POSITION_V_COUNT, dt_iop_color_picker_reset(), dt_iop_gui_data(), g, p, dt_iop_module_t::params, and TRUE.
Referenced by gui_init().
| int process | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| const void *const | ivoid, | ||
| void *const | ovoid | ||
| ) |
Definition at line 518 of file borders.c.
References border_positions_t::bcolor, border_positions_t::border_bot, border_positions_t::border_left, border_positions_t::border_right, border_positions_t::border_top, dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, copy_image_with_border(), d, dt_dev_pixelpipe_iop_t::data, border_positions_t::fl_bot, border_positions_t::fl_left, border_positions_t::fl_right, border_positions_t::fl_top, dt_iop_roi_t::height, MAX, MIN, ovoid, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, dt_iop_roi_t::scale, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| int process_cl | ( | struct dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| cl_mem | dev_in, | ||
| cl_mem | dev_out | ||
| ) |
Definition at line 597 of file borders.c.
References dt_dev_pixelpipe_iop_t::buf_in, dt_dev_pixelpipe_iop_t::buf_out, d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::devid, DT_DEBUG_OPENCL, dt_opencl_enqueue_copy_image(), dt_opencl_enqueue_kernel_2d(), dt_opencl_set_kernel_arg(), dt_print(), error(), FALSE, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, dt_iop_borders_global_data_t::kernel_borders_fill, MAX, MIN, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, ROUNDUPDHT, ROUNDUPDWD, dt_iop_roi_t::scale, TRUE, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
|
inlinestatic |
Definition at line 438 of file borders.c.
References __OMP_SIMD__, color, and i.
Referenced by copy_image_with_border().
|
static |
Definition at line 756 of file borders.c.
Referenced by geometry_record().