![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/masks/masks_functions.h"#include "develop/masks_types.h"#include "caches/pixelpipe_cache_alloc.h"#include "system/mem_alloc.h"#include "math/math.h"#include "common/logging.h"#include "common/times.h"#include <float.h>#include <string.h>
Include dependency graph for masks_outline.c:Go to the source code of this file.
Data Structures | |
| struct | _outline_disc_grid_t |
| struct | _outline_discs_t |
| struct | _outline_blocks_t |
| struct | _outline_cells_t |
| struct | _outline_boundary_t |
Macros | |
| #define | OUTLINE_BLOCK 8 |
| #define | OUTLINE_REPEAT_MIN_WALK 4.0f |
Typedefs | |
| typedef struct _outline_disc_grid_t | _outline_disc_grid_t |
| typedef struct _outline_discs_t | _outline_discs_t |
| typedef struct _outline_blocks_t | _outline_blocks_t |
| typedef struct _outline_cells_t | _outline_cells_t |
| typedef struct _outline_boundary_t | _outline_boundary_t |
Functions | |
| void | dt_masks_outline_offset_along (const float *const centre, float dx, float dy, const float radius, float *const border) |
| void | dt_masks_outline_envelope_offset (const float *centre, float dx, float dy, float radius, float radius_rate, float *out) |
| gboolean | dt_masks_outline_short_way (const float *const centre, const float *const from, const float *const to, const gboolean default_clockwise) |
| static void | _outline_boundary_free (_outline_boundary_t *const b) |
| static gboolean | _outline_boundary_alloc (_outline_boundary_t *const b, const int n) |
| static unsigned | _outline_cell_hash (const int cx, const int cy) |
| static gboolean | _outline_cells_build (_outline_boundary_t *const b, const int n) |
| static gboolean | _outline_cell_repeats (const _outline_boundary_t *const b, const unsigned h, const float bx, const float by, const float walk_limit) |
| static gboolean | _outline_sample_repeats (const _outline_boundary_t *const b, const float bx, const float by, const float walk) |
| static gboolean | _outline_discs_contain (_outline_boundary_t *const b, const int lo, const int hi, const float bx, const float by) |
| static int | _outline_grid_cell (const _outline_disc_grid_t *const g, const float x, const float y) |
| static gboolean | _outline_grid_build (_outline_boundary_t *const b, const float *const bbox, const float r_max) |
| static gboolean | _outline_far_contains (_outline_boundary_t *const b, const int lo, const int hi, const float bx, const float by) |
| static void | _outline_window (const _outline_boundary_t *const b, const int d0, int *const lo, int *const hi) |
| static gboolean | _outline_sample_inside (_outline_boundary_t *const b, const int i, const float bx, const float by) |
| static int | _outline_settle_span (_outline_boundary_t *const b, uint8_t *const dropped, const int from, const int to, const int agreed) |
| static float | _outline_discs_from_outline (const float *const points_h, const float *const border_h, const int n, _outline_boundary_t *const b, float *const bbox) |
| static gboolean | _outline_next_dropped_run (const uint8_t *const dropped, const int n, int *const cursor, int *const from, int *const to) |
| static void | _outline_keep_specks (uint8_t *const dropped, const int n) |
| static int | _outline_skips_from_dropped (const uint8_t *const dropped, const int n, const int header, dt_masks_skip_range_t **const skips_out) |
| static int | _outline_probe_samples (_outline_boundary_t *const b, uint8_t *const dropped, const int n) |
| int | dt_masks_outline_boundary_skips (const float *const points, const float *const border, const int count, const int header, dt_masks_skip_range_t **skips_out) |
| #define OUTLINE_BLOCK 8 |
Definition at line 190 of file masks_outline.c.
| #define OUTLINE_REPEAT_MIN_WALK 4.0f |
Definition at line 259 of file masks_outline.c.
| typedef struct _outline_blocks_t _outline_blocks_t |
| typedef struct _outline_boundary_t _outline_boundary_t |
| typedef struct _outline_cells_t _outline_cells_t |
| typedef struct _outline_disc_grid_t _outline_disc_grid_t |
| typedef struct _outline_discs_t _outline_discs_t |
|
static |
Definition at line 284 of file masks_outline.c.
References _outline_boundary_free(), dt_alloc_align(), IS_NULL_PTR, n, and OUTLINE_BLOCK.
Referenced by dt_masks_outline_boundary_skips().
|
static |
Definition at line 261 of file masks_outline.c.
References dt_free_align.
Referenced by _outline_boundary_alloc(), and dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 306 of file masks_outline.c.
Referenced by _outline_cells_build(), and _outline_sample_repeats().
|
inlinestatic |
Definition at line 343 of file masks_outline.c.
References FALSE, k, and TRUE.
Referenced by _outline_sample_repeats().
|
static |
Definition at line 314 of file masks_outline.c.
References _outline_cell_hash(), dt_alloc_align(), dt_free_align, FALSE, i, IS_NULL_PTR, n, size, and TRUE.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 376 of file masks_outline.c.
References FALSE, MAX, MIN, OUTLINE_BLOCK, and TRUE.
Referenced by _outline_far_contains(), and _outline_sample_inside().
|
static |
Definition at line 541 of file masks_outline.c.
References bbox, i, n, OUTLINE_BLOCK, and r.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 453 of file masks_outline.c.
References _outline_discs_contain(), FALSE, g, MAX, MIN, r, and TRUE.
Referenced by _outline_sample_inside().
|
static |
Definition at line 414 of file masks_outline.c.
References _outline_grid_cell(), bbox, d, dt_alloc_align(), FALSE, g, IS_NULL_PTR, and TRUE.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 404 of file masks_outline.c.
Referenced by _outline_grid_build().
|
static |
Definition at line 647 of file masks_outline.c.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 618 of file masks_outline.c.
References FALSE, i, n, and TRUE.
Referenced by _outline_skips_from_dropped().
|
static |
Definition at line 701 of file masks_outline.c.
References _outline_sample_inside(), _outline_settle_span(), FALSE, i, and n.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 507 of file masks_outline.c.
References _outline_discs_contain(), _outline_far_contains(), _outline_sample_repeats(), _outline_window(), i, and TRUE.
Referenced by _outline_probe_samples(), and _outline_settle_span().
|
inlinestatic |
Definition at line 359 of file masks_outline.c.
References _outline_cell_hash(), _outline_cell_repeats(), FALSE, IS_NULL_PTR, OUTLINE_REPEAT_MIN_WALK, and TRUE.
Referenced by _outline_sample_inside().
|
inlinestatic |
Definition at line 522 of file masks_outline.c.
References _outline_sample_inside().
Referenced by _outline_probe_samples().
|
static |
Definition at line 668 of file masks_outline.c.
References _outline_next_dropped_run(), dt_pixelpipe_cache_alloc_align_cache, IS_NULL_PTR, dt_masks_skip_range_t::jump_from, n, and dt_masks_skip_range_t::resume_at.
Referenced by dt_masks_outline_boundary_skips().
|
inlinestatic |
Definition at line 479 of file masks_outline.c.
Referenced by _outline_sample_inside().
| int dt_masks_outline_boundary_skips | ( | const float *const | points, |
| const float *const | border, | ||
| const int | count, | ||
| const int | header, | ||
| dt_masks_skip_range_t ** | skips_out | ||
| ) |
The boundary of a shape's outline: which border samples are not strictly inside any other sample's disc, published as the skip ranges every consumer of the outline already reads. points and border are the index-aligned centreline and border arrays, header the per-node header triplets both carry. See masks_outline.c.
Definition at line 735 of file masks_outline.c.
References _outline_boundary_alloc(), _outline_boundary_free(), _outline_cells_build(), _outline_discs_from_outline(), _outline_grid_build(), _outline_keep_specks(), _outline_probe_samples(), _outline_skips_from_dropped(), bbox, dt_alloc_align(), DT_DEBUG_MASKS, DT_DEBUG_PERF, dt_free_align, dt_get_debug_flags(), dt_get_wtime(), dt_print(), i, IS_NULL_PTR, and n.
Referenced by _brush_get_points_border(), and _polygon_get_points_border().
| void dt_masks_outline_envelope_offset | ( | const float * | centre, |
| float | dx, | ||
| float | dy, | ||
| float | radius, | ||
| float | radius_rate, | ||
| float * | out | ||
| ) |
Place the border sample of a disc of radius centred at centre, when the disc belongs to a family whose centre moves along the tangent (dx, dy) – any length, the derivative of the spine by its parameter – and whose radius changes by radius_rate per unit of that same parameter.
A border sample on the NORMAL of its spine sample is on the boundary of the union only while the radius is constant. Where the radius grows or shrinks along the spine the boundary is the envelope of the discs, c + r * (-r' T + sqrt(1 - r'^2) N) with r' = dr/ds, tilted off the normal by asin(r'); the normal sample sits inside the union by about r'^2 r / 2 – a fraction of a pixel at the rates a pen draws, invisible to the eye and exactly what the boundary detector rejects, so the outline of a stroke whose radius varied lost whole stretches of both sides (a 37% skipped border on the #1313 corpus brush, most of it along the sides). The tilt is capped at DT_MASKS_OUTLINE_TILT_MAX. The normal is (dy, -dx), the side every border in this module offsets to.
Definition at line 62 of file masks_outline.c.
References DT_MASKS_OUTLINE_TILT_MAX, and out.
Referenced by _brush_border_get_XY(), and _polygon_border_get_XY().
| void dt_masks_outline_offset_along | ( | const float *const | centre, |
| float | dx, | ||
| float | dy, | ||
| const float | radius, | ||
| float *const | border | ||
| ) |
A border sample at radius from centre in the direction (dx, dy); (1, 0) if none.
Definition at line 44 of file masks_outline.c.
Referenced by _brush_leaf_borrow_border(), _brush_walk_segment(), _polygon_points_recurs(), and _polygon_walk_segment().
| gboolean dt_masks_outline_short_way | ( | const float *const | centre, |
| const float *const | from, | ||
| const float *const | to, | ||
| const gboolean | default_clockwise | ||
| ) |
Which way round a joint arc from from to to about centre goes: the short way, or default_clockwise on a tie.
Definition at line 95 of file masks_outline.c.
References FALSE, M_PI, and TRUE.
Referenced by _brush_joint_arc(), and _polygon_joint_arc().