![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Shared coordinate transforms and geometry computations for drawlayer. More...
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | drawlayer_view_patch_t |
| struct | drawlayer_view_patch_info_t |
| struct | dt_drawlayer_raw_placement_t |
| Where the raw-anchored layer canvas sits in this module's own frame. More... | |
Typedefs | |
| typedef struct drawlayer_view_patch_t | drawlayer_view_patch_t |
| typedef struct drawlayer_view_patch_info_t | drawlayer_view_patch_info_t |
| typedef struct dt_drawlayer_raw_placement_t | dt_drawlayer_raw_placement_t |
| Where the raw-anchored layer canvas sits in this module's own frame. | |
Functions | |
| gboolean | dt_drawlayer_layer_canvas_for_pipe (dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, int *width, int *height) |
| The layer canvas: the raw image's dimensions, in this image's own orientation. | |
| 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_raw_placement_for_frame (dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const dt_iop_roi_t *frame, dt_drawlayer_raw_placement_t *placement) |
Anchor the canvas against frame, this module's input rect from the size fold. | |
| 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. | |
| gboolean | dt_drawlayer_widget_points_to_layer_coords (dt_iop_module_t *self, float *pts, int count) |
| gboolean | dt_drawlayer_layer_points_to_widget_coords (dt_iop_module_t *self, float *pts, int count) |
| gboolean | dt_drawlayer_widget_to_layer_coords (dt_iop_module_t *self, double wx, double wy, float *lx, float *ly) |
| gboolean | dt_drawlayer_layer_to_widget_coords (dt_iop_module_t *self, float x, float y, float *wx, float *wy) |
| gboolean | dt_drawlayer_layer_bounds_to_widget_bounds (dt_iop_module_t *self, float x0, float y0, float x1, float y1, float *left, float *top, float *right, float *bottom) |
| float | dt_drawlayer_widget_brush_radius (dt_iop_module_t *self, const dt_drawlayer_brush_dab_t *dab, float fallback) |
| float | dt_drawlayer_current_live_padding (dt_iop_module_t *self) |
| gboolean | dt_drawlayer_compute_view_patch (dt_iop_module_t *self, float padding, drawlayer_view_patch_info_t *view) |
Shared coordinate transforms and geometry computations for drawlayer.
Definition in file coordinates.h.
| typedef struct drawlayer_view_patch_info_t drawlayer_view_patch_info_t |
| typedef struct drawlayer_view_patch_t drawlayer_view_patch_t |
| typedef struct dt_drawlayer_raw_placement_t dt_drawlayer_raw_placement_t |
Where the raw-anchored layer canvas sits in this module's own frame.
The layer has the RAW image's dimensions and sits at the origin of the raw frame. The module's own frame is a window into it, at the position the size fold gives that window. That is the whole placement: an offset, never a scale, never a rotation.
It follows from what the layer is FOR. Paint is authored on the sensor's frame, so it must not move when the frame around it changes – crop it tighter, or move the crop without resizing it, and the same paint stays on the same content, cropped along with it. Uncropped, the two frames coincide and so do their centres.
The layer is deliberately IMMUNE to perspective correction and to horizon rotation. Those change what the frame contains, not where the sensor's centre is, and following them would mean warping a four-channel raster through the upstream chain on every render.
The one transform that does apply is the FLIP. A raw buffer is landscape, so a portrait image is a raw rotated 90 degrees, and the layer is rotated with it – carried here by the canvas being stated in the module's own orientation (dt_drawlayer_layer_canvas), which is what the user paints on and what the sidecar holds.
| gboolean dt_drawlayer_compute_view_patch | ( | dt_iop_module_t * | self, |
| float | padding, | ||
| drawlayer_view_patch_info_t * | view | ||
| ) |
Definition at line 304 of file coordinates.c.
References _virtual_piece_layer_geometry(), dt_iop_module_t::dev, dt_dev_get_overlay_scale(), dt_dev_roi_request_preview_height(), dt_dev_roi_request_preview_width(), dt_dev_viewport_border_size(), dt_dev_viewport_widget_height(), dt_dev_viewport_widget_width(), dt_drawlayer_widget_points_to_layer_coords(), FALSE, i, IS_NULL_PTR, MAX, MIN, and view.
Referenced by _ensure_widget_cache().
| float dt_drawlayer_current_live_padding | ( | dt_iop_module_t * | self | ) |
Definition at line 294 of file coordinates.c.
References _conf_brush_shape(), _conf_hardness(), _conf_size(), and dt_drawlayer_brush_dab_t::radius.
Referenced by _fill_runtime_inputs().
| gboolean dt_drawlayer_layer_bounds_to_widget_bounds | ( | dt_iop_module_t * | self, |
| float | x0, | ||
| float | y0, | ||
| float | x1, | ||
| float | y1, | ||
| float * | left, | ||
| float * | top, | ||
| float * | right, | ||
| float * | bottom | ||
| ) |
Definition at line 247 of file coordinates.c.
References dt_drawlayer_layer_points_to_widget_coords(), FALSE, i, IS_NULL_PTR, top, and TRUE.
Referenced by _ensure_widget_cache().
| gboolean dt_drawlayer_layer_canvas | ( | dt_iop_module_t * | self, |
| int * | width, | ||
| int * | height | ||
| ) |
dt_drawlayer_layer_canvas_for_pipe for a GUI caller.
Definition at line 106 of file coordinates.c.
References dt_drawlayer_layer_canvas_for_pipe(), height, and width.
Referenced by _virtual_piece_layer_geometry().
| gboolean dt_drawlayer_layer_canvas_for_pipe | ( | dt_iop_module_t * | self, |
| const struct dt_dev_pixelpipe_t * | pipe, | ||
| int * | width, | ||
| int * | height | ||
| ) |
The layer canvas: the raw image's dimensions, in this image's own orientation.
Transposed when the axes are swapped, because a portrait is a landscape raw seen rotated and the paint has to be rotated with it. WHETHER they are swapped is asked of iop/flip.c's own size fold, not of the EXIF tag – a raw's recorded orientation is not always right, and flip is where the user corrects it. Everything else about the canvas is fixed: it does not move with a crop, a zoom, a pipe type or a mipmap level, which is what makes it something to anchor to.
pipe selects which side's copy of that fold answers – NULL for the GUI's records, a pipe for its own pieces. They are the same fold, so they agree.
| gboolean dt_drawlayer_layer_points_to_widget_coords | ( | dt_iop_module_t * | self, |
| float * | pts, | ||
| int | count | ||
| ) |
Definition at line 195 of file coordinates.c.
References dt_iop_module_t::dev, dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_image_norm_to_widget(), dt_dev_coordinates_preview_abs_to_image_norm(), dt_dev_distort_transform_gui(), DT_DEV_TRANSFORM_DIR_FORW_EXCL, dt_drawlayer_raw_placement_gui(), FALSE, i, dt_iop_module_t::iop_order, IS_NULL_PTR, dt_drawlayer_raw_placement_t::offset_x, dt_drawlayer_raw_placement_t::offset_y, and TRUE.
Referenced by dt_drawlayer_layer_bounds_to_widget_bounds(), dt_drawlayer_layer_to_widget_coords(), and dt_drawlayer_widget_brush_radius().
| gboolean dt_drawlayer_layer_to_widget_coords | ( | dt_iop_module_t * | self, |
| float | x, | ||
| float | y, | ||
| float * | wx, | ||
| float * | wy | ||
| ) |
Definition at line 235 of file coordinates.c.
References dt_drawlayer_layer_points_to_widget_coords(), FALSE, IS_NULL_PTR, TRUE, and x.
Referenced by _paint_layer_to_widget_cb().
| gboolean dt_drawlayer_raw_placement_for_frame | ( | dt_iop_module_t * | self, |
| const struct dt_dev_pixelpipe_t * | pipe, | ||
| const dt_iop_roi_t * | frame, | ||
| dt_drawlayer_raw_placement_t * | placement | ||
| ) |
Anchor the canvas against frame, this module's input rect from the size fold.
| 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.
Definition at line 147 of file coordinates.c.
References dt_iop_module_t::dev, dt_dev_module_geometry_gui(), dt_drawlayer_raw_placement_for_frame(), FALSE, dt_iop_roi_t::height, IS_NULL_PTR, and dt_iop_roi_t::width.
Referenced by dt_drawlayer_layer_points_to_widget_coords(), and dt_drawlayer_widget_points_to_layer_coords().
| float dt_drawlayer_widget_brush_radius | ( | dt_iop_module_t * | self, |
| const dt_drawlayer_brush_dab_t * | dab, | ||
| float | fallback | ||
| ) |
Definition at line 277 of file coordinates.c.
References dt_iop_module_t::dev, dt_drawlayer_layer_points_to_widget_coords(), IS_NULL_PTR, dt_drawlayer_brush_dab_t::radius, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by gui_post_expose().
| gboolean dt_drawlayer_widget_points_to_layer_coords | ( | dt_iop_module_t * | self, |
| float * | pts, | ||
| int | count | ||
| ) |
Definition at line 168 of file coordinates.c.
References dt_iop_module_t::dev, dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_preview_abs_to_image_norm(), dt_dev_coordinates_widget_to_image_norm(), dt_dev_distort_backtransform_gui(), DT_DEV_TRANSFORM_DIR_FORW_EXCL, dt_drawlayer_raw_placement_gui(), FALSE, i, dt_iop_module_t::iop_order, IS_NULL_PTR, dt_drawlayer_raw_placement_t::offset_x, dt_drawlayer_raw_placement_t::offset_y, and TRUE.
Referenced by dt_drawlayer_compute_view_patch(), and dt_drawlayer_widget_to_layer_coords().
| gboolean dt_drawlayer_widget_to_layer_coords | ( | dt_iop_module_t * | self, |
| double | wx, | ||
| double | wy, | ||
| float * | lx, | ||
| float * | ly | ||
| ) |
Definition at line 222 of file coordinates.c.
References dt_drawlayer_widget_points_to_layer_coords(), FALSE, IS_NULL_PTR, and TRUE.
Referenced by _fill_input_layer_coords(), dt_drawlayer_build_worker_input_dab(), and gui_post_expose().