![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Render a mask's rasterisation and its GUI overlay to an image file, headlessly. More...
#include <glib.h>
Include dependency graph for masks_debug.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_debug_request_t |
| What to render. Zeroed means: raster only, at full image resolution, on black. More... | |
Typedefs | |
| typedef enum dt_masks_debug_backdrop_t | dt_masks_debug_backdrop_t |
| What the overlay is drawn on top of. | |
| typedef struct dt_masks_debug_request_t | dt_masks_debug_request_t |
| What to render. Zeroed means: raster only, at full image resolution, on black. | |
Enumerations | |
| enum | dt_masks_debug_backdrop_t { DT_MASKS_DEBUG_BACKDROP_TRANSPARENT = 0 , DT_MASKS_DEBUG_BACKDROP_BLACK , DT_MASKS_DEBUG_BACKDROP_RASTER } |
| What the overlay is drawn on top of. More... | |
Functions | |
| float * | dt_masks_debug_rasterise (struct dt_develop_t *dev, struct dt_masks_form_t *form, int width, int height) |
Rasterise form into a freshly allocated width*height float buffer, 0..1. | |
| gboolean | dt_masks_debug_write_png (struct dt_develop_t *dev, struct dt_masks_form_t *form, const dt_masks_debug_request_t *request, const char *path) |
Render form per request and write it to path as a PNG. | |
| gboolean | dt_masks_debug_write_outline_csv (struct dt_develop_t *dev, struct dt_masks_form_t *form, const char *path) |
Write the shape's outline buffers to path as CSV: index, centreline, border. | |
Render a mask's rasterisation and its GUI overlay to an image file, headlessly.
Mask defects come in two kinds that are easy to confuse and were confused, at cost: the RASTER is wrong (the alpha the pipeline blends with), or the OVERLAY is wrong (what the darkroom draws on top of it). A brush cusp losing coverage and a dashed outline drawing self-intersecting circles are different bugs in different layers, and a fix aimed at the wrong one is how an always-FALSE flag came to delete geometry the rasteriser needed in order to tidy a line the GUI drew.
So this renders BOTH, from one call, with the backdrop chosen by the caller: the overlay alone, over black, or over the rasterised alpha. Seeing them superimposed is what tells the two kinds apart at a glance.
The overlay half runs THE PRODUCTION CODE – dt_masks_events_post_expose_with(), the same function the darkroom calls, differing only in the transform it is handed. A separate drawing path for diagnostics would be a fork that stops agreeing with the GUI exactly when it is needed to explain a GUI problem.
Implemented in src/develop/masks/masks_debug.c.
Definition in file masks_debug.h.
| typedef enum dt_masks_debug_backdrop_t dt_masks_debug_backdrop_t |
What the overlay is drawn on top of.
| typedef struct dt_masks_debug_request_t dt_masks_debug_request_t |
What to render. Zeroed means: raster only, at full image resolution, on black.
What the overlay is drawn on top of.
Definition at line 55 of file masks_debug.h.
| float * dt_masks_debug_rasterise | ( | struct dt_develop_t * | dev, |
| struct dt_masks_form_t * | form, | ||
| int | width, | ||
| int | height | ||
| ) |
Rasterise form into a freshly allocated width*height float buffer, 0..1.
No pipeline distortion is applied: the shape is drawn against the raw image geometry, which is what a geometry regression wants to see – a difference then means the mask code changed, not that some other module's distortion did.
form may be a group. Definition at line 37 of file masks_debug.c.
References double(), dt_calloc_align_float(), DT_DEBUG_ALWAYS, dt_dev_geometry_get_raw_size(), dt_free_align, dt_masks_get_mask_roi(), DT_MASKS_RASTER_ERROR, dt_print(), dt_develop_t::forms, dt_dev_pixelpipe_t::forms, height, dt_dev_pixelpipe_t::iheight, IS_NULL_PTR, dt_dev_pixelpipe_t::iwidth, dt_dev_pixelpipe_t::mask_rasterization_step, dt_masks_form_t::name, width, and dt_iop_roi_t::x.
Referenced by _paint_mask_backdrop(), _run_brush_nodes_at(), _run_case_at(), and _run_polygon_form_at().
| gboolean dt_masks_debug_write_outline_csv | ( | struct dt_develop_t * | dev, |
| struct dt_masks_form_t * | form, | ||
| const char * | path | ||
| ) |
Write the shape's outline buffers to path as CSV: index, centreline, border.
The mask is the union of segments drawn from each centreline sample to its border sample, so when coverage goes missing the answer is in these two arrays and nowhere else – which sample stopped moving, where the border jumped, which directions were never visited. Reading them beats reasoning about the recursion that produced them: three theories about the cusp defect died against this data before the right one survived it.
Definition at line 87 of file masks_debug.c.
References DT_DEBUG_ALWAYS, dt_masks_get_points_border(), DT_MASKS_RASTER_ERROR, dt_pixelpipe_cache_free_align, dt_print(), f, FALSE, i, IS_NULL_PTR, MIN, n, and TRUE.
Referenced by _judge_raster(), and _run_case_at().
| gboolean dt_masks_debug_write_png | ( | struct dt_develop_t * | dev, |
| struct dt_masks_form_t * | form, | ||
| const dt_masks_debug_request_t * | request, | ||
| const char * | path | ||
| ) |
Render form per request and write it to path as a PNG.
form NULL uses the dev's currently visible form. Definition at line 5910 of file masks_gui.c.
References _paint_mask_backdrop(), dt_masks_debug_request_t::backdrop, dt_masks_form_gui_t::dev, double(), dt_masks_debug_request_t::draw_overlay, DT_DEBUG_ALWAYS, dt_dev_geometry_get_raw_size(), dt_dev_geometry_set_processed_size(), dt_dev_get_processed_size(), DT_GUI_COLOR_LAST, DT_MASKS_DEBUG_BACKDROP_RASTER, DT_MASKS_DEBUG_BACKDROP_TRANSPARENT, dt_masks_events_post_expose_with(), dt_masks_get_visible_form(), dt_masks_init_form_gui(), dt_print(), dt_widget_colors(), FALSE, dt_develop_t::form_gui, dt_masks_form_gui_t::form_visible, dt_masks_form_gui_t::formid, height, dt_masks_debug_request_t::height, i, IS_NULL_PTR, dt_masks_overlay_transform_t::scale, transform(), width, and dt_masks_debug_request_t::width.
Referenced by _judge_raster(), and _run_case_at().