FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
Loading...
Searching...
No Matches
Typedefs | Functions
fdl_builder.h File Reference

Internal helpers for constructing FDL JSON objects with canonical key order. More...

#include "fdl/fdl_core.h"
#include "fdl_doc.h"
#include "fdl_handles.h"
#include <jsoncons/json.hpp>
#include <string>

Go to the source code of this file.

Typedefs

using fdl::detail::ojson = jsoncons::ojson
 Use ojson (ordered JSON) to preserve key insertion order for canonical serialization.
 

Functions

ojson fdl::detail::make_root (const char *uuid, int version_major, int version_minor, const char *fdl_creator, const char *default_framing_intent)
 Build a minimal FDL root document object with canonical key order.
 
Primitive builders — canonical key order
ojson fdl::detail::make_version (int major, int minor)
 Build a version object with major and minor fields.
 
ojson fdl::detail::make_dimensions_int (int64_t width, int64_t height)
 Build an integer dimensions object (width, height).
 
ojson fdl::detail::make_dimensions_float (double width, double height)
 Build a floating-point dimensions object (width, height).
 
ojson fdl::detail::make_point_float (double x, double y)
 Build a floating-point point object (x, y).
 
ojson fdl::detail::make_round_strategy (const char *even, const char *mode)
 Build a rounding strategy object (even, mode).
 
Sub-object builders — canonical key order
ojson fdl::detail::make_framing_intent (const char *id, const char *label, int64_t aspect_w, int64_t aspect_h, double protection)
 Build a framing intent object with aspect ratio and protection.
 
ojson fdl::detail::make_context (const char *label, const char *context_creator)
 Build a context object with label and creator.
 
ojson fdl::detail::make_canvas (const char *id, const char *label, const char *source_canvas_id, int64_t dim_w, int64_t dim_h, double squeeze)
 Build a canvas object with dimensions and squeeze.
 
ojson fdl::detail::make_framing_decision (const char *id, const char *label, const char *framing_intent_id, double dim_w, double dim_h, double anchor_x, double anchor_y)
 Build a framing decision object with dimensions and anchor point.
 
ojson fdl::detail::make_canvas_template (const char *id, const char *label, int64_t target_w, int64_t target_h, double target_squeeze, fdl_geometry_path_t fit_source, fdl_fit_method_t fit_method, fdl_halign_t halign, fdl_valign_t valign, fdl_round_strategy_t rounding)
 Build a canvas template object with all transform parameters.
 

Detailed Description

Internal helpers for constructing FDL JSON objects with canonical key order.

Each make_* function creates an ojson object with keys inserted in the FDL specification's canonical order, ready for serialization.

Function Documentation

◆ make_version()

ojson fdl::detail::make_version ( int  major,
int  minor 
)

Build a version object with major and minor fields.

Build a version object {"major":…,"minor":…}.

Parameters
majorMajor version number.
minorMinor version number.
Returns
ojson version object.

◆ make_dimensions_int()

ojson fdl::detail::make_dimensions_int ( int64_t  width,
int64_t  height 
)

Build an integer dimensions object (width, height).

Build an integer dimensions object {"width":…,"height":…}.

Parameters
widthWidth in pixels.
heightHeight in pixels.
Returns
ojson dimensions object.

◆ make_dimensions_float()

ojson fdl::detail::make_dimensions_float ( double  width,
double  height 
)

Build a floating-point dimensions object (width, height).

Build a floating-point dimensions object {"width":…,"height":…}.

Parameters
widthWidth.
heightHeight.
Returns
ojson dimensions object.

◆ make_point_float()

ojson fdl::detail::make_point_float ( double  x,
double  y 
)

Build a floating-point point object (x, y).

Build a point object {"x":…,"y":…}.

Parameters
xX coordinate.
yY coordinate.
Returns
ojson point object.

◆ make_round_strategy()

ojson fdl::detail::make_round_strategy ( const char *  even,
const char *  mode 
)

Build a rounding strategy object (even, mode).

Build a round_strategy object {"even":…,"mode":…}.

Parameters
evenRounding even string ("even" or "whole").
modeRounding mode string ("up", "down", or "round").
Returns
ojson round_strategy object.

◆ make_root()

ojson fdl::detail::make_root ( const char *  uuid,
int  version_major,
int  version_minor,
const char *  fdl_creator,
const char *  default_framing_intent 
)

Build a minimal FDL root document object with canonical key order.

Parameters
uuidDocument UUID string.
version_majorFDL spec major version.
version_minorFDL spec minor version.
fdl_creatorCreator identifier string.
default_framing_intentID of the default framing intent.
Returns
ojson root document object.

◆ make_framing_intent()

ojson fdl::detail::make_framing_intent ( const char *  id,
const char *  label,
int64_t  aspect_w,
int64_t  aspect_h,
double  protection 
)

Build a framing intent object with aspect ratio and protection.

Build a framing_intent JSON object.

Parameters
idIntent identifier.
labelHuman-readable label.
aspect_wAspect ratio width component.
aspect_hAspect ratio height component.
protectionProtection factor (0.0–1.0, 0 = no protection).
Returns
ojson framing_intent object.

◆ make_context()

ojson fdl::detail::make_context ( const char *  label,
const char *  context_creator 
)

Build a context object with label and creator.

Build a context JSON object.

Parameters
labelContext label.
context_creatorCreator identifier.
Returns
ojson context object.

◆ make_canvas()

ojson fdl::detail::make_canvas ( const char *  id,
const char *  label,
const char *  source_canvas_id,
int64_t  dim_w,
int64_t  dim_h,
double  squeeze 
)

Build a canvas object with dimensions and squeeze.

Build a canvas JSON object.

Parameters
idCanvas identifier.
labelHuman-readable label.
source_canvas_idID of the source canvas (may be same as id).
dim_wCanvas width in pixels.
dim_hCanvas height in pixels.
squeezeAnamorphic squeeze ratio (1.0 for spherical).
Returns
ojson canvas object.

◆ make_framing_decision()

ojson fdl::detail::make_framing_decision ( const char *  id,
const char *  label,
const char *  framing_intent_id,
double  dim_w,
double  dim_h,
double  anchor_x,
double  anchor_y 
)

Build a framing decision object with dimensions and anchor point.

Build a framing_decision JSON object.

Parameters
idDecision identifier.
labelHuman-readable label.
framing_intent_idID of the referenced framing intent.
dim_wFraming width.
dim_hFraming height.
anchor_xAnchor X offset within canvas.
anchor_yAnchor Y offset within canvas.
Returns
ojson framing_decision object.

◆ make_canvas_template()

ojson fdl::detail::make_canvas_template ( const char *  id,
const char *  label,
int64_t  target_w,
int64_t  target_h,
double  target_squeeze,
fdl_geometry_path_t  fit_source,
fdl_fit_method_t  fit_method,
fdl_halign_t  halign,
fdl_valign_t  valign,
fdl_round_strategy_t  rounding 
)

Build a canvas template object with all transform parameters.

Build a canvas_template JSON object.

Parameters
idTemplate identifier.
labelHuman-readable label.
target_wTarget canvas width in pixels.
target_hTarget canvas height in pixels.
target_squeezeTarget anamorphic squeeze.
fit_sourceGeometry path for fit source layer.
fit_methodFit method (width, height, fill, fit_all).
halignHorizontal alignment.
valignVertical alignment.
roundingRounding strategy for dimensions.
Returns
ojson canvas_template object.