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

The masks vocabulary: the enumerations a caller needs to NAME a shape or an operation, and the value types the module hands across its boundary. More...

#include <glib.h>
+ Include dependency graph for masks_types.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_form_group_t
 
struct  dt_masks_member_t
 One shape's membership of one group, BY VALUE. More...
 
struct  dt_masks_form_info_t
 What a form IS, BY VALUE: identity, kind, and – for a group – how many members. More...
 
struct  dt_masks_skip_range_t
 One cut in a shape's border outline: while walking the border buffer forward, on reaching index jump_from, resume at index resume_at. More...
 

Macros

#define DT_MASKS_FORM_NAME_LEN   128
 
#define DEVELOP_MASKS_NB_SHAPES   5
 

Typedefs

typedef struct dt_masks_form_t dt_masks_form_t
 
typedef enum dt_masks_type_t dt_masks_type_t
 
typedef enum dt_masks_state_t dt_masks_state_t
 
typedef enum dt_masks_increment_t dt_masks_increment_t
 
typedef enum dt_masks_edit_mode_t dt_masks_edit_mode_t
 
typedef enum dt_masks_interaction_t dt_masks_interaction_t
 
typedef struct dt_masks_form_group_t dt_masks_form_group_t
 
typedef enum dt_masks_result_t dt_masks_result_t
 What a request that may change the masks model did.
 
typedef struct dt_masks_member_t dt_masks_member_t
 One shape's membership of one group, BY VALUE.
 
typedef struct dt_masks_form_info_t dt_masks_form_info_t
 What a form IS, BY VALUE: identity, kind, and – for a group – how many members.
 
typedef struct dt_masks_skip_range_t dt_masks_skip_range_t
 One cut in a shape's border outline: while walking the border buffer forward, on reaching index jump_from, resume at index resume_at.
 

Enumerations

enum  dt_masks_type_t {
  DT_MASKS_NONE = 0 ,
  DT_MASKS_CIRCLE = 1 << 0 ,
  DT_MASKS_POLYGON = 1 << 1 ,
  DT_MASKS_GROUP = 1 << 2 ,
  DT_MASKS_CLONE = 1 << 3 ,
  DT_MASKS_GRADIENT = 1 << 4 ,
  DT_MASKS_ELLIPSE = 1 << 5 ,
  DT_MASKS_BRUSH = 1 << 6 ,
  DT_MASKS_NON_CLONE = 1 << 7 ,
  DT_MASKS_ALL ,
  DT_MASKS_IS_CLOSED_SHAPE = DT_MASKS_CIRCLE | DT_MASKS_ELLIPSE | DT_MASKS_POLYGON ,
  DT_MASKS_IS_OPEN_SHAPE = DT_MASKS_ALL & ~DT_MASKS_IS_CLOSED_SHAPE ,
  DT_MASKS_IS_RETOUCHE = DT_MASKS_CLONE | DT_MASKS_NON_CLONE ,
  DT_MASKS_IS_PATH_SHAPE = DT_MASKS_POLYGON | DT_MASKS_BRUSH ,
  DT_MASKS_IS_PRIMITIVE_SHAPE = DT_MASKS_CIRCLE | DT_MASKS_ELLIPSE | DT_MASKS_GRADIENT
}
 
enum  dt_masks_state_t {
  DT_MASKS_STATE_NONE = 0 ,
  DT_MASKS_STATE_USE = 1 << 0 ,
  DT_MASKS_STATE_SHOW = 1 << 1 ,
  DT_MASKS_STATE_INVERSE = 1 << 2 ,
  DT_MASKS_STATE_UNION = 1 << 3 ,
  DT_MASKS_STATE_INTERSECTION = 1 << 4 ,
  DT_MASKS_STATE_DIFFERENCE = 1 << 5 ,
  DT_MASKS_STATE_EXCLUSION = 1 << 6 ,
  DT_MASKS_STATE_NOOP = 1 << 7 ,
  DT_MASKS_STATE_IS_COMBINE_OP = DT_MASKS_STATE_UNION | DT_MASKS_STATE_INTERSECTION | DT_MASKS_STATE_DIFFERENCE | DT_MASKS_STATE_EXCLUSION
}
 
enum  dt_masks_increment_t {
  DT_MASKS_INCREMENT_ABSOLUTE = 0 ,
  DT_MASKS_INCREMENT_SCALE = 1 ,
  DT_MASKS_INCREMENT_OFFSET = 2
}
 
enum  dt_masks_edit_mode_t {
  DT_MASKS_EDIT_OFF = 0 ,
  DT_MASKS_EDIT_FULL = 1 ,
  DT_MASKS_EDIT_RESTRICTED = 2
}
 
enum  dt_masks_interaction_t {
  DT_MASKS_INTERACTION_UNDEF = 0 ,
  DT_MASKS_INTERACTION_SIZE = 1 ,
  DT_MASKS_INTERACTION_FADING = 2 ,
  DT_MASKS_INTERACTION_OPACITY = 3 ,
  DT_MASKS_INTERACTION_ROTATION = 4 ,
  DT_MASKS_INTERACTION_LAST
}
 
enum  dt_masks_result_t {
  DT_MASKS_OK = 0 ,
  DT_MASKS_UNCHANGED ,
  DT_MASKS_NOT_FOUND ,
  DT_MASKS_INVALID
}
 What a request that may change the masks model did. More...
 

Detailed Description

The masks vocabulary: the enumerations a caller needs to NAME a shape or an operation, and the value types the module hands across its boundary.

This exists for the same reason colorprofiles/profile_types.h does. develop/masks.h is 880 lines that drag develop/develop.h, develop/pixelpipe.h, caches/pixelpipe_cache_alloc.h, common/logging.h, system/atomic.h, system/simd.h and common/times.h behind them. A translation unit that only needs to say DT_MASKS_CIRCLE, or to receive a description of a shape, should not have to take the pixel pipeline with it – and while it does, it can never drop the include, which is the whole objective of the enclosure (issue #1299).

Nothing here may include anything but <glib.h>. develop/masks.h includes this file first, so every existing consumer keeps compiling unchanged.

Definition in file masks_types.h.

Macro Definition Documentation

◆ DEVELOP_MASKS_NB_SHAPES

#define DEVELOP_MASKS_NB_SHAPES   5

How many shape kinds a user can draw: circle, ellipse, polygon, brush, gradient. Vocabulary, not model – the GUIs size their shape-button arrays with it.

Definition at line 58 of file masks_types.h.

◆ DT_MASKS_FORM_NAME_LEN

#define DT_MASKS_FORM_NAME_LEN   128

Size of dt_masks_form_t.name. Named because a caller receiving a copy needs the bound, and because sizeof(form->name) stops being available once the struct is not in scope.

Definition at line 46 of file masks_types.h.

Typedef Documentation

◆ dt_masks_edit_mode_t

◆ dt_masks_form_group_t

structure used to store all forms's id for a group

◆ dt_masks_form_info_t

What a form IS, BY VALUE: identity, kind, and – for a group – how many members.

name is COPIED rather than borrowed. A borrowed const char * into a refcounted form is exactly the hazard develop/blend_gui.c already trips, caching the pointer across a call that can clone the form underneath it.

member_count is NOT recursive: it counts the group's own rows, which is what every caller that asks means, and what the compositing order is defined over.

◆ dt_masks_form_t

The form itself, named but not defined here.

A caller that only passes a form along, or hands it to develop/masks_group.h to be asked about, needs the name and not the layout – which is the whole point of this header. develop/masks.h completes the type for the code that genuinely manipulates it; repeating the typedef is legal C11 and is what lets both headers stand alone.

Definition at line 54 of file masks_types.h.

◆ dt_masks_increment_t

◆ dt_masks_interaction_t

◆ dt_masks_member_t

One shape's membership of one group, BY VALUE.

The caller gets a copy, never a pointer into the group's own list. That is deliberate twice over: the entry it would otherwise point at belongs to a refcounted, copy-on-write object that the next dt_masks_cow_touch() replaces wholesale, and dt_masks_form_group_t itself can never be made opaque – common/xmp_sidecar.cc casts an XMP blob straight to an array of them and validates the length against sizeof, so its size and field order ARE the on-disk format in every user's sidecars. A value type is what lets everyone else stop depending on that layout.

index is the position in the group's list, and position is meaning: it is the compositing order, the GTK row identity, and the index into iop/retouch.c's rt_forms[] and iop/spots.c's clone_algo[] – both persisted in the user's database.

◆ dt_masks_result_t

What a request that may change the masks model did.

UNCHANGED is not a failure and is the reason this is not a gboolean: a caller that asked for the value a member already has must skip its history commit, or every no-op slider tick writes an undo step and a database row.

◆ dt_masks_skip_range_t

One cut in a shape's border outline: while walking the border buffer forward, on reaching index jump_from, resume at index resume_at.

A brush's or a polygon's border is its centreline offset by the local radius, and that offset curve folds over itself wherever the centreline bends tighter than the radius, and runs through the shape wherever the centreline comes back on itself. The samples that are not on the shape's boundary are found by dt_masks_outline_boundary_skips() – a border sample is on the boundary iff it is not strictly inside any other sample's disc – and are skipped by the GUI's drawer and by every walk that counts crossings (the hit-test). The rasterisers paint every sample: a spoke inside another disc paints nothing new.

These used to travel IN-BAND, encoded into the border buffer itself: NaN in the x slot, the jump target smuggled as an integer in the float y slot. Both bugs this mechanism ever had lived in that encoding, not in the geometry – a cycle when overlapping ranges pointed into each other (fixed by sorting and merging), then issue #1313, where a fold straddling the buffer seam was encoded as its own complement and swallowed 99.8% of the contour. An out-of-band range cannot express either mistake: resume_at > jump_from IS the forward-only invariant, checkable at a glance and validated by the consumers.

Invariants a producer must guarantee (dt_masks_outline_boundary_skips() does):

  • resume_at > jump_from (every skip moves the walk strictly forward);
  • ranges sorted by jump_from and pairwise disjoint (resume_at < next jump_from).

◆ dt_masks_state_t

◆ dt_masks_type_t

forms types

Enumeration Type Documentation

◆ dt_masks_edit_mode_t

Enumerator
DT_MASKS_EDIT_OFF 
DT_MASKS_EDIT_FULL 
DT_MASKS_EDIT_RESTRICTED 

Definition at line 108 of file masks_types.h.

◆ dt_masks_increment_t

Enumerator
DT_MASKS_INCREMENT_ABSOLUTE 
DT_MASKS_INCREMENT_SCALE 
DT_MASKS_INCREMENT_OFFSET 

Definition at line 101 of file masks_types.h.

◆ dt_masks_interaction_t

Enumerator
DT_MASKS_INTERACTION_UNDEF 
DT_MASKS_INTERACTION_SIZE 
DT_MASKS_INTERACTION_FADING 
DT_MASKS_INTERACTION_OPACITY 
DT_MASKS_INTERACTION_ROTATION 
DT_MASKS_INTERACTION_LAST 

Definition at line 123 of file masks_types.h.

◆ dt_masks_result_t

What a request that may change the masks model did.

UNCHANGED is not a failure and is the reason this is not a gboolean: a caller that asked for the value a member already has must skip its history commit, or every no-op slider tick writes an undo step and a database row.

Enumerator
DT_MASKS_OK 
DT_MASKS_UNCHANGED 
DT_MASKS_NOT_FOUND 
DT_MASKS_INVALID 

Definition at line 149 of file masks_types.h.

◆ dt_masks_state_t

Enumerator
DT_MASKS_STATE_NONE 
DT_MASKS_STATE_USE 
DT_MASKS_STATE_SHOW 
DT_MASKS_STATE_INVERSE 
DT_MASKS_STATE_UNION 
DT_MASKS_STATE_INTERSECTION 
DT_MASKS_STATE_DIFFERENCE 
DT_MASKS_STATE_EXCLUSION 
DT_MASKS_STATE_NOOP 
DT_MASKS_STATE_IS_COMBINE_OP 

Definition at line 86 of file masks_types.h.

◆ dt_masks_type_t

forms types

Enumerator
DT_MASKS_NONE 
DT_MASKS_CIRCLE 
DT_MASKS_POLYGON 
DT_MASKS_GROUP 
DT_MASKS_CLONE 
DT_MASKS_GRADIENT 
DT_MASKS_ELLIPSE 
DT_MASKS_BRUSH 
DT_MASKS_NON_CLONE 
DT_MASKS_ALL 
DT_MASKS_IS_CLOSED_SHAPE 
DT_MASKS_IS_OPEN_SHAPE 
DT_MASKS_IS_RETOUCHE 
DT_MASKS_IS_PATH_SHAPE 
DT_MASKS_IS_PRIMITIVE_SHAPE 

Definition at line 61 of file masks_types.h.