Skip to content

Hold the type of a soft mask in the path columns #618

Closed

Description

@yhay81

Context

DESIGN.md section 10. #606 added Paths, whose soft_mask column indexes Paths.soft_masks, the distinct soft masks of the page. hayro 0.9 (#609) reduced a soft mask to its type, so that tuple now holds at most the two values of SoftMaskType, in the order in which the page first paints them. A reader has to go through it to read what the other enum columns (fill_rule, stroke_cap, stroke_join, blend_mode) state directly.

No release holds Paths yet, so this changes no released API. The owner chose this change in the working session of 2026-11-04, after #606's layout had been agreed.

Goal

soft_mask holds the position of the soft mask's type in SoftMaskType, or -1 where the path has none, and Paths.soft_masks no longer exists.

Scope

In:

  • The column as an int8, which Arrow imports as int8, null where it is -1.
  • Removing Paths.soft_masks and what only it needs in the binding.
  • The tests, the API reference, and the column sizes in evidence/path-columns/.

Out:

Paths

crates/pyropdf-python/src/buffers.rs, python/pyropdf/_content.py, python/pyropdf/_core.pyi, tests/test_path_columns.py, docs/en/api/text-and-content.md, and evidence/path-columns/.

Acceptance

  • On every corpus page, and on a page that paints a luminosity mask before an alpha mask, soft_mask holds the position of Path.soft_mask.subtype in SoftMaskType, or -1
  • NumPy reads the column as int8, and Arrow imports it as int8, null where it is -1
  • Paths has no soft_masks, and evidence/path-columns/ shows the new size of the columns

Notes

The row view builds each SoftMask with _soft_mask, as Content does, so the records still equal Content.paths.

Activity

  1. added this to the Phase 1: Reading milestone on Nov 3, 2026
  2. added
    area:pythoncrates/pyropdf-python and python/pyropdf: the binding and the Python API
    on Nov 3, 2026
  3. added
    in-progressClaimed; the latest comment names the branch
    on Nov 3, 2026
  4. yhay81 commented on Nov 3, 2026

    @yhay81
    OwnerAuthor

    Claimed on branch claude/618-soft-mask-type.

  5. yhay81 commented on Nov 3, 2026

    @yhay81
    OwnerAuthor

    Handoff: branch claude/618-soft-mask-type, PR #621, which waits for the owner's review. It is not merged, and auto-merge is off.

    What changed.

    • soft_mask is an int8: the position in SoftMaskType, or -1. Its Arrow field is int8, null where it is -1.
    • Paths.soft_masks and PathColumns.soft_masks are gone.
    • The row view builds each SoftMask with _soft_mask, as Content does.

    Checks.

    • python tools/check.py --locked passes on Windows 11.
    • The NumPy and pyarrow tests of tests/test_path_columns.py pass locally. CI skips them because it installs neither.

    Evidence. evidence/path-columns/results/windows-amd64.md: the columns hold 221 bytes a path on the line pages (115 for the path and 53 per segment), and the other figures stay within the machine's noise.

    Next.

  6. removed
    in-progressClaimed; the latest comment names the branch
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pythoncrates/pyropdf-python and python/pyropdf: the binding and the Python API

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions