![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"#include "common/debug.h"#include "common/imagebuf.h"#include "common/interpolation.h"#include "common/math.h"#include "common/opencl.h"#include "control/conf.h"#include "control/control.h"#include "develop/develop.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "dtgtk/expander.h"#include "gui/draw.h"#include "gui/gtk.h"#include "gui/guides.h"#include "gui/presets.h"#include "iop/iop_api.h"#include "libs/modulegroups.h"#include <assert.h>#include <gdk/gdkkeysyms.h>#include <gtk/gtk.h>#include <inttypes.h>#include <stdlib.h>#include <string.h>
Include dependency graph for crop.c:Data Structures | |
| struct | dt_iop_crop_aspect_t |
| struct | dt_iop_crop_params_t |
| struct | dt_iop_crop_gui_data_t |
| struct | dt_iop_crop_data_t |
Typedefs | |
| typedef enum dt_iop_crop_flip_t | dt_iop_crop_flip_t |
| typedef struct dt_iop_crop_aspect_t | dt_iop_crop_aspect_t |
| typedef struct dt_iop_crop_params_t | dt_iop_crop_params_t |
| typedef enum _grab_region_t | _grab_region_t |
| typedef struct dt_iop_crop_gui_data_t | dt_iop_crop_gui_data_t |
| typedef struct dt_iop_crop_data_t | dt_iop_crop_data_t |
Enumerations | |
| enum | dt_iop_crop_flip_t { FLAG_FLIP_HORIZONTAL = 1 << 0 , FLAG_FLIP_VERTICAL = 1 << 1 } |
| enum | _grab_region_t { GRAB_CENTER = 0 , GRAB_LEFT = 1 << 0 , GRAB_TOP = 1 << 1 , GRAB_RIGHT = 1 << 2 , GRAB_BOTTOM = 1 << 3 , GRAB_TOP_LEFT = GRAB_TOP | GRAB_LEFT , GRAB_TOP_RIGHT = GRAB_TOP | GRAB_RIGHT , GRAB_BOTTOM_RIGHT = GRAB_BOTTOM | GRAB_RIGHT , GRAB_BOTTOM_LEFT = GRAB_BOTTOM | GRAB_LEFT , GRAB_HORIZONTAL = GRAB_LEFT | GRAB_RIGHT , GRAB_VERTICAL = GRAB_TOP | GRAB_BOTTOM , GRAB_ALL = GRAB_LEFT | GRAB_TOP | GRAB_RIGHT | GRAB_BOTTOM , GRAB_NONE = 1 << 4 } |
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 * | aliases () |
| const char ** | description (struct dt_iop_module_t *self) |
| int | default_group () |
| int | flags () |
| int | operation_tags () |
| int | operation_tags_filter () |
| int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| static void | _params_to_gui (dt_iop_crop_params_t *p, dt_iop_crop_gui_data_t *g) |
| static void | _commit_box (dt_iop_module_t *self, dt_iop_crop_gui_data_t *g, dt_iop_crop_params_t *p) |
| static gboolean | _set_max_clip (struct dt_iop_module_t *self) |
| this function initializes the maximum clip rectangle from crop parameters and correct the clip rectangle accordingly in gui. | |
| 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 | modify_roi_out (struct dt_iop_module_t *self, 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, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_out, dt_iop_roi_t *roi_in) |
| void | process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out) |
| 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) |
| static float | _aspect_ratio_get (dt_iop_module_t *self, GtkWidget *combo) |
| static void | _aspect_apply (dt_iop_module_t *self, _grab_region_t grab) |
| void | reload_defaults (dt_iop_module_t *self) |
| gboolean | has_defaults (struct dt_iop_module_t *self) |
| static void | _float_to_fract (const char *num, int *n, int *d) |
| static void | _event_aspect_presets_changed (GtkWidget *combo, dt_iop_module_t *self) |
| void | gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous) |
| void | gui_reset (struct dt_iop_module_t *self) |
| void | gui_update (struct dt_iop_module_t *self) |
| static void | _event_key_swap (dt_iop_module_t *self) |
| static void | _enter_edit_mode (GtkToggleButton *button, struct dt_iop_module_t *self) |
| static void | _event_commit_clicked (GtkButton *button, dt_iop_module_t *self) |
| static void | _event_aspect_flip (GtkWidget *button, dt_iop_module_t *self) |
| static gint | _aspect_ratio_cmp (const dt_iop_crop_aspect_t *a, const dt_iop_crop_aspect_t *b) |
| static gchar * | _aspect_format (gchar *original, int adim, int bdim) |
| void | gui_init (struct dt_iop_module_t *self) |
| static void | _aspect_free (gpointer data) |
| void | gui_cleanup (struct dt_iop_module_t *self) |
| static _grab_region_t | _gui_get_grab (float pzx, float pzy, dt_iop_crop_gui_data_t *g, const float border, const float wd, const float ht) |
| void | gui_post_expose (struct dt_iop_module_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery) |
| int | mouse_moved (struct dt_iop_module_t *self, double x, double y, double pressure, int which) |
| int | button_released (struct dt_iop_module_t *self, double x, double y, int which, uint32_t state) |
| int | button_pressed (struct dt_iop_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state) |
| int | mouse_leave (struct dt_iop_module_t *self) |
| typedef enum _grab_region_t _grab_region_t |
| typedef struct dt_iop_crop_aspect_t dt_iop_crop_aspect_t |
| typedef struct dt_iop_crop_data_t dt_iop_crop_data_t |
| typedef enum dt_iop_crop_flip_t dt_iop_crop_flip_t |
flip guides H/V
| typedef struct dt_iop_crop_gui_data_t dt_iop_crop_gui_data_t |
| typedef struct dt_iop_crop_params_t dt_iop_crop_params_t |
| enum _grab_region_t |
| enum dt_iop_crop_flip_t |
|
static |
References _aspect_ratio_get(), darktable, darktable_t::develop, double(), dt_dev_get_processed_size(), GRAB_BOTTOM_LEFT, GRAB_BOTTOM_RIGHT, GRAB_HORIZONTAL, GRAB_LEFT, GRAB_NONE, GRAB_TOP, GRAB_TOP_LEFT, GRAB_TOP_RIGHT, GRAB_VERTICAL, dt_iop_module_t::gui_data, MAX, and MIN.
Referenced by _event_key_swap(), button_pressed(), gui_changed(), gui_post_expose(), and mouse_moved().
|
static |
Referenced by gui_init().
|
static |
References dt_iop_crop_aspect_t::name.
Referenced by gui_cleanup().
|
static |
References dt_iop_crop_aspect_t::d, MAX, MIN, and dt_iop_crop_aspect_t::n.
Referenced by gui_init().
|
static |
References dt_dev_pixelpipe_iop_t::buf_in, darktable, dt_iop_module_t::dev, darktable_t::develop, dt_bauhaus_combobox_get_text(), dt_dev_distort_get_iop_pipe(), dt_dev_get_processed_size(), dt_interpolation_new(), DT_INTERPOLATION_USERPREF_WARP, dt_iop_roi_t::height, MAX, MIN, dt_iop_module_t::params, PHI, dt_develop_t::preview_pipe, dt_interpolation::width, and dt_iop_roi_t::width.
Referenced by _aspect_apply(), and gui_update().
|
static |
References dt_dev_pixelpipe_iop_t::buf_out, CLAMPF, dt_iop_module_t::dev, dt_dev_distort_backtransform_plus(), dt_dev_distort_get_iop_pipe(), DT_DEV_TRANSFORM_DIR_FORW_EXCL, dt_iop_roi_t::height, dt_iop_module_t::iop_order, dt_develop_t::preview_pipe, and dt_iop_roi_t::width.
Referenced by gui_changed().
|
static |
References _params_to_gui(), dt_iop_module_t::dev, dt_control_change_cursor(), dt_control_navigation_redraw(), dt_control_queue_redraw_center(), dt_dev_add_history_item, dt_dev_invalidate_all, dt_dev_refresh_ui_images, dt_iop_request_focus(), dt_iop_module_t::enabled, FALSE, GRAB_CENTER, GRAB_NONE, gui_changed(), dt_iop_module_t::gui_data, dt_iop_module_t::params, and TRUE.
Referenced by _event_commit_clicked(), and gui_init().
|
static |
References _event_key_swap().
Referenced by gui_init().
|
static |
References _float_to_fract(), dt_iop_crop_aspect_t::d, darktable, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_get_text(), dt_bauhaus_combobox_set(), dt_bauhaus_combobox_set_text(), dt_conf_set_int(), dt_control_log(), darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, MAX, MIN, dt_iop_crop_aspect_t::n, dt_iop_crop_aspect_t::name, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by gui_init(), and gui_update().
|
static |
References _enter_edit_mode(), darktable, darktable_t::develop, dt_dev_add_history_item, FALSE, dt_iop_module_t::gui_data, and TRUE.
Referenced by gui_init().
|
static |
References _aspect_apply(), GRAB_ALL, gui_changed(), and dt_iop_module_t::params.
Referenced by _event_aspect_flip().
|
static |
Referenced by _event_aspect_presets_changed().
|
static |
References GRAB_BOTTOM, GRAB_CENTER, GRAB_LEFT, GRAB_NONE, GRAB_RIGHT, and GRAB_TOP.
Referenced by button_pressed(), gui_post_expose(), and mouse_moved().
|
static |
Referenced by _enter_edit_mode(), and gui_update().
|
static |
this function initializes the maximum clip rectangle from crop parameters and correct the clip rectangle accordingly in gui.
WARNING: this function assumes that the current gui modification are committed to params.
| self | the current module data |
References dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, dt_dev_pixelpipe_iop_t::buf_out, dt_iop_module_t::dev, dt_dev_distort_get_iop_pipe(), dt_dev_distort_transform_plus(), DT_DEV_PIXELPIPE_VALID, DT_DEV_TRANSFORM_DIR_FORW_EXCL, FALSE, dt_iop_module_t::gui_data, dt_iop_roi_t::height, dt_iop_module_t::iop_order, dt_iop_module_t::params, dt_develop_t::preview_pipe, dt_dev_pixelpipe_t::status, TRUE, and dt_iop_roi_t::width.
Referenced by gui_post_expose(), and mouse_moved().
| const char * aliases | ( | ) |
| int button_pressed | ( | struct dt_iop_module_t * | self, |
| double | x, | ||
| double | y, | ||
| double | pressure, | ||
| int | which, | ||
| int | type, | ||
| uint32_t | state | ||
| ) |
References _aspect_apply(), _gui_get_grab(), dt_iop_module_t::dev, dt_dev_get_pointer_full_pos(), dt_modifiers_include(), DT_PIXEL_APPLY_DPI, GRAB_ALL, GRAB_BOTTOM, GRAB_BOTTOM_RIGHT, GRAB_CENTER, GRAB_LEFT, GRAB_NONE, GRAB_RIGHT, GRAB_TOP, dt_iop_module_t::gui_data, dt_develop_t::scaling, TRUE, and type.
| int button_released | ( | struct dt_iop_module_t * | self, |
| double | x, | ||
| double | y, | ||
| int | which, | ||
| uint32_t | state | ||
| ) |
References dt_control_change_cursor(), FALSE, GRAB_CENTER, gui_changed(), and dt_iop_module_t::gui_data.
| void cleanup_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References dt_dev_pixelpipe_iop_t::data.
| 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 | ||
| ) |
| 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().
| 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 | ||
| ) |
References dt_iop_copy_image_roi(), and TRUE.
| int distort_transform | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_iop_t * | piece, | ||
| float *const restrict | points, | ||
| size_t | points_count | ||
| ) |
| int flags | ( | ) |
| void gui_changed | ( | dt_iop_module_t * | self, |
| GtkWidget * | w, | ||
| void * | previous | ||
| ) |
References _aspect_apply(), _commit_box(), darktable, dt_bauhaus_slider_set(), dt_bauhaus_slider_set_soft_max(), dt_bauhaus_slider_set_soft_min(), dt_control_navigation_redraw(), dt_control_queue_redraw_center(), GRAB_ALL, GRAB_BOTTOM, GRAB_LEFT, GRAB_RIGHT, GRAB_TOP, darktable_t::gui, dt_iop_module_t::gui_data, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by _enter_edit_mode(), _event_aspect_presets_changed(), _event_key_swap(), button_released(), and mouse_moved().
| void gui_cleanup | ( | struct dt_iop_module_t * | self | ) |
References _aspect_free(), dt_iop_module_t::gui_data, and IOP_GUI_FREE.
| void gui_init | ( | struct dt_iop_module_t * | self | ) |
References _aspect_format(), _aspect_ratio_cmp(), _enter_edit_mode(), _event_aspect_flip(), _event_aspect_presets_changed(), _event_commit_clicked(), darktable_t::bauhaus, dt_iop_crop_aspect_t::d, darktable, dt_action_button_new(), dt_bauhaus_combobox_add(), dt_bauhaus_combobox_new(), dt_bauhaus_combobox_set(), dt_bauhaus_combobox_set_editable(), dt_bauhaus_slider_from_params(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), dt_bauhaus_slider_set_offset(), DT_BAUHAUS_SPACE, dt_bauhaus_widget_set_label(), dt_bauhaus_widget_set_quad_paint(), dt_bauhaus_widget_set_quad_toggle(), dt_conf_all_string_entries(), dt_conf_string_entry_free(), dt_control_log(), DT_GUI_MODULE, dt_gui_new_collapsible_section(), dtgtk_cairo_paint_aspectflip(), FALSE, GRAB_CENTER, IOP_GUI_ALLOC, dt_conf_string_entry_t::key, MAX, MIN, dt_iop_crop_aspect_t::n, dt_iop_crop_aspect_t::name, name(), TRUE, dt_conf_string_entry_t::value, and dt_iop_module_t::widget.
| void gui_post_expose | ( | struct dt_iop_module_t * | self, |
| cairo_t * | cr, | ||
| int32_t | width, | ||
| int32_t | height, | ||
| int32_t | pointerx, | ||
| int32_t | pointery | ||
| ) |
References _aspect_apply(), _gui_get_grab(), _set_max_clip(), dt_dev_pixelpipe_t::backbuf_height, dt_dev_pixelpipe_t::backbuf_width, darktable_t::bauhaus, dt_control_t::button_down, dt_control_t::button_down_which, CLAMPF, darktable_t::control, darktable, dt_iop_module_t::dev, dt_dev_clip_roi(), dt_dev_get_pointer_full_pos(), dt_dev_get_processed_size(), dt_dev_rescale_roi(), dt_draw_set_color_overlay(), dt_gui_draw_rounded_rectangle(), dt_guides_draw(), DT_PIXEL_APPLY_DPI, FALSE, GRAB_BOTTOM, GRAB_BOTTOM_LEFT, GRAB_BOTTOM_RIGHT, GRAB_HORIZONTAL, GRAB_LEFT, GRAB_RIGHT, GRAB_TOP, GRAB_TOP_LEFT, GRAB_TOP_RIGHT, dt_iop_module_t::gui_data, height, dt_bauhaus_t::pango_font_desc, dt_develop_t::preview_pipe, dt_develop_t::scaling, TRUE, and width.
| void gui_reset | ( | struct dt_iop_module_t * | self | ) |
References dt_conf_set_int().
| void gui_update | ( | struct dt_iop_module_t * | self | ) |
References _aspect_ratio_get(), _event_aspect_presets_changed(), _params_to_gui(), dt_iop_crop_aspect_t::d, dt_bauhaus_combobox_get(), dt_bauhaus_combobox_set(), dt_bauhaus_combobox_set_text(), dt_conf_get_int(), dt_gui_update_collapsible_section(), dt_iop_module_t::gui_data, dt_iop_crop_aspect_t::n, and dt_iop_module_t::params.
| gboolean has_defaults | ( | struct dt_iop_module_t * | self | ) |
| void init_pipe | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
References dt_dev_pixelpipe_iop_t::data, and dt_dev_pixelpipe_iop_t::data_size.
| int legacy_params | ( | dt_iop_module_t * | self, |
| const void *const | old_params, | ||
| const int | old_version, | ||
| void * | new_params, | ||
| const int | new_version | ||
| ) |
| void modify_roi_in | ( | struct dt_iop_module_t * | self, |
| 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 * | self, |
| struct dt_dev_pixelpipe_iop_t * | piece, | ||
| dt_iop_roi_t * | roi_out, | ||
| const dt_iop_roi_t * | roi_in | ||
| ) |
| int mouse_leave | ( | struct dt_iop_module_t * | self | ) |
References dt_control_change_cursor(), FALSE, GRAB_NONE, and dt_iop_module_t::gui_data.
| int mouse_moved | ( | struct dt_iop_module_t * | self, |
| double | x, | ||
| double | y, | ||
| double | pressure, | ||
| int | which | ||
| ) |
References _aspect_apply(), _gui_get_grab(), _set_max_clip(), darktable_t::control, darktable, dt_iop_module_t::dev, dt_control_change_cursor(), dt_control_hinter_message(), dt_control_queue_redraw_center(), dt_dev_get_pointer_full_pos(), DT_PIXEL_APPLY_DPI, GRAB_ALL, GRAB_BOTTOM, GRAB_BOTTOM_LEFT, GRAB_BOTTOM_RIGHT, GRAB_CENTER, GRAB_LEFT, GRAB_NONE, GRAB_RIGHT, GRAB_TOP, GRAB_TOP_LEFT, GRAB_TOP_RIGHT, gui_changed(), dt_iop_module_t::gui_data, and dt_develop_t::scaling.
| const char * name | ( | ) |
Referenced by gui_init().
| int operation_tags | ( | ) |
References IOP_TAG_CLIPPING, and IOP_TAG_DISTORT.
| int operation_tags_filter | ( | ) |
References IOP_TAG_DECORATION.
| void process | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_iop_t * | piece, | ||
| const void *const | ivoid, | ||
| void *const | ovoid, | ||
| const dt_iop_roi_t *const | roi_in, | ||
| const dt_iop_roi_t *const | roi_out | ||
| ) |
References dt_iop_copy_image_roi(), and TRUE.
| void reload_defaults | ( | dt_iop_module_t * | self | ) |