Canvas Template

pyfdl.CanvasTemplate(label=None, id_=None, target_dimensions=None, target_anamorphic_squeeze=None, fit_source=None, fit_method=None, alignment_method_vertical=None, alignment_method_horizontal=None, preserve_from_source_canvas=None, maximum_dimensions=None, pad_to_maximum=None, round_=None)

Bases: Base

fit_source_to_target(source_dimensions, source_anamorphic_squeeze)

Calculate the dimensions of fit_source inside target_dimensions based on fit_mode

Parameters:
  • source_dimensions (Dimensions) –
  • source_anamorphic_squeeze (float) –
Returns:

get_desqueezed_width(source_width, squeeze_factor)

Get the de-squeezed width also considering the target_anamorphic_squeeze. Used to calculate scaling of canvases and framing decisions. If target_anamorphic_squeeze is 0, it's considered "same as source" and no de-squeeze is applied.

Parameters:
  • source_width (float) –

    from source Canvas or FramingDecision

  • squeeze_factor (float) –

    source Canvas.anamorphic_squeeze

Returns:
  • width( float ) –

    scaled to size

get_scale_factor(source_dimensions, source_anamorphic_squeeze)

Calculate the scale factor used when creating a new Canvas and FramingDecision

Parameters:
  • source_dimensions (Dimensions) –
  • source_anamorphic_squeeze (float) –
Returns:
  • scale_factor( float ) –

get_transfer_keys()

Get a list of attributes to transfer from source to destination in the order that preserves all attributes between fit_source and preserve_from_canvas

Returns:
  • keys( list[str] ) –