NativeElixirPdfUtilities.HtmlToPdf.DrawingGeometry (native_elixir_pdf_utilities v1.1.0)

View Source

Shared drawing coordinates for validated writer boxes and logical annotations.

Pixel snapping happens in the local viewport before applying drawing-group transforms. These calculations consume validator-prepared geometry.

Summary

Functions

Expresses a validated axis or affine transform as a PDF six-value matrix.

Returns the intersection of a validated box's outer and optional inner clip rectangles.

Projects prepared outer and inner box clips with the same rounded curves used by PDF paint.

Returns the bounds of a validated rectangle or exact convex clip polygon.

Clips validated native content in its containing viewport, retaining local transforms.

Tests a validated point against the actual convex clip, including boundary points.

Returns a canonical geometric clip expression for validated composition.

Clips validated polygon corners against an exact convex containing clip.

Returns the cumulative matrix, exact clip and local paint height of validated composition.

Returns the HTML source print canvas for validated page or viewport geometry.

Builds validated elliptical contours using the source printer's float32 conic subdivision.

Returns the effective local clip, including the existing zero-area group rule.

Returns the actual cubic commands shared by rounded rectangle paint and clip projection.

Transforms each validated box clip boundary before intersecting its outer and inner rectangles.

Translates validated artwork and annotations while keeping drawing-group children and clips local.

Translates validated native boxes, including glyph-group children in the parent coordinate space.

Functions

affine_matrix(transform)

@spec affine_matrix(tuple()) :: tuple()

Expresses a validated axis or affine transform as a PDF six-value matrix.

box_clip_bounds(clip)

@spec box_clip_bounds(map() | nil) :: tuple() | nil

Returns the intersection of a validated box's outer and optional inner clip rectangles.

box_clip_expression(clip, transform)

@spec box_clip_expression(map() | nil, tuple()) :: tuple() | nil

Projects prepared outer and inner box clips with the same rounded curves used by PDF paint.

clip_bounds(clip)

@spec clip_bounds(term()) :: tuple() | nil

Returns the bounds of a validated rectangle or exact convex clip polygon.

clip_boxes(boxes, clip, coordinates \\ :containing)

@spec clip_boxes([map()], map(), :containing | :source) :: [map()]

Clips validated native content in its containing viewport, retaining local transforms.

Pagination uses :source for fragment boundaries that transform with the source fragment. Containing clips remain outside pending descendant transform scopes.

clip_contains?(clip, x, y)

@spec clip_contains?(term(), number(), number()) :: boolean()

Tests a validated point against the actual convex clip, including boundary points.

clip_expression(clip)

@spec clip_expression(term()) :: tuple() | nil

Returns a canonical geometric clip expression for validated composition.

clip_polygon(points, clip)

@spec clip_polygon([{number(), number()}], term()) :: [{number(), number()}]

Clips validated polygon corners against an exact convex containing clip.

composition_parts(composition)

@spec composition_parts(tuple() | map()) :: {tuple(), term(), number() | nil}

Returns the cumulative matrix, exact clip and local paint height of validated composition.

css_print_canvas(height)

@spec css_print_canvas(number()) :: %{
  point_scale: float(),
  css_scale: float(),
  css_pixels_per_point: float(),
  height: number()
}

Returns the HTML source print canvas for validated page or viewport geometry.

elliptical_rect_commands(x, y, width, height, radii, subdivisions)

@spec elliptical_rect_commands(number(), number(), number(), number(), map(), 4 | 8) ::
  [
    {integer(), [number()]}
  ]

Builds validated elliptical contours using the source printer's float32 conic subdivision.

local_clip(group, parent_height \\ nil)

@spec local_clip(map(), number() | nil) :: map() | nil

Returns the effective local clip, including the existing zero-area group rule.

rounded_rect_commands(x, y, width, height, radius)

@spec rounded_rect_commands(number(), number(), number(), number(), number()) :: [
  {integer(), [number()]}
]

Returns the actual cubic commands shared by rounded rectangle paint and clip projection.

transform_box_clip(clip, transform)

@spec transform_box_clip(map() | nil, tuple()) :: tuple() | nil

Transforms each validated box clip boundary before intersecting its outer and inner rectangles.

translate_box(box, delta_x, delta_y)

@spec translate_box(map(), number(), number()) :: map()

Translates validated artwork and annotations while keeping drawing-group children and clips local.

translate_boxes(boxes, delta_x, delta_y)

@spec translate_boxes([map()], number(), number()) :: [map()]

Translates validated native boxes, including glyph-group children in the parent coordinate space.