![]() |
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 } |
| 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(), g, 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_free, and dt_iop_crop_aspect_t::name.
Referenced by gui_cleanup().
|
static |
References a, b, MAX, and MIN.
Referenced by gui_init().
|
static |
References dt_dev_pixelpipe_iop_t::buf_in, d, 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, n, p, dt_iop_module_t::params, PHI, dt_develop_t::virtual_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, g, dt_iop_roi_t::height, dt_iop_module_t::iop_order, p, dt_develop_t::virtual_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_get_thumbnail_size(), dt_dev_pixelpipe_resync_history_all, dt_iop_request_focus(), dt_iop_set_cache_bypass(), dt_iop_module_t::enabled, FALSE, g, GRAB_CENTER, GRAB_NONE, gui_changed(), dt_iop_module_t::gui_data, p, 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(), c, d, 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(), g, darktable_t::gui, gui_changed(), dt_iop_module_t::gui_data, i, MAX, MIN, n, dt_iop_crop_aspect_t::n, dt_iop_crop_aspect_t::name, p, dt_iop_module_t::params, and dt_gui_gtk_t::reset.
Referenced by gui_init(), and gui_update().
|
static |
References _enter_edit_mode(), darktable, dt_iop_module_t::dev, darktable_t::develop, dt_dev_add_history_item, dt_dev_get_thumbnail_size(), dt_iop_set_cache_bypass(), FALSE, g, dt_iop_module_t::gui_data, and TRUE.
Referenced by gui_init().
|
static |
References _aspect_apply(), GRAB_ALL, gui_changed(), p, and dt_iop_module_t::params.
Referenced by _event_aspect_flip().
|
static |
|
static |
References g, 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_iop_t::buf_out, dt_iop_module_t::dev, dt_dev_coordinates_preview_abs_to_image_norm(), dt_dev_distort_get_iop_pipe(), dt_dev_distort_transform_plus(), DT_DEV_TRANSFORM_DIR_FORW_EXCL, FALSE, g, dt_iop_module_t::gui_data, dt_iop_roi_t::height, dt_iop_module_t::iop_order, p, dt_iop_module_t::params, TRUE, dt_develop_t::virtual_pipe, 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_coordinates_widget_to_image_norm(), dt_dev_get_overlay_scale(), dt_modifiers_include(), DT_PIXEL_APPLY_DPI, g, GRAB_ALL, GRAB_BOTTOM, GRAB_BOTTOM_RIGHT, GRAB_CENTER, GRAB_LEFT, GRAB_NONE, GRAB_RIGHT, GRAB_TOP, dt_iop_module_t::gui_data, TRUE, type, and x.
| int button_released | ( | struct dt_iop_module_t * | self, |
| double | x, | ||
| double | y, | ||
| int | which, | ||
| uint32_t | state | ||
| ) |
References dt_control_change_cursor(), FALSE, g, 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, and dt_free_align.
| 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 | ||
| ) |
References CLAMPF, d, dt_dev_pixelpipe_iop_t::data, g, dt_iop_module_t::gui_data, and p.
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const 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, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| float *const restrict | points, | ||
| size_t | points_count | ||
| ) |
References dt_dev_pixelpipe_iop_t::buf_in, d, dt_dev_pixelpipe_iop_t::data, dt_iop_roi_t::height, i, and dt_iop_roi_t::width.
| 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 | ||
| ) |
References dt_iop_copy_image_roi(), out, TRUE, and void().
| 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 | ||
| ) |
References dt_dev_pixelpipe_iop_t::buf_in, d, dt_dev_pixelpipe_iop_t::data, dt_iop_roi_t::height, i, and dt_iop_roi_t::width.
| 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(), g, GRAB_ALL, GRAB_BOTTOM, GRAB_LEFT, GRAB_RIGHT, GRAB_TOP, darktable_t::gui, dt_iop_module_t::gui_data, p, 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(), g, 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, c, d, 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_free, DT_GUI_MODULE, dt_gui_new_collapsible_section(), dtgtk_cairo_paint_aspectflip(), FALSE, g, GRAB_CENTER, i, IOP_GUI_ALLOC, dt_conf_string_entry_t::key, MAX, MIN, n, 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(), 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_coordinates_widget_to_image_norm(), dt_dev_get_overlay_scale(), 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, g, 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_height, dt_develop_t::preview_width, dt_develop_t::roi, 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(), d, 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(), g, dt_iop_module_t::gui_data, i, n, dt_iop_crop_aspect_t::n, p, and dt_iop_module_t::params.
| gboolean has_defaults | ( | struct dt_iop_module_t * | self | ) |
References d, dt_iop_module_t::default_params, p, and dt_iop_module_t::params.
| 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, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
| 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 | ||
| ) |
References d, dt_dev_pixelpipe_iop_t::data, dt_iop_roi_t::height, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| int mouse_leave | ( | struct dt_iop_module_t * | self | ) |
References dt_control_change_cursor(), FALSE, g, 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_hinter_message(), dt_control_queue_redraw_center(), dt_control_set_cursor(), dt_dev_coordinates_widget_to_image_norm(), dt_dev_get_overlay_scale(), DT_PIXEL_APPLY_DPI, g, 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 x.
| 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.
| 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 | ||
| ) |
References dt_iop_copy_image_roi(), dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, and TRUE.
| void reload_defaults | ( | dt_iop_module_t * | self | ) |
| gboolean runtime_data_hash | ( | struct dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |