Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
masks_distort.h File Reference

What a mask outline needs in order to place itself, and who supplies it. More...

#include <glib.h>
#include <stdint.h>
#include "develop/develop.h"
#include "develop/pixelpipe_hb.h"
+ Include dependency graph for masks_distort.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_masks_distort_t
 Where an outline builder gets its geometry from. More...
 

Typedefs

typedef struct dt_masks_distort_t dt_masks_distort_t
 Where an outline builder gets its geometry from.
 

Functions

static dt_masks_distort_t dt_masks_distort_for_pipe (dt_dev_pixelpipe_t *pipe, dt_develop_t *dev)
 The rendering supplier: compose this pipe, sample as this pipe was told to.
 
int dt_masks_gui_outline_step (const dt_develop_t *dev)
 The density the dev's GUI shows its outlines at, in image pixels between consecutive samples: what the view published through dt_masks_gui_set_outline_density(), 1 for a dev with no GUI state. Implemented in masks_gui.c, which owns that state; declared here because the GUI supplier below is what reads it.
 
static dt_masks_distort_t dt_masks_distort_for_gui (dt_develop_t *dev)
 The GUI supplier: compose through the geometry service, at full resolution, sampled at the density the view shows.
 
static int dt_masks_distort_transform (const dt_masks_distort_t *const d, const double iop_order, const int transf_direction, float *points, size_t points_count)
 Compose forward, bounded exactly as dt_dev_distort_transform_plus() is.
 
static int dt_masks_distort_backtransform (const dt_masks_distort_t *const d, const double iop_order, const int transf_direction, float *points, size_t points_count)
 Compose backward, same bounds.
 

Detailed Description

What a mask outline needs in order to place itself, and who supplies it.

The shape outline builders – _brush_get_pts_border(), _polygon_get_pts_border() – are run from two entirely different places. The GUI calls them to draw an outline the user can grab; the pixel pipeline calls them, on a worker thread, to rasterise the mask a module actually blends with. They are the same geometry either way, which is why they are one function, and the difference between the two callers used to be expressed by handing them a different dt_dev_pixelpipe_t *: the GUI passed a pixel-less clone of the pipeline, the worker passed its own.

That stopped working when the clone was deleted, and the fix was not to give the GUI a different pipe but to name what the builders were reading out of one. It is three things: the full-resolution image size, how finely to sample the outline, and a way to compose the module stack around a given iop_order. This record supplies all three, and there are exactly two suppliers.

THE WORKER SUPPLIER keeps the piece-based machinery, unchanged and forever: mask rasterisation belongs to rendering, runs on the pipeline thread, and must compose the pipe it is rendering – not some other view of the same history.

THE GUI SUPPLIER composes through develop/geometry/geometry.h, which answers from published records.

Nothing else may implement this. Two suppliers are a seam; three are a fork.

Definition in file masks_distort.h.

Typedef Documentation

◆ dt_masks_distort_t

Where an outline builder gets its geometry from.

Build one with dt_masks_distort_for_pipe or dt_masks_distort_for_gui; do not fill it by hand, so that the two suppliers stay the only two.

Function Documentation

◆ dt_masks_distort_backtransform()

static int dt_masks_distort_backtransform ( const dt_masks_distort_t *const  d,
const double  iop_order,
const int  transf_direction,
float *  points,
size_t  points_count 
)
inlinestatic

Compose backward, same bounds.

Definition at line 139 of file masks_distort.h.

References d, dt_dev_distort_backtransform_gui(), dt_dev_distort_backtransform_plus(), and IS_NULL_PTR.

◆ dt_masks_distort_for_gui()

static dt_masks_distort_t dt_masks_distort_for_gui ( dt_develop_t dev)
inlinestatic

The GUI supplier: compose through the geometry service, at full resolution, sampled at the density the view shows.

The step is the view's: what one device pixel spans in image pixels, never less than one (dt_masks_gui_outline_step()). It used to be pinned at 1 because that is what the GUI had always had – the pixel-less pipe this replaces was never given a rasterisation step, so it kept the one its init set – and at fit zoom on a 24 Mpx raw that sampled the outline five times per device pixel: five times the build, the transform, the boundary pass and the hit test, for a line the screen shows at one sample per pixel either way. Read here rather than passed in, so that every GUI outline build – a drag's, an expose's, the creation session's – composes at the density in force without its caller having to know it. The size is the raw geometry, which is what that pipe's input was set from.

Definition at line 115 of file masks_distort.h.

References d, dt_dev_geometry_get_raw_size(), and dt_masks_gui_outline_step().

Referenced by _brush_get_points_border(), and _polygon_get_points_border().

◆ dt_masks_distort_for_pipe()

static dt_masks_distort_t dt_masks_distort_for_pipe ( dt_dev_pixelpipe_t pipe,
dt_develop_t dev 
)
inlinestatic

The rendering supplier: compose this pipe, sample as this pipe was told to.

Definition at line 81 of file masks_distort.h.

References d, dt_dev_pixelpipe_t::iheight, IS_NULL_PTR, dt_dev_pixelpipe_t::iwidth, and dt_dev_pixelpipe_t::mask_rasterization_step.

Referenced by _brush_get_mask(), _brush_get_mask_roi(), _get_area(), _get_area(), _polygon_get_mask(), and _polygon_get_mask_roi().

◆ dt_masks_distort_transform()

static int dt_masks_distort_transform ( const dt_masks_distort_t *const  d,
const double  iop_order,
const int  transf_direction,
float *  points,
size_t  points_count 
)
inlinestatic

Compose forward, bounded exactly as dt_dev_distort_transform_plus() is.

Definition at line 129 of file masks_distort.h.

References d, dt_dev_distort_transform_gui(), dt_dev_distort_transform_plus(), and IS_NULL_PTR.

Referenced by _brush_outline_transform(), and _polygon_get_pts_border().

◆ dt_masks_gui_outline_step()

int dt_masks_gui_outline_step ( const dt_develop_t dev)

The density the dev's GUI shows its outlines at, in image pixels between consecutive samples: what the view published through dt_masks_gui_set_outline_density(), 1 for a dev with no GUI state. Implemented in masks_gui.c, which owns that state; declared here because the GUI supplier below is what reads it.

Definition at line 1908 of file masks_gui.c.

References dt_develop_t::form_gui, IS_NULL_PTR, MAX, and dt_masks_form_gui_t::outline_step.

Referenced by _masks_draw_creation_session_forms(), _overlay_report(), _time_hit_test(), dt_masks_distort_for_gui(), dt_masks_gui_form_create(), and dt_masks_gui_form_test_create().