FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
Loading...
Searching...
No Matches
Functions
fdl_geometry_api.cpp File Reference

C ABI wrappers for geometry operations. More...

#include "fdl/fdl_core.h"
#include "fdl_constants.h"
#include "fdl_geometry.h"

Functions

fdl_geometry_t fdl_geometry_fill_hierarchy_gaps (fdl_geometry_t geo, fdl_point_f64_t anchor_offset)
 Fill gaps in the geometry hierarchy by propagating populated dimensions upward.
 
fdl_geometry_t fdl_geometry_normalize_and_scale (fdl_geometry_t geo, double source_squeeze, double scale_factor, double target_squeeze)
 Normalize and scale all 7 fields of the geometry.
 
fdl_geometry_t fdl_geometry_round (fdl_geometry_t geo, fdl_round_strategy_t strategy)
 Round all 7 fields of the geometry.
 
fdl_geometry_t fdl_geometry_apply_offset (fdl_geometry_t geo, fdl_point_f64_t offset, fdl_point_f64_t *theo_eff, fdl_point_f64_t *theo_prot, fdl_point_f64_t *theo_fram)
 Apply offset to all anchors, clamping to canvas bounds.
 
fdl_geometry_t fdl_geometry_crop (fdl_geometry_t geo, fdl_point_f64_t theo_eff, fdl_point_f64_t theo_prot, fdl_point_f64_t theo_fram)
 Crop all dimensions to visible portion within canvas.
 
int fdl_geometry_get_dims_anchor_from_path (const fdl_geometry_t *geo, fdl_geometry_path_t path, fdl_dimensions_f64_t *out_dims, fdl_point_f64_t *out_anchor)
 Extract dimensions and anchor from geometry by path.
 
int fdl_resolve_geometry_layer (const fdl_canvas_t *canvas, const fdl_framing_decision_t *framing, fdl_geometry_path_t path, fdl_dimensions_f64_t *out_dims, fdl_point_f64_t *out_anchor)
 Resolve dimensions and anchor directly from canvas/framing handles for a path.
 
fdl_rect_t fdl_make_rect (double x, double y, double width, double height)
 Construct a rect from raw coordinates.
 
fdl_rect_t fdl_canvas_get_rect (const fdl_canvas_t *canvas)
 Get the full canvas rect: (0, 0, dims.width, dims.height).
 
int fdl_canvas_get_effective_rect (const fdl_canvas_t *canvas, fdl_rect_t *out_rect)
 Get the effective (active image) rect of a canvas.
 
fdl_rect_t fdl_framing_decision_get_rect (const fdl_framing_decision_t *fd)
 Get the framing decision rect: (anchor.x, anchor.y, dims.width, dims.height).
 
int fdl_framing_decision_get_protection_rect (const fdl_framing_decision_t *fd, fdl_rect_t *out_rect)
 Get the framing decision protection rect.
 

Detailed Description

C ABI wrappers for geometry operations.

Function Documentation

◆ fdl_geometry_fill_hierarchy_gaps()

fdl_geometry_t fdl_geometry_fill_hierarchy_gaps ( fdl_geometry_t  geo,
fdl_point_f64_t  anchor_offset 
)

Fill gaps in the geometry hierarchy by propagating populated dimensions upward.

If a higher-level dimension is zero but a lower level is set, the gap is filled by copying from the populated layer. Protection is NEVER filled from framing. Anchor points are offset by anchor_offset and clamped to >= 0.

Parameters
geoGeometry with potentially sparse dimension layers.
anchor_offsetOffset applied to anchors during gap-filling.
Returns
Geometry with gaps filled.

◆ fdl_geometry_normalize_and_scale()

fdl_geometry_t fdl_geometry_normalize_and_scale ( fdl_geometry_t  geo,
double  source_squeeze,
double  scale_factor,
double  target_squeeze 
)

Normalize and scale all 7 fields of the geometry.

Applies anamorphic normalization and scaling to all dimension and anchor fields.

Parameters
geoGeometry to transform.
source_squeezeSource anamorphic squeeze factor.
scale_factorScale multiplier.
target_squeezeTarget anamorphic squeeze factor.
Returns
Transformed geometry.

◆ fdl_geometry_round()

fdl_geometry_t fdl_geometry_round ( fdl_geometry_t  geo,
fdl_round_strategy_t  strategy 
)

Round all 7 fields of the geometry.

Parameters
geoGeometry to round.
strategyRounding strategy (even + mode).
Returns
Rounded geometry.

◆ fdl_geometry_apply_offset()

fdl_geometry_t fdl_geometry_apply_offset ( fdl_geometry_t  geo,
fdl_point_f64_t  offset,
fdl_point_f64_t theo_eff,
fdl_point_f64_t theo_prot,
fdl_point_f64_t theo_fram 
)

Apply offset to all anchors, clamping to canvas bounds.

The theoretical (unclamped) anchor values are written to the output pointers for use in subsequent cropping.

Parameters
geoGeometry to offset.
offsetTranslation to apply to all anchor points.
theo_eff[out] Unclamped effective anchor (may be NULL).
theo_prot[out] Unclamped protection anchor (may be NULL).
theo_fram[out] Unclamped framing anchor (may be NULL).
Returns
Geometry with clamped anchors.

◆ fdl_geometry_crop()

fdl_geometry_t fdl_geometry_crop ( fdl_geometry_t  geo,
fdl_point_f64_t  theo_eff,
fdl_point_f64_t  theo_prot,
fdl_point_f64_t  theo_fram 
)

Crop all dimensions to visible portion within canvas.

Enforces the hierarchy invariant: canvas >= effective >= protection >= framing. Uses theoretical (unclamped) anchors to compute visible extents.

Parameters
geoGeometry to crop.
theo_effTheoretical effective anchor (from fdl_geometry_apply_offset).
theo_protTheoretical protection anchor.
theo_framTheoretical framing anchor.
Returns
Cropped geometry.

◆ fdl_geometry_get_dims_anchor_from_path()

int fdl_geometry_get_dims_anchor_from_path ( const fdl_geometry_t geo,
fdl_geometry_path_t  path,
fdl_dimensions_f64_t out_dims,
fdl_point_f64_t out_anchor 
)

Extract dimensions and anchor from geometry by path.

Parameters
geoGeometry to query.
pathWhich dimension layer to extract (canvas, effective, protection, or framing).
out_dims[out] Extracted dimensions.
out_anchor[out] Extracted anchor point ({0,0} for canvas path).
Returns
0 on success, -1 on invalid path.

◆ fdl_resolve_geometry_layer()

int fdl_resolve_geometry_layer ( const fdl_canvas_t canvas,
const fdl_framing_decision_t framing,
fdl_geometry_path_t  path,
fdl_dimensions_f64_t out_dims,
fdl_point_f64_t out_anchor 
)

Resolve dimensions and anchor directly from canvas/framing handles for a path.

Parameters
canvasCanvas handle.
framingFraming decision handle.
pathGeometry path to resolve.
out_dims[out] Resolved dimensions.
out_anchor[out] Resolved anchor point.
Returns
0 on success, 1 if path is valid but data absent (optional field not set, out_dims/out_anchor zero-initialized), -1 on invalid path.

◆ fdl_make_rect()

fdl_rect_t fdl_make_rect ( double  x,
double  y,
double  width,
double  height 
)

Construct a rect from raw coordinates.

Parameters
xLeft edge x-coordinate.
yTop edge y-coordinate.
widthRectangle width.
heightRectangle height.
Returns
Constructed rect.

◆ fdl_canvas_get_rect()

fdl_rect_t fdl_canvas_get_rect ( const fdl_canvas_t canvas)

Get the full canvas rect: (0, 0, dims.width, dims.height).

Parameters
canvasCanvas handle.
Returns
Canvas rect with origin at (0, 0).

◆ fdl_canvas_get_effective_rect()

int fdl_canvas_get_effective_rect ( const fdl_canvas_t canvas,
fdl_rect_t out_rect 
)

Get the effective (active image) rect of a canvas.

Parameters
canvasCanvas handle.
out_rect[out] Effective rect if present.
Returns
FDL_TRUE if effective dimensions exist and out_rect was written, FDL_FALSE if absent.

◆ fdl_framing_decision_get_rect()

fdl_rect_t fdl_framing_decision_get_rect ( const fdl_framing_decision_t fd)

Get the framing decision rect: (anchor.x, anchor.y, dims.width, dims.height).

Parameters
fdFraming decision handle.
Returns
Framing rect.

◆ fdl_framing_decision_get_protection_rect()

int fdl_framing_decision_get_protection_rect ( const fdl_framing_decision_t fd,
fdl_rect_t out_rect 
)

Get the framing decision protection rect.

Parameters
fdFraming decision handle.
out_rect[out] Protection rect if present.
Returns
FDL_TRUE if protection exists and out_rect was written, FDL_FALSE if absent.