Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
clipping.c File Reference
#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 "develop/tiling.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 clipping.c:

Data Structures

struct  dt_iop_clipping_aspect_t
 
struct  dt_iop_clipping_params_t
 
struct  dt_iop_clipping_gui_data_t
 
struct  dt_iop_clipping_data_t
 
struct  dt_iop_clipping_global_data_t
 

Typedefs

typedef enum dt_iop_clipping_flags_t dt_iop_clipping_flags_t
 
typedef struct dt_iop_clipping_aspect_t dt_iop_clipping_aspect_t
 
typedef struct dt_iop_clipping_params_t dt_iop_clipping_params_t
 
typedef enum _grab_region_t _grab_region_t
 
typedef struct dt_iop_clipping_gui_data_t dt_iop_clipping_gui_data_t
 
typedef struct dt_iop_clipping_data_t dt_iop_clipping_data_t
 
typedef struct dt_iop_clipping_global_data_t dt_iop_clipping_global_data_t
 

Enumerations

enum  dt_iop_clipping_flags_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

static void keystone_type_populate (struct dt_iop_module_t *self, gboolean with_applied, int select)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
static void commit_box (dt_iop_module_t *self, dt_iop_clipping_gui_data_t *g, dt_iop_clipping_params_t *p)
 
static void get_corner (const float *aabb, const int i, float *p)
 
static void adjust_aabb (const float *p, float *aabb)
 
const char * deprecated_msg ()
 
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 int gui_has_focus (struct dt_iop_module_t *self)
 
static void keystone_get_matrix (const dt_boundingbox_t k_space, float kxa, float kxb, float kxc, float kxd, float kya, float kyb, float kyc, float kyd, float *a, float *b, float *d, float *e, float *g, float *h)
 
static void keystone_backtransform (float *i, const dt_boundingbox_t k_space, float a, float b, float d, float e, float g, float h, float kxa, float kya)
 
static void keystone_transform (float *i, const dt_boundingbox_t k_space, float a, float b, float d, float e, float g, float h, float kxa, float kya)
 
static void backtransform (float *x, float *o, const float *m, const float t_h, const float t_v)
 
static void inv_matrix (float *m, float *inv_m)
 
static void transform (float *x, float *o, const float *m, const float t_h, const float t_v)
 
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)
 
static int _iop_clipping_set_max_clip (struct dt_iop_module_t *self)
 
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_orig)
 
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 init_global (dt_iop_module_so_t *module)
 
void cleanup_global (dt_iop_module_so_t *module)
 
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)
 
static void _event_preview_updated_callback (gpointer instance, dt_iop_module_t *self)
 
void gui_focus (struct dt_iop_module_t *self, gboolean in)
 
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 _ratio_get_aspect (dt_iop_module_t *self, GtkWidget *combo)
 
static void apply_box_aspect (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 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)
 
static void keystone_type_changed (GtkWidget *combo, dt_iop_module_t *self)
 
void gui_update (struct dt_iop_module_t *self)
 
static void hvflip_callback (GtkWidget *widget, dt_iop_module_t *self)
 
static void key_swap_callback (GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier, gpointer d)
 
static void aspect_flip (GtkWidget *button, dt_iop_module_t *self)
 
static gint _aspect_ratio_cmp (const dt_iop_clipping_aspect_t *a, const dt_iop_clipping_aspect_t *b)
 
static gchar * format_aspect (gchar *original, int adim, int bdim)
 
void gui_init (struct dt_iop_module_t *self)
 
static void free_aspect (gpointer data)
 
void gui_cleanup (struct dt_iop_module_t *self)
 
static _grab_region_t get_grab (float pzx, float pzy, dt_iop_clipping_gui_data_t *g, const float border, const float wd, const float ht)
 
static void gui_draw_sym (cairo_t *cr, float x, float y, float scale, gboolean active)
 
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)
 
static float dist_seg (float xa, float ya, float xb, float yb, float xc, float yc)
 
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)
 

Typedef Documentation

◆ _grab_region_t

◆ dt_iop_clipping_aspect_t

◆ dt_iop_clipping_data_t

◆ dt_iop_clipping_flags_t

flip H/V, rotate an image, then clip the buffer.

◆ dt_iop_clipping_global_data_t

◆ dt_iop_clipping_gui_data_t

◆ dt_iop_clipping_params_t

Enumeration Type Documentation

◆ _grab_region_t

Enumerator
GRAB_CENTER 
GRAB_LEFT 
GRAB_TOP 
GRAB_RIGHT 
GRAB_BOTTOM 
GRAB_TOP_LEFT 
GRAB_TOP_RIGHT 
GRAB_BOTTOM_RIGHT 
GRAB_BOTTOM_LEFT 
GRAB_HORIZONTAL 
GRAB_VERTICAL 
GRAB_ALL 
GRAB_NONE 

◆ dt_iop_clipping_flags_t

flip H/V, rotate an image, then clip the buffer.

Enumerator
FLAG_FLIP_HORIZONTAL 
FLAG_FLIP_VERTICAL 

Function Documentation

◆ _aspect_ratio_cmp()

static gint _aspect_ratio_cmp ( const dt_iop_clipping_aspect_t a,
const dt_iop_clipping_aspect_t b 
)
static

◆ _event_preview_updated_callback()

static void _event_preview_updated_callback ( gpointer  instance,
dt_iop_module_t self 
)
static

◆ _float_to_fract()

static void _float_to_fract ( const char *  num,
int *  n,
int *  d 
)
static

References FALSE, and TRUE.

Referenced by aspect_presets_changed().

◆ _iop_clipping_set_max_clip()

◆ _ratio_get_aspect()

◆ adjust_aabb()

static void adjust_aabb ( const float *  p,
float *  aabb 
)
inlinestatic

Referenced by modify_roi_in().

◆ aliases()

const char * aliases ( )

◆ apply_box_aspect()

◆ aspect_flip()

static void aspect_flip ( GtkWidget *  button,
dt_iop_module_t self 
)
static

References key_swap_callback().

Referenced by gui_init().

◆ aspect_presets_changed()

◆ backtransform()

static void backtransform ( float *  x,
float *  o,
const float *  m,
const float  t_h,
const float  t_v 
)
inlinestatic

◆ button_pressed()

◆ button_released()

◆ cleanup_global()

◆ cleanup_pipe()

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

◆ commit_box()

◆ commit_params()

◆ default_colorspace()

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

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

References IOP_GROUP_EFFECTS.

◆ deprecated_msg()

const char * deprecated_msg ( )

◆ description()

const char ** description ( struct dt_iop_module_t self)

◆ dist_seg()

static float dist_seg ( float  xa,
float  ya,
float  xb,
float  yb,
float  xc,
float  yc 
)
static

Referenced by mouse_moved().

◆ distort_backtransform()

◆ distort_mask()

◆ distort_transform()

◆ flags()

◆ format_aspect()

static gchar * format_aspect ( gchar *  original,
int  adim,
int  bdim 
)
static

Referenced by gui_init().

◆ free_aspect()

static void free_aspect ( gpointer  data)
static

References dt_iop_clipping_aspect_t::name.

Referenced by gui_cleanup().

◆ get_corner()

static void get_corner ( const float *  aabb,
const int  i,
float *  p 
)
inlinestatic

Referenced by modify_roi_in(), and modify_roi_out().

◆ get_grab()

static _grab_region_t get_grab ( float  pzx,
float  pzy,
dt_iop_clipping_gui_data_t g,
const float  border,
const float  wd,
const float  ht 
)
static

◆ gui_changed()

◆ gui_cleanup()

void gui_cleanup ( struct dt_iop_module_t self)

◆ gui_draw_sym()

static void gui_draw_sym ( cairo_t *  cr,
float  x,
float  y,
float  scale,
gboolean  active 
)
static

◆ gui_focus()

◆ gui_has_focus()

static int gui_has_focus ( struct dt_iop_module_t self)
static

◆ gui_init()

◆ gui_post_expose()

◆ gui_reset()

void gui_reset ( struct dt_iop_module_t self)

◆ gui_update()

◆ has_defaults()

◆ hvflip_callback()

static void hvflip_callback ( GtkWidget *  widget,
dt_iop_module_t self 
)
static

◆ init_global()

◆ init_pipe()

◆ inv_matrix()

static void inv_matrix ( float *  m,
float *  inv_m 
)
inlinestatic

References m.

Referenced by modify_roi_out().

◆ key_swap_callback()

static void key_swap_callback ( GtkAccelGroup *  accel_group,
GObject *  acceleratable,
guint  keyval,
GdkModifierType  modifier,
gpointer  d 
)
static

◆ keystone_backtransform()

static void keystone_backtransform ( float *  i,
const dt_boundingbox_t  k_space,
float  a,
float  b,
float  d,
float  e,
float  g,
float  h,
float  kxa,
float  kya 
)
inlinestatic

◆ keystone_get_matrix()

static void keystone_get_matrix ( const dt_boundingbox_t  k_space,
float  kxa,
float  kxb,
float  kxc,
float  kxd,
float  kya,
float  kyb,
float  kyc,
float  kyd,
float *  a,
float *  b,
float *  d,
float *  e,
float *  g,
float *  h 
)
static

◆ keystone_transform()

static void keystone_transform ( float *  i,
const dt_boundingbox_t  k_space,
float  a,
float  b,
float  d,
float  e,
float  g,
float  h,
float  kxa,
float  kya 
)
inlinestatic

◆ keystone_type_changed()

◆ keystone_type_populate()

static void keystone_type_populate ( struct dt_iop_module_t self,
gboolean  with_applied,
int  select 
)
static

◆ legacy_params()

◆ modify_roi_in()

◆ modify_roi_out()

◆ mouse_moved()

◆ name()

const char * name ( )

Referenced by gui_init().

◆ operation_tags()

int operation_tags ( )

◆ operation_tags_filter()

int operation_tags_filter ( )

◆ process()

◆ reload_defaults()

◆ transform()

static void transform ( float *  x,
float *  o,
const float *  m,
const float  t_h,
const float  t_v 
)
inlinestatic