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

Canvas template application — the full transformation pipeline. More...

#include "fdl_template.h"
#include "fdl_compat.h"
#include "fdl_constants.h"
#include "fdl_doc.h"
#include "fdl_enum_map.h"
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>

Functions

fdl_template_result_t fdl::detail::apply_canvas_template (const fdl_canvas_template_t *tmpl, const fdl_canvas_t *source_canvas, const fdl_framing_decision_t *source_framing, const char *new_canvas_id, const char *new_fd_name, const char *source_context_label, const char *context_creator)
 Apply a canvas template to a source canvas/framing.
 

Detailed Description

Canvas template application — the full transformation pipeline.

Pipeline phases:

  1. Read template parameters (fit method, alignment, max dims, rounding).
  2. Validate that fit_source and preserve paths exist in the source data.
  3. Populate source geometry from canvas/framing handles.
  4. Fill hierarchy gaps and calculate anchor offsets.
  5. Normalize, scale, and round the geometry.
  6. Compute output canvas size (with optional max-dimension clamping).
  7. Compute content translation shift (alignment within padded/cropped canvas).
  8. Apply offsets to anchors (with clamping and theoretical tracking).
  9. Crop dimensions to visible portion within canvas bounds.
  10. Build the output FDL document with source copy + transformed canvas.

Function Documentation

◆ apply_canvas_template()

fdl_template_result_t fdl::detail::apply_canvas_template ( const fdl_canvas_template_t tmpl,
const fdl_canvas_t source_canvas,
const fdl_framing_decision_t source_framing,
const char *  new_canvas_id,
const char *  new_fd_name,
const char *  source_context_label,
const char *  context_creator 
)

Apply a canvas template to a source canvas/framing.

Internal implementation — see fdl_apply_canvas_template() for full docs.

Parameters
tmplCanvas template handle.
source_canvasSource canvas handle.
source_framingSource framing decision handle.
new_canvas_idID for the output canvas.
new_fd_nameName for the output framing decision.
source_context_labelLabel from source context (may be NULL).
context_creatorCreator string for the output context.
Returns
Template result with output_fdl on success, error on failure.

< POSIX strdup.

< POSIX strdup.

< POSIX strdup.