58 gboolean found =
FALSE;
72 for(
const GList *node = g_list_first(
pipe->
nodes); node; node = g_list_next(node))
94 int32_t raw_width = 0;
95 int32_t raw_height = 0;
97 if(raw_width <= 0 || raw_height <= 0)
return FALSE;
123 int canvas_width = 0;
124 int canvas_height = 0;
152 int *frame_width,
int *frame_height)
188 int frame_height = 0;
191 for(
int i = 0;
i < count;
i++)
193 pts[2 *
i] = (float)placement.
offset_x + pts[2 *
i] * (
float)frame_width;
194 pts[2 *
i + 1] = (float)placement.
offset_y + pts[2 *
i + 1] * (
float)frame_height;
206 int frame_height = 0;
209 for(
int i = 0;
i < count;
i++)
211 pts[2 *
i] = (pts[2 *
i] - (float)placement.
offset_x) / (float)frame_width;
212 pts[2 *
i + 1] = (pts[2 *
i + 1] - (float)placement.
offset_y) / (float)frame_height;
227 float *lx,
float *ly)
231 float pt[2] = { (float)wx, (
float)wy };
240 float *wx,
float *wy)
244 float pt[2] = {
x, y };
252 const float x1,
const float y1,
253 float *left,
float *
top,
254 float *right,
float *bottom)
257 x0, y0, x1, y0, x0, y1, x1, y1,
262 float min_x = pts[0];
263 float max_x = pts[0];
264 float min_y = pts[1];
265 float max_y = pts[1];
266 for(
int i = 1;
i < 4;
i++)
268 min_x = fminf(min_x, pts[2 *
i]);
269 max_x = fmaxf(max_x, pts[2 *
i]);
270 min_y = fminf(min_y, pts[2 *
i + 1]);
271 max_y = fmaxf(max_y, pts[2 *
i + 1]);
282 const float fallback)
292 const float rx = hypotf(pts[2] - pts[0], pts[3] - pts[1]);
293 const float ry = hypotf(pts[4] - pts[0], pts[5] - pts[1]);
294 const float radius = 0.5f * (rx + ry);
295 return fmaxf(0.5f, isfinite(radius) ? radius : fallback);
325 if(widget_w <= 0.0f || widget_h <= 0.0f || preview_w <= 0.0f || preview_h <= 0.0f)
return FALSE;
329 const float roi_w = fminf(widget_w, preview_w * zoom_scale);
330 const float roi_h = fminf(widget_h, preview_h * zoom_scale);
331 const float rec_x = fmaxf(border, 0.5f * (widget_w - roi_w));
332 const float rec_y = fmaxf(border, 0.5f * (widget_h - roi_h));
333 const float rec_w = fminf(widget_w - 2.0f * border, roi_w);
334 const float rec_h = fminf(widget_h - 2.0f * border, roi_h);
335 if(rec_w <= 0.0f || rec_h <= 0.0f)
return FALSE;
338 rec_x, rec_y, rec_x + rec_w, rec_y, rec_x, rec_y + rec_h, rec_x + rec_w, rec_y + rec_h,
342 float min_x = pts[0];
343 float max_x = pts[0];
344 float min_y = pts[1];
345 float max_y = pts[1];
346 for(
int i = 1;
i < 4;
i++)
348 min_x = fminf(min_x, pts[2 *
i]);
349 max_x = fmaxf(max_x, pts[2 *
i]);
350 min_y = fminf(min_y, pts[2 *
i + 1]);
351 max_y = fmaxf(max_y, pts[2 *
i + 1]);
354 view->layer_x0 = min_x;
355 view->layer_y0 = min_y;
356 view->layer_x1 = max_x;
357 view->layer_y1 = max_y;
359 view->patch.x =
MAX(0, (
int)floorf(min_x - padding));
360 view->patch.y =
MAX(0, (
int)floorf(min_y - padding));
364 view->patch.height =
MAX(0, bottom -
view->patch.y);
365 return view->patch.width > 0 &&
view->patch.height > 0;
const dt_colormatrix_t dt_aligned_pixel_t out
gboolean dt_drawlayer_compute_view_patch(dt_iop_module_t *self, const float padding, drawlayer_view_patch_info_t *view)
gboolean dt_drawlayer_layer_canvas_for_pipe(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, int *width, int *height)
gboolean dt_drawlayer_widget_points_to_layer_coords(dt_iop_module_t *self, float *pts, const int count)
gboolean dt_drawlayer_raw_placement_gui(dt_iop_module_t *self, dt_drawlayer_raw_placement_t *placement, int *frame_width, int *frame_height)
The placement against this module's frame, as the GUI sees it.
static gboolean _virtual_piece_layer_geometry(dt_iop_module_t *self, int *layer_width, int *layer_height)
gboolean dt_drawlayer_raw_placement_for_frame(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_iop_roi_t *const frame, dt_drawlayer_raw_placement_t *placement)
float dt_drawlayer_widget_brush_radius(dt_iop_module_t *self, const dt_drawlayer_brush_dab_t *dab, const float fallback)
gboolean dt_drawlayer_layer_points_to_widget_coords(dt_iop_module_t *self, float *pts, const int count)
gboolean dt_drawlayer_layer_bounds_to_widget_bounds(dt_iop_module_t *self, const float x0, const float y0, const float x1, const float y1, float *left, float *top, float *right, float *bottom)
float dt_drawlayer_current_live_padding(dt_iop_module_t *self)
gboolean dt_drawlayer_layer_canvas(dt_iop_module_t *self, int *width, int *height)
dt_drawlayer_layer_canvas_for_pipe for a GUI caller.
gboolean dt_drawlayer_widget_to_layer_coords(dt_iop_module_t *self, const double wx, const double wy, float *lx, float *ly)
static gboolean _flip_swaps_axes(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe)
Does the orientation flip.c settled on swap the axes?
gboolean dt_drawlayer_layer_to_widget_coords(dt_iop_module_t *self, const float x, const float y, float *wx, float *wy)
Shared coordinate transforms and geometry computations for drawlayer.
gboolean dt_dev_geometry_get_raw_size(const dt_develop_t *dev, int32_t *width, int32_t *height)
int32_t dt_dev_roi_request_preview_height(const dt_develop_t *dev)
int32_t dt_dev_roi_request_preview_width(const dt_develop_t *dev)
int32_t dt_dev_viewport_border_size(const dt_develop_t *dev)
int32_t dt_dev_viewport_widget_height(const dt_develop_t *dev)
int32_t dt_dev_viewport_widget_width(const dt_develop_t *dev)
void dt_dev_coordinates_preview_abs_to_image_norm(dt_develop_t *dev, float *points, size_t num_points)
int dt_dev_distort_backtransform_gui(dt_develop_t *dev, const double iop_order, const int transf_direction, float *points, size_t points_count)
The inverse of dt_dev_distort_transform_gui(), same rules.
float dt_dev_get_overlay_scale(dt_develop_t *dev)
Get the overlay scale factor in GUI logical coordinates.
void dt_dev_coordinates_image_norm_to_preview_abs(dt_develop_t *dev, float *points, size_t num_points)
void dt_dev_coordinates_image_norm_to_widget(dt_develop_t *dev, float *points, size_t num_points)
gboolean dt_dev_module_geometry_gui(dt_develop_t *dev, dt_iop_module_t *module, dt_iop_roi_t *in, dt_iop_roi_t *out)
One module's own input and output rectangles at full resolution, from the geometry service.
int dt_dev_distort_transform_gui(dt_develop_t *dev, const double iop_order, const int transf_direction, float *points, size_t points_count)
The GUI's bounded transform folds, composed by the geometry service.
void dt_dev_coordinates_widget_to_image_norm(dt_develop_t *dev, float *points, size_t num_points)
Coordinate conversion helpers between widget, normalized image, and absolute image spaces.
@ DT_DEV_TRANSFORM_DIR_FORW_EXCL
GtkWidget * view
the tree view
const dt_geometry_record_t * dt_geometry_chain_find(const dt_geometry_chain_t *chain, const char *op, const int instance)
One module instance's record, or NULL. Use it for that module's own in/out dims.
Where things are on the image, answered without a pipeline.
float dt_drawlayer_conf_size(void)
Read and clamp configured brush size (px).
The brush settings the drawlayer module keeps in the application configuration.
static const dt_dev_pixelpipe_t * pipe
static const dt_dev_pixelpipe_t const dt_dev_pixelpipe_iop_t * piece
static const dt_dev_pixelpipe_t const dt_dev_pixelpipe_iop_t int int * layer_height
static const dt_dev_pixelpipe_t const dt_dev_pixelpipe_iop_t int * layer_width
static void swap(float *x, float *y)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
struct dt_geometry_chain_t * geometry_chain
Fully resolved input dab descriptor.
Where the raw-anchored layer canvas sits in this module's own frame.
One module instance's contribution, as data.
struct dt_develop_t * dev
Region of interest passed through the pixelpipe.