48#include <gdk/gdkkeysyms.h>
85static void get_corner(
const int32_t *aabb,
const int i, int32_t *
p)
87 for(
int k = 0;
k < 2;
k++)
p[
k] = aabb[2 * ((
i >>
k) & 1) +
k];
92 aabb[0] =
MIN(aabb[0],
p[0]);
93 aabb[1] =
MIN(aabb[1],
p[1]);
94 aabb[2] =
MAX(aabb[2],
p[0]);
95 aabb[3] =
MAX(aabb[3],
p[1]);
100 return _(
"orientation");
105 return _(
"rotation|flip");
131 _(
"linear, RGB, scene-referred"), _(
"geometric, RGB"),
132 _(
"linear, RGB, scene-referred"));
149 return raw_orientation ^ user_orientation;
162 corrected |= (raw_flip_y << 1) | (raw_flip_x >> 1);
168 return corrected ^ user_orientation;
172 void *new_params,
const int new_version)
174 if(old_version == 1 && new_version == 2)
176 typedef struct dt_iop_flip_params_v1_t
179 } dt_iop_flip_params_v1_t;
181 const dt_iop_flip_params_v1_t *old = (dt_iop_flip_params_v1_t *)old_params;
208 const int32_t tmp = iw;
219 o[0] = iw - o[0] - 1;
223 o[1] = ih - o[1] - 1;
228 float *
const restrict points,
size_t points_count)
234 if (
d->orientation == 0)
return 1;
236 for(
size_t i = 0;
i < points_count * 2;
i += 2)
239 float y = points[
i + 1];
255 float *
const restrict points,
size_t points_count)
261 if (
d->orientation == 0)
return 1;
263 for(
size_t i = 0;
i < points_count * 2;
i += 2)
287 const float *
const in,
float *
const out,
const dt_iop_roi_t *
const roi_in,
293 const int bpp =
sizeof(float);
294 const int stride =
bpp * roi_in->
width;
328 int32_t aabb[4] = { roi_out->
x, roi_out->
y, roi_out->
x + roi_out->
width - 1, roi_out->
y + roi_out->
height - 1 };
329 int32_t aabb_in[4] = { INT_MAX, INT_MAX, INT_MIN, INT_MIN };
330 for(
int c = 0; c < 4; c++)
342 roi_in->
x = aabb_in[0];
343 roi_in->
y = aabb_in[1];
345 roi_in->
width = aabb_in[2] - aabb_in[0] + 1;
346 roi_in->
height = aabb_in[3] - aabb_in[1] + 1;
351 roi_in->
x = CLAMP(roi_in->
x, 0, (
int)floorf(w));
352 roi_in->
y = CLAMP(roi_in->
y, 0, (
int)floorf(h));
353 roi_in->
width = CLAMP(roi_in->
width, 1, (
int)ceilf(w) - roi_in->
x);
354 roi_in->
height = CLAMP(roi_in->
height, 1, (
int)ceilf(h) - roi_in->
y);
366 const int stride =
bpp * roi_in->
width;
381 const int devid = pipe->
devid;
395 if(err != CL_SUCCESS)
goto error;
406 const int program = 2;
428 d->orientation =
p->orientation;
495 "SELECT * FROM main.history WHERE imgid = ?1 AND operation = 'flip'", -1, &stmt,
498 if(sqlite3_step(stmt) != SQLITE_ROW)
505 sqlite3_finalize(stmt);
532 p->orientation = orientation;
static void error(char *msg)
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
const dt_colormatrix_t dt_aligned_pixel_t out
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#define dt_free_align(ptr)
static void * dt_calloc_align(size_t size)
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define __OMP_PARALLEL_FOR__(...)
sqlite3 * dt_database_get(const dt_database_t *db)
#define dt_database_start_transaction(db)
#define dt_database_release_transaction(db)
#define DT_DEBUG_SQLITE3_PREPARE_V2(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_INT(a, b, c)
#define dt_dev_add_history_item(dev, module, enable, redraw)
void dtgtk_cairo_paint_refresh(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data)
void dtgtk_cairo_paint_flip(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags, void *data)
static void _flip_h(GtkWidget *widget, dt_iop_module_t *self)
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 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)
const char ** description(struct dt_iop_module_t *self)
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)
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)
static dt_image_orientation_t merge_two_orientations(dt_image_orientation_t raw_orientation, dt_image_orientation_t user_orientation)
static void rotate_cw(GtkWidget *widget, dt_iop_module_t *self)
static void adjust_aabb(const int32_t *p, int32_t *aabb)
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void rotate_ccw(GtkWidget *widget, dt_iop_module_t *self)
void cleanup_global(dt_iop_module_so_t *self)
void gui_init(struct dt_iop_module_t *self)
static void _flip_v(GtkWidget *widget, dt_iop_module_t *self)
void reload_defaults(dt_iop_module_t *self)
static void get_corner(const int32_t *aabb, const int i, int32_t *p)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void gui_cleanup(struct dt_iop_module_t *self)
void init_presets(dt_iop_module_so_t *self)
static void backtransform(const int32_t *x, int32_t *o, const dt_image_orientation_t orientation, int32_t iw, int32_t ih)
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)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
struct dt_iop_flip_params_t dt_iop_flip_data_t
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 *self)
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)
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)
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 do_rotate(dt_iop_module_t *self, uint32_t cw)
#define DT_GUI_BOX_SPACING
void dt_gui_presets_update_autoapply(const char *name, dt_dev_operation_t op, const int32_t version, const int autoapply)
void dt_gui_presets_add_generic(const char *name, dt_dev_operation_t op, const int32_t version, const void *params, const int32_t params_size, const int32_t enabled, const dt_develop_blend_colorspace_t blend_cst)
@ ORIENTATION_ROTATE_CCW_90_DEG
@ ORIENTATION_ROTATE_CW_90_DEG
@ ORIENTATION_ROTATE_180_DEG
@ ORIENTATION_FLIP_VERTICALLY
@ ORIENTATION_FLIP_HORIZONTALLY
static dt_image_orientation_t dt_image_orientation(const dt_image_t *img)
__DT_CLONE_TARGETS__ void dt_imageio_flip_buffers(char *out, const char *in, const size_t bpp, const int wd, const int ht, const int fwd, const int fht, const int stride, const dt_image_orientation_t orientation)
const char ** dt_iop_set_description(dt_iop_module_t *module, const char *main_text, const char *purpose, const char *input, const char *process, const char *output)
@ IOP_FLAGS_TILING_FULL_ROI
GtkWidget * dt_iop_button_new(dt_iop_module_t *self, const gchar *label, GCallback callback, gboolean local, guint accel_key, GdkModifierType mods, DTGTKCairoPaintIconFunc paint, gint paintflags, GtkWidget *box)
float *const restrict const size_t k
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
int dt_opencl_create_kernel(const int prog, const char *name)
void dt_opencl_free_kernel(const int kernel)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
GtkWidget * dtgtk_reset_label_new(const gchar *text, dt_iop_module_t *module, void *param, int param_size)
struct _GtkWidget GtkWidget
const struct dt_database_t * db
struct dt_develop_t * develop
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
dt_image_raw_parameters_t legacy_flip
dt_image_orientation_t orientation
GModule *dt_dev_operation_t op
dt_iop_global_data_t * data
dt_iop_params_t * default_params
struct dt_develop_t * dev
dt_iop_gui_data_t * gui_data
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.